Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bd7a031466d9
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 938e1c284235
Choose a head ref
  • 2 commits
  • 15 files changed
  • 1 contributor

Commits on Apr 27, 2015

  1. runtime: update lwip

    sbourdeauducq committed Apr 27, 2015
    Copy the full SHA
    1ca4978 View commit details
  2. Remove UP support.

    The only advantage of UP is to support the Papilio Pro, but that port is also very limited in other ways and the Pipistrello provides a more reasonable platform that also supports AMP.
    
    On the other hand, RPCs on UP are difficult to implement with the session.c protocol system (without an operating system or coroutines), along with many other minor difficulties and maintainance issues. Planned features such as watchdogs in the core device are also difficult on UP.
    sbourdeauducq committed Apr 27, 2015
    Copy the full SHA
    938e1c2 View commit details
43 changes: 16 additions & 27 deletions artiq/frontend/artiq_flash.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash

set -e

ARTIQ_PREFIX=$(python3 -c "import artiq; print(artiq.__path__[0])")

# Default is ppro
BOARD=ppro
# Default is kc705
BOARD=kc705

while getopts "bBrht:d:" opt
do
@@ -21,15 +23,12 @@ do
if [ "$OPTARG" == "kc705" ]
then
BOARD=kc705
elif [ "$OPTARG" == "ppro" ]
then
BOARD=ppro
elif [ "$OPTARG" == "pipistrello" ]
then
BOARD=pipistrello
else
echo "Supported targets (-t option) are:"
echo "kc705, ppro, or pipistrello"
echo "kc705 or pipistrello"
exit 1
fi
;;
@@ -47,12 +46,12 @@ do
echo ""
echo "To flash everything, do not use any of the -b|-B|-r option."
echo ""
echo "usage: $0 [-b] [-B] [-r] [-h] [-t kc705|ppro|pipistrello] [-d path]"
echo "usage: $0 [-b] [-B] [-r] [-h] [-t kc705|pipistrello] [-d path]"
echo "-b Flash bitstream"
echo "-B Flash BIOS"
echo "-r Flash ARTIQ runtime"
echo "-h Show this help message"
echo "-t Target (kc705, pipistrello, ppro, default is: ppro)"
echo "-t Target (kc705, pipistrello, default is: kc705)"
echo "-d Directory containing the binaries to be flashed"
exit 1
;;
@@ -88,36 +87,26 @@ then
BIN_PREFIX=$BIN_PATH
fi

if [ "$BOARD" == "ppro" ]
if [ "$BOARD" == "kc705" ]
then
UDEV_RULES=99-ppro.rules
BITSTREAM=artiq_ppro-up-papilio_pro.bin
CABLE=papilio
PROXY=bscan_spi_lx9_papilio.bit
BIOS_ADDR=0x60000
RUNTIME_ADDR=0x70000
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/ppro; fi
UDEV_RULES=99-kc705.rules
BITSTREAM=artiq_kc705-artiqsocbasic-kc705.bit
CABLE=jtaghs1_fast
PROXY=bscan_spi_kc705.bit
BIOS_ADDR=0xaf0000
RUNTIME_ADDR=0xb00000
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/kc705; fi
search_for_proxy $PROXY
elif [ "$BOARD" == "pipistrello" ]
then
UDEV_RULES=99-ppro.rules
UDEV_RULES=99-papilio.rules
BITSTREAM=artiq_pipistrello-amp-pipistrello.bin
CABLE=papilio
PROXY=bscan_spi_lx9_csg324.bit
BIOS_ADDR=0x170000
RUNTIME_ADDR=0x180000
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/pipistrello; fi
search_for_proxy $PROXY
elif [ "$BOARD" == "kc705" ]
then
UDEV_RULES=99-kc705.rules
BITSTREAM=artiq_kc705-artiqsocbasic-kc705.bit
CABLE=jtaghs1_fast
PROXY=bscan_spi_kc705.bit
BIOS_ADDR=0xaf0000
RUNTIME_ADDR=0xb00000
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/kc705; fi
search_for_proxy $PROXY
fi

# Check if neither of -b|-B|-r have been used
22 changes: 8 additions & 14 deletions doc/manual/fpga_board_ports.rst
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@ KC705

The main target board for the ARTIQ core device is the KC705 development board from Xilinx.

Papilio Pro
Pipistrello
-----------

The low-cost Papilio Pro FPGA board can be used with some limitations.
The low-cost Pipistrello FPGA board can be used as a lower-cost but slower alternative.

When plugged to an adapter, the NIST QC1 hardware can be used with a limited number of TTL channels. The TTL lines are mapped to RTIO channels as follows:
When plugged to an adapter, the NIST QC1 hardware can be used. The TTL lines are mapped to RTIO channels as follows:

+--------------+----------+-----------------+
| RTIO channel | TTL line | Capability |
@@ -20,19 +20,13 @@ When plugged to an adapter, the NIST QC1 hardware can be used with a limited num
+--------------+----------+-----------------+
| 1 | PMT1 | Input only |
+--------------+----------+-----------------+
| 2 | TTL0 | Output only |
| 2-18 | TTL0-16 | Output only |
+--------------+----------+-----------------+
| 3 | TTL1 | Output only |
| 19-21 | LEDs | Output only |
+--------------+----------+-----------------+
| 4 | TTL2 | Output only |
+--------------+----------+-----------------+
| 5 | TTL3 | Output only |
+--------------+----------+-----------------+
| 6 | TTL4 | Output only |
+--------------+----------+-----------------+
| 7 | FUD | DDS driver only |
| 22 | TTL2 | Output only |
+--------------+----------+-----------------+

The input only limitation on channels 0 and 1 comes from the QC-DAQ adapter. When the adapter is not used (and physically unplugged from the Papilio Pro board), the corresponding pins on the Papilio Pro can be used as outputs. Do not configure these channels as outputs when the adapter is plugged, as this would cause electrical contention.
The input only limitation on channels 0 and 1 comes from the QC-DAQ adapter. When the adapter is not used (and physically unplugged from the Pipistrello board), the corresponding pins on the Pipistrello can be used as outputs. Do not configure these channels as outputs when the adapter is plugged, as this would cause electrical contention.

The board can accept an external RTIO clock connected to XTRIG.
The board can accept an external RTIO clock connected to PMT2.
4 changes: 2 additions & 2 deletions doc/manual/getting_started.rst
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ Create a new file ``rtio.py`` containing the following: ::
delay(2*us)


Connect an oscilloscope or logic analyzer to TTL0 (pin C11 on the Papilio Pro) and run ``artiq_run.py led.py``. Notice that the generated signal's period is precisely 4 microseconds, and that it has a duty cycle of precisely 50%. This is not what you would expect if the delay and the pulse were implemented with CPU-controlled GPIO: overhead from the loop management, function calls, etc. would increase the signal's period, and asymmetry in the overhead would cause duty cycle distortion.
Connect an oscilloscope or logic analyzer to TTL0 (pin C11 on the Pipistrello) and run ``artiq_run.py led.py``. Notice that the generated signal's period is precisely 4 microseconds, and that it has a duty cycle of precisely 50%. This is not what you would expect if the delay and the pulse were implemented with CPU-controlled GPIO: overhead from the loop management, function calls, etc. would increase the signal's period, and asymmetry in the overhead would cause duty cycle distortion.

Instead, inside the core device, output timing is generated by the gateware and the CPU only programs switching commands with certain timestamps that the CPU computes. This guarantees precise timing as long as the CPU can keep generating timestamps that are increasing fast enough. In case it fails to do that (and attempts to program an event with a timestamp in the past), the :class:`artiq.coredevice.runtime_exceptions.RTIOUnderflow` exception is raised. The kernel causing it may catch it (using a regular ``try... except...`` construct), or it will be propagated to the host.

@@ -138,7 +138,7 @@ Try the following code and observe the generated pulses on a 2-channel oscillosc
self.ttl1.pulse(4*us)
delay(4*us)

TTL1 is assigned to the pin C10 of the Papilio Pro. The name of the attributes (``ttl0`` and ``ttl1``) is used to look up hardware in the device database.
TTL1 is assigned to the pin C10 of the Pipistrello. The name of the attributes (``ttl0`` and ``ttl1``) is used to look up hardware in the device database.

Within a parallel block, some statements can be made sequential again using a ``with sequential`` construct. Observe the pulses generated by this code: ::

18 changes: 9 additions & 9 deletions doc/manual/installing.rst
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@ These steps are required to generate bitstream (``.bit``) files, build the MiSoC

* Install the FPGA vendor tools (e.g. Xilinx ISE and/or Vivado):

* Get Xilinx tools from http://www.xilinx.com/support/download/index.htm. ISE can build bitstreams both for boards using the Spartan-6 (Papilio Pro) and 7-series devices (KC705), while Vivado supports only boards using 7-series devices.
* Get Xilinx tools from http://www.xilinx.com/support/download/index.htm. ISE can build bitstreams both for boards using the Spartan-6 (Pipistrello) and 7-series devices (KC705), while Vivado supports only boards using 7-series devices.

* The Papilio Pro is supported by Webpack, the KC705 is not.
* The Pipistrello is supported by Webpack, the KC705 is not.

* During the Xilinx toolchain installation, uncheck ``Install cable drivers`` (they are not required as we use better and open source alternatives).

@@ -52,7 +52,7 @@ These steps are required to generate bitstream (``.bit``) files, build the MiSoC
$ make -j4
$ sudo make install

* Install JTAG tools needed to program Papilio Pro and KC705:
* Install JTAG tools needed to program the Pipistrello and KC705:

::

@@ -69,14 +69,14 @@ These steps are required to generate bitstream (``.bit``) files, build the MiSoC

The purpose of the flash proxy bitstream is to give programming software fast JTAG access to the flash connected to the FPGA.

* Papilio Pro:
* Pipistrello:

::

$ cd ~/artiq-dev
$ git clone https://github.com/GadgetFactory/Papilio-Loader
$ wget http://www.phys.ethz.ch/~robertjo/bscan_spi_lx45_csg324.bit

Then copy ``~/artiq-dev/Papilio-Loader/xc3sprog/trunk/bscan_spi/bscan_spi_lx9_papilio.bit`` to ``~/.migen``, ``/usr/local/share/migen`` or ``/usr/share/migen``.
Then copy ``~/artiq-dev/bscan_spi_lx45_csg324.bit`` to ``~/.migen``, ``/usr/local/share/migen`` or ``/usr/share/migen``.

* KC705:

@@ -107,9 +107,9 @@ These steps are required to generate bitstream (``.bit``) files, build the MiSoC
* Then, build and flash the ARTIQ runtime: ::

$ cd ~/artiq-dev/artiq/soc/runtime && make runtime.fbi
$ ~/artiq-dev/artiq/artiq/frontend/artiq_flash.sh -t ppro -d $PWD -r
$ ~/artiq-dev/artiq/artiq/frontend/artiq_flash.sh -t pipistrello -d $PWD -r

.. note:: The `-t` option specifies the board your are targeting. Available options are `ppro` for Papilio Pro, `kc705` for KC705 and `pipistrello` for Pipistrello.
.. note:: The `-t` option specifies the board your are targeting. Available options are ``kc705`` and ``pipistrello``.

* Check that the board boots by running a serial terminal program (you may need to press its FPGA reconfiguration button or power-cycle it to load the bitstream that was newly written into the flash): ::

@@ -192,7 +192,7 @@ This command installs all the required packages: ::

Note that ARTIQ requires Python 3.4 or above.

To set user permissions on the JTAG and serial ports of the Papilio Pro, create a ``/etc/udev/rules.d/30-usb-papilio-pro.rules`` file containing the following: ::
To set user permissions on the JTAG and serial ports of the Pipistrello, create a ``/etc/udev/rules.d/30-usb-papilio.rules`` file containing the following: ::

SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", GROUP="dialout"

File renamed without changes.
25 changes: 4 additions & 21 deletions soc/runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
include $(MSCDIR)/software/common.mak

OBJECTS := isr.o flash_storage.o elf_loader.o services.o session.o log.o test_mode.o kloader.o main.o
OBJECTS_KSUPPORT := exception_jmp.o exceptions.o rtio.o dds.o

# NOTE: this does not handle dependencies well. Run "make clean"
# when switching between UP and AMP.
UNIPROCESSOR := $(shell printf "\#include <generated/csr.h>\nCSR_KERNEL_CPU_BASE" | $(CC_normal) $(CFLAGS) -E - | tail -n 1 | grep -c CSR_KERNEL_CPU_BASE)

ifeq ($(UNIPROCESSOR),0)
OBJECTS += mailbox.o ksupport_data.o
OBJECTS_KSUPPORT += mailbox.o bridge.o ksupport.o
CFLAGS += -DARTIQ_AMP
SERVICE_TABLE_INPUT = ksupport.elf
else
ifeq ($(UNIPROCESSOR),1)
OBJECTS += $(OBJECTS_KSUPPORT)
else
$(error failed to determine UP/AMP build)
endif
endif
OBJECTS := isr.o flash_storage.o elf_loader.o services.o session.o log.o test_mode.o kloader.o mailbox.o ksupport_data.o main.o
OBJECTS_KSUPPORT := ksupport.o exception_jmp.o exceptions.o mailbox.o bridge.o rtio.o dds.o

CFLAGS += -Ilwip/src/include -Iliblwip

@@ -57,8 +40,8 @@ ksupport.elf: $(OBJECTS_KSUPPORT)
ksupport_data.o: ksupport.bin
$(LD) -r -b binary -o $@ $<

service_table.h: $(SERVICE_TABLE_INPUT) gen_service_table.py
@echo " GEN " $@ && ./gen_service_table.py $(SERVICE_TABLE_INPUT) > $@
service_table.h: ksupport.elf gen_service_table.py
@echo " GEN " $@ && ./gen_service_table.py ksupport.elf > $@

services.c: service_table.h

20 changes: 5 additions & 15 deletions soc/runtime/gen_service_table.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@

import sys

from elftools.elf.elffile import ELFFile


services = [
("syscalls", [
@@ -24,17 +26,7 @@
]


def print_up():
for name, contents in services:
print("static const struct symbol {}[] = {{".format(name))
for name, value in contents:
print(" {{\"{}\", {}}},".format(name, value))
print(" {NULL, NULL}")
print("};")


def print_amp(ksupport_elf_filename):
from elftools.elf.elffile import ELFFile
def print_service_table(ksupport_elf_filename):
with open(ksupport_elf_filename, "rb") as f:
elf = ELFFile(f)
symtab = elf.get_section_by_name(b".symtab")
@@ -50,10 +42,8 @@ def print_amp(ksupport_elf_filename):


def main():
if len(sys.argv) == 1:
print_up()
elif len(sys.argv) == 2:
print_amp(sys.argv[1])
if len(sys.argv) == 2:
print_service_table(sys.argv[1])
else:
print("Incorrect number of command line arguments")
sys.exit(1)
6 changes: 0 additions & 6 deletions soc/runtime/kloader.c
Original file line number Diff line number Diff line change
@@ -49,12 +49,10 @@ static int symtab_add(const char *name, void *target)

int kloader_load(void *buffer, int length)
{
#ifdef ARTIQ_AMP
if(!kernel_cpu_reset_read()) {
log("BUG: attempted to load while kernel CPU running");
return 0;
}
#endif
symtab_init();
return load_elf(
resolve_service_symbol, symtab_add,
@@ -66,8 +64,6 @@ kernel_function kloader_find(const char *name)
return find_symbol(symtab, name);
}

#ifdef ARTIQ_AMP

extern char _binary_ksupport_bin_start;
extern char _binary_ksupport_bin_end;

@@ -107,5 +103,3 @@ void kloader_stop_kernel(void)
{
kernel_cpu_reset_write(1);
}

#endif
2 changes: 0 additions & 2 deletions soc/runtime/kloader.h
Original file line number Diff line number Diff line change
@@ -9,11 +9,9 @@ typedef void (*kernel_function)(void);
int kloader_load(void *buffer, int length);
kernel_function kloader_find(const char *name);

#ifdef ARTIQ_AMP
void kloader_start_bridge(void);
void kloader_start_idle_kernel(void);
void kloader_start_user_kernel(kernel_function k);
void kloader_stop_kernel(void);
#endif

#endif /* __KLOADER_H */
2 changes: 1 addition & 1 deletion soc/runtime/lwip
Submodule lwip updated from e59bee to 737a69
Loading