### Run generate-prn-noise example Source: https://glasgow-embedded.org/en/applets/measure/prn_noise.html Example command to start the PRN noise generator on pin B0 with a 3.3V I/O voltage. ```bash glasgow run generate-prn-noise --voltage B=3.3 --out B0 start ``` -------------------------------- ### CLI start command help Source: https://glasgow-embedded.org/en/applets/measure/prn_noise.html Displays help for the start operation of the generate-prn-noise applet. ```bash usage: glasgow run generate-prn-noise start [-h] ``` -------------------------------- ### glasgow run sensor-sen5x start usage Source: https://glasgow-embedded.org/en/applets/sensor/sen5x.html Usage for the start subcommand. ```text usage: glasgow run sensor-sen5x start [-h] ``` -------------------------------- ### Install documentation dependencies Source: https://glasgow-embedded.org/en/develop/docs.html Navigate to the documentation directory and install the required packages using PDM. ```bash $ cd docs/manual $ pdm install ``` -------------------------------- ### Example CLI progress output Source: https://glasgow-embedded.org/en/library/support/progress.html Example of how a CLI frontend might display progress, showing percentage and byte counts. ```text programming... 13% (65536/500000 bytes) programming... 26% (131072/500000 bytes) (and so on until completion) ``` -------------------------------- ### Install Eudev on Alpine Source: https://glasgow-embedded.org/en/install/source.html Set up the device manager Eudev. ```bash $ doas setup-devd udev ``` -------------------------------- ### Install pipx on Windows Source: https://glasgow-embedded.org/en/install/source.html Install pipx using the Python module and ensure the path is configured. ```batch > py -3 -m pip install --user pipx > py -3 -m pipx ensurepath ``` -------------------------------- ### Install dependencies on Debian Source: https://glasgow-embedded.org/en/install/source.html Install git and pipx using apt and ensure the path is configured. ```bash $ sudo apt install -y --no-install-recommends git pipx $ pipx ensurepath ``` -------------------------------- ### Install dependencies on Fedora Source: https://glasgow-embedded.org/en/install/source.html Install git and pipx using dnf and ensure the path is configured. ```bash $ sudo dnf install -y git pipx $ pipx ensurepath ``` -------------------------------- ### Install Glasgow software on Windows Source: https://glasgow-embedded.org/en/install/source.html Install the software package in editable mode. ```batch > pipx install -e "glasgow/software[builtin-toolchain]" ``` -------------------------------- ### Start live documentation preview Source: https://glasgow-embedded.org/en/develop/docs.html Run the local web server to preview documentation changes in real-time. The output confirms the server is active and watching for file changes. ```bash $ pdm run live [sphinx-autobuild] > sphinx-build .../glasgow/docs/manual/src .../glasgow/docs/manual/out Running Sphinx v7.1.2 loading pickled environment... done building [mo]: targets for 0 po files that are out of date writing output... building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed reading sources... looking for now-outdated files... none found no targets are out of date. build succeeded. The HTML pages are in out. [I 231002 04:16:58 server:335] Serving on http://127.0.0.1:8000 [I 231002 04:16:58 handlers:62] Start watching changes [I 231002 04:16:58 handlers:64] Start detecting changes ``` -------------------------------- ### Install dependencies on FreeBSD Source: https://glasgow-embedded.org/en/install/source.html Install required packages using pkg and ensure the path is configured. ```bash $ sudo pkg install pip pipx yosys abc nextpnr icestorm trellis $ pipx ensurepath ``` -------------------------------- ### Install Glasgow software Source: https://glasgow-embedded.org/en/install/source.html Install the Glasgow software for the current user using pipx. ```bash $ pipx install -e 'glasgow/software' ``` -------------------------------- ### Install dependencies on Arch Source: https://glasgow-embedded.org/en/install/source.html Install git and python-pipx using pacman and ensure the path is configured. ```bash $ sudo pacman -Syu git python-pipx $ pipx ensurepath ``` -------------------------------- ### Install Glasgow software Source: https://glasgow-embedded.org/en/install/source.html Install the software package in editable mode with the builtin-toolchain. ```bash $ pipx install -e 'glasgow/software[builtin-toolchain]' ``` -------------------------------- ### Check Glasgow installation with --version Source: https://glasgow-embedded.org/en/use/basic.html Run this command to verify that the glasgow utility is installed and operational. The expected output is the version information. ```bash $ glasgow --version ``` -------------------------------- ### glasgow run sensor-scd30 start usage Source: https://glasgow-embedded.org/en/applets/sensor/scd30.html Shows the command-line usage for the start subcommand, which optionally compensates for ambient pressure. ```text usage: glasgow run sensor-scd30 start [-h] [PRESSURE] ``` -------------------------------- ### Install dependencies on macOS Source: https://glasgow-embedded.org/en/install/source.html Install libusb and pipx via Homebrew and ensure the path is configured. ```bash $ brew install libusb pipx $ pipx ensurepath ``` -------------------------------- ### Install dependencies on Alpine Source: https://glasgow-embedded.org/en/install/source.html Install required packages and configure the PATH environment variable. ```bash $ doas apk add alpine-conf git pipx py3-libusb1 $ export PATH=$PATH:$HOME/.local/bin $ echo 'export PATH=$PATH:$HOME/.local/bin' >>$HOME/.profile ``` -------------------------------- ### PRNNoiseInterface.start() Source: https://glasgow-embedded.org/en/applets/measure/prn_noise.html Start the LFSR noise output. Zero seeds are clamped to 1 by the gateware. ```APIDOC ## PRNNoiseInterface.start() ### Description Start the LFSR noise output. Zero seeds are clamped to 1 by the gateware. ### Method async ### Endpoint `PRNNoiseInterface.start(seed = DEFAULT_SEED)` ### Parameters #### Arguments - `seed` (int) - Optional - Seed value for the LFSR. Defaults to `DEFAULT_SEED`. Zero seeds are clamped to 1. ### Response No response body specified. ``` -------------------------------- ### Install Python packages with python -m pip Source: https://glasgow-embedded.org/en/install/binary.html Use this command in the Glasgow command prompt to install additional Python packages from PyPI. Installed packages are stored in %USERPROFILE%\.local and are preserved when the toolchain is reinstalled or removed. Note that binary packages built with MSVC (e.g., numpy) are incompatible with the MinGW-based Python in the installer. ```text python -m pip install ... ``` -------------------------------- ### Trace a red LED in JSON format Source: https://glasgow-embedded.org/en/applets/measure/curve_trace.html Performs the same measurement as the previous example but outputs the data in JSON format. ```bash glasgow run curve-trace --port A --start 1.8 --stop 3.3 --format json ``` -------------------------------- ### Install firmware build dependencies on Debian, Arch, and Fedora Source: https://glasgow-embedded.org/en/develop/firmware.html Install the required build tools (GNU Make, sdcc 4.0+, git, and USB support) on Debian, Arch, or Fedora. On Fedora, the sdcc package installs tools into a different location that must be added to the search path. ```shell $ sudo apt install -y --no-install-recommends make sdcc git python3-usb1 ``` ```shell $ sudo pacman -Syu make sdcc git python-libusb1 ``` ```shell $ sudo dnf install -y make sdcc git python3-libusb1 libusb1 ``` -------------------------------- ### Verify Glasgow installation on Windows Source: https://glasgow-embedded.org/en/install/source.html Check version and build a test bitstream. ```batch > glasgow --version > glasgow build --rev C3 uart ``` -------------------------------- ### Invoke Glasgow REPL for i2c-controller Source: https://glasgow-embedded.org/en/use/repl-script.html Starts an interactive REPL session for the i2c-controller applet with a specified voltage. Ensure correct I/O and supply voltage settings before execution. ```bash $ glasgow repl i2c-controller -V 3.3 I: glasgow.hardware.device: device already has bitstream ID 0484178a31cff82770362171c7bccf0a I: glasgow.hardware.assembly: port A voltage set to 3.3 V I: glasgow.hardware.assembly: port B voltage set to 3.3 V I: glasgow.cli: running handler for applet 'i2c-controller' I: glasgow.applet.interface.i2c_controller: dropping to REPL; use 'help(i2c_iface)' to see available APIs >>> ``` -------------------------------- ### Run spi-flashrom and connect with flashrom Source: https://glasgow-embedded.org/en/applets/bridge/flashrom.html Starts the applet on TCP port 2222 and connects flashrom to it. The applet uses the same default pin assignment as the memory-25q applet. ```bash glasgow run spi-flashrom -V 3.3 --freq 4000 tcp::2222 /sbin/flashrom -p serprog:ip=localhost:2222 ``` -------------------------------- ### Original load method without progress Source: https://glasgow-embedded.org/en/library/support/progress.html Initial example of a method that uploads a bitstream via SPIControllerInterface without progress indication. ```python async def load(bitstream: bytes): async with self._spi.select(): await self._spi.write(bitstream) ``` -------------------------------- ### Explore Glasgow subcommands with --help Source: https://glasgow-embedded.org/en/use/basic.html The --help argument can be appended at any command level to get context-specific help. The output differs for each level, as shown by these three commands. ```bash $ glasgow --help $ glasgow run --help $ glasgow run uart --help ``` -------------------------------- ### SPI NOR flash read example Source: https://glasgow-embedded.org/en/applets/interface/spi_controller.html Example from the `select()` method documentation showing how to read 16 bytes from an SPI NOR flash at address `0x001234` using the Read (03h) command. Sets mode to 3, starts a transaction, writes the command and address, then reads the data. ```python iface.mode = 3 async with iface.select(): await iface.write([0x03]) await iface.write((0x001234).to_bytes(3, byteorder="big")) data = await iface.read(16) ``` -------------------------------- ### I2C transaction example: write then read Source: https://glasgow-embedded.org/en/applets/interface/i2c_controller.html Performs a transaction that writes a single byte (0x01) to address 0x50, then reads two bytes from the same address. The transaction ensures a single STOP condition at the end, and repeated START conditions are used for subsequent operations. ```python async with iface.transaction(): await iface.write(0x50, [0x01]) data = await iface.read(0x50, 2) ``` -------------------------------- ### Read 16 bytes from SPI NOR flash using Fast Read (0Bh) Source: https://glasgow-embedded.org/en/applets/interface/qspi_controller.html Example from the select() method documentation. Starts a transaction, writes the Fast Read command and address, clocks 8 dummy cycles, then reads 16 bytes. Requires an active transaction; methods write, read, exchange, and dummy can only be called within a transaction. ```python async with iface.select(): await iface.write([0x0B]) await iface.write((0x001234).to_bytes(3, byteorder="big")) await iface.dummy(8) data = await iface.read(16) ``` -------------------------------- ### Run qspi-analyzer CLI help Source: https://glasgow-embedded.org/en/applets/interface/qspi_analyzer.html Displays the usage information and available arguments for the qspi-analyzer command. ```text usage: glasgow run qspi-analyzer [-h] [-V SPEC] [--cs PIN] [--sck PIN] [--io PINS] [--buffer-size BYTES] [FILE] ``` -------------------------------- ### CLI usage help Source: https://glasgow-embedded.org/en/applets/measure/prn_noise.html Displays the general usage help for the generate-prn-noise applet. ```bash usage: glasgow run generate-prn-noise [-h] [-V SPEC] [--out PIN] OPERATION ... ``` -------------------------------- ### Initialize and build libfx2 submodule Source: https://glasgow-embedded.org/en/develop/firmware.html Check out the libfx2 chip support library submodule at the appropriate revision and compile it before building the firmware. ```shell $ git submodule update --init $ make -C vendor/libfx2/firmware ``` -------------------------------- ### CLI usage help Source: https://glasgow-embedded.org/en/applets/measure/calibrate_clock.html Displays the command-line usage and available options for the calibrate-clock applet. ```bash usage: glasgow run calibrate-clock [-h] [-V SPEC] --ref-pin PIN [--ext-pin PIN] --ref-freq HZ [--ext-freq HZ] [--nominal-sys-clk HZ] [--gate-time SEC] [--ppm PPM] [--count N] ``` -------------------------------- ### spi-flashrom usage help Source: https://glasgow-embedded.org/en/applets/bridge/flashrom.html Shows the command-line usage for the spi-flashrom applet, including all options and the required ENDPOINT argument. ```text usage: glasgow run spi-flashrom [-h] [-V SPEC] [--cs PIN] [--sck PIN] [--copi PIN] [--cipo PIN] [--wp PIN] [--hold PIN] [-f FREQ] ENDPOINT ``` -------------------------------- ### Run swd-probe CLI usage Source: https://glasgow-embedded.org/en/applets/interface/swd_probe.html Displays the general usage and available options for the swd-probe applet. ```text usage: glasgow run swd-probe [-h] [-V SPEC] [--swclk PIN] [--swdio PIN] [-f FREQ] OPERATION ... ``` -------------------------------- ### CLI usage for program-xc9500xl Source: https://glasgow-embedded.org/en/applets/program/xc9500xl.html General usage syntax for the program-xc9500xl applet, including options for pin configuration and frequency settings. ```bash usage: glasgow run program-xc9500xl [-h] [-V SPEC] [--tck PIN] [--tms PIN] [--tdi PIN] [--tdo PIN] [--trst PIN] [-f FREQ] [--scan-ir-max-length LENGTH] [--scan-dr-max-length LENGTH] [--ir-lengths IR-LENGTH,...] [--tap-index INDEX] [--slow] OPERATION ... ``` -------------------------------- ### glasgow run generate-prn-noise start Source: https://glasgow-embedded.org/en/applets/measure/prn_noise.html Start the LFSR noise output. Zero seeds are clamped to 1 by the gateware. ```APIDOC ## glasgow run generate-prn-noise start ### Description Start the LFSR noise output. Zero seeds are clamped to 1 by the gateware. ### Method CLI ### Endpoint `glasgow run generate-prn-noise start` ### Parameters #### Global Options - `-h, --help` - Optional - Show this help message and exit ### Request Example ``` glasgow run generate-prn-noise start ``` ### Response No response body specified. ``` -------------------------------- ### Build the firmware Source: https://glasgow-embedded.org/en/develop/firmware.html Build the firmware itself from the firmware/ subtree. ```shell $ make -C firmware ``` -------------------------------- ### List UART applet subcommands and socket help Source: https://glasgow-embedded.org/en/use/basic.html Use the --help flag to discover available subcommands for an applet and to view specific argument requirements for those subcommands. ```bash $ glasgow run uart --help [...] positional arguments: OPERATION tty connect UART to stdin/stdout pty connect UART to a pseudo-terminal device file socket connect UART to a socket [...] $ glasgow run socket --help usage: glasgow run uart socket [-h] ENDPOINT positional arguments: ENDPOINT listen at ENDPOINT, either unix:PATH or tcp:HOST:PORT [...] ``` -------------------------------- ### jtag-xvc usage help Source: https://glasgow-embedded.org/en/applets/bridge/jtag_xvc.html Shows the command-line usage and options for the jtag-xvc applet. ```text usage: glasgow run jtag-xvc [-h] [-V SPEC] [--tck PIN] [--tms PIN] [--tdi PIN] [--tdo PIN] [-f FREQ] [ENDPOINT] ``` -------------------------------- ### Verify Glasgow installation Source: https://glasgow-embedded.org/en/install/source.html Check the version and build a test bitstream to confirm operation. ```bash $ glasgow --version $ glasgow build --rev C3 uart ``` -------------------------------- ### memory-24x read usage Source: https://glasgow-embedded.org/en/applets/memory/24x.html Usage for the read subcommand. Reads memory starting at ADDRESS with wraparound, and optionally writes contents to FILENAME. ```text usage: glasgow run memory-24x read [-h] [-f FILENAME] ADDRESS LENGTH ``` -------------------------------- ### Display curve-trace help Source: https://glasgow-embedded.org/en/applets/measure/curve_trace.html Shows the usage and available command-line arguments for the curve-trace applet. ```bash usage: glasgow run curve-trace [-h] [-V SPEC] --port {A,B} [--start VOLTS] [--stop VOLTS] [--step VOLTS] [--settle SEC] [--cal FILE] [--sense-voltage] [--stop-current MILLIAMPS] [--diode] [--ref-voltage VOLTS] [--format {csv,json}] ``` -------------------------------- ### Usage: glaszgow run program-nrf24lx1 Source: https://glasgow-embedded.org/en/applets/program/nrf24lx1.html Shows the command-line usage for the main `program-nrf24lx1` applet, including options for pin bindings, SPI frequency, and device type. ```text usage: glasgow run program-nrf24lx1 [-h] [-V SPEC] [--prog PIN] [--sck PIN] [--copi PIN] [--cipo PIN] [--cs PIN] [--reset PIN] [-f FREQ] -d DEVICE OPERATION ... ``` -------------------------------- ### Usage with TCP sockets Source: https://glasgow-embedded.org/en/applets/bridge/jtag_openocd.html Starts the Glasgow jtag-openocd applet listening on a TCP socket and configures OpenOCD to connect to it using the remote_bitbang driver. ```bash glasgow run jtag-openocd tcp:localhost:2222 openocd -c 'adapter driver remote_bitbang; transport select jtag' \ -c 'remote_bitbang port 2222' \ -c 'reset_config none' ``` -------------------------------- ### CLI usage for control-si535x Source: https://glasgow-embedded.org/en/applets/control/si535x.html General usage syntax for the control-si535x applet. ```text usage: glasgow run control-si535x [-h] [-V SPEC] [--scl PIN] [--sda PIN] [--i2c-address ADDR] OPERATION ... ``` -------------------------------- ### Chunking an address range for read operation Source: https://glasgow-embedded.org/en/library/support/progress.html Example of using Progress.chunks() to split an address range into chunks for a read operation, with chunk as a range. ```python for chunk in Progress.chunks(range(start, start + length), chunk_size, action="reading", item="B", scale=1024): data += read_data(chunk.start, len(chunk)) # here `chunk` is a `range` ``` -------------------------------- ### Chunking a byte array for write operation Source: https://glasgow-embedded.org/en/library/support/progress.html Example of using Progress.chunks() to split a byte array into chunks for a write operation, with chunk as a memoryview. ```python for chunk in Progress.chunks(memoryview(data), chunk_size, action="programming", item="B", scale=1024): write_data(chunk) # here `chunk` is a `memoryview` ``` -------------------------------- ### analyzer2 help output Source: https://glasgow-embedded.org/en/applets/interface/analyzer2.html Displays the usage information and available command-line arguments for the analyzer2 applet. ```text usage: glasgow run analyzer2 [-h] [-V SPEC] [--buffer-size SIZE] [--listen [ENDPOINT]] PROBES [PROBES ...] ``` -------------------------------- ### Run UART applet in tty mode Source: https://glasgow-embedded.org/en/use/basic.html Starts the UART applet with 3.3V logic, pins A0/A1, and a baud rate of 57600 in tty mode. ```bash $ glasgow run uart -V 3.3 --tx A0 --rx A1 -b 57600 tty ``` -------------------------------- ### Run SPI controller applet Source: https://glasgow-embedded.org/en/use/basic.html Executes an SPI transfer of five bytes with specified pins and voltage. ```bash $ glasgow run spi-controller -V 3.3 --sck A0 --cs A1 --copi A2 --cipo A3 \ '0301235ff5' ``` -------------------------------- ### erase subcommand usage Source: https://glasgow-embedded.org/en/applets/program/ice40_flash.html Usage for the erase subcommand which erases a memory range. Start and end address must align on erase size boundaries. ```text usage: glasgow run program-ice40-flash erase [-h] ADDRESS LENGTH ``` -------------------------------- ### glasgow run debug-arm7 dump-memory Source: https://glasgow-embedded.org/en/applets/debug/arm7.html Dump a memory region from the target ARM7TDMI processor. Specify the start address and length, optionally saving to a file. ```APIDOC ## glasgow run debug-arm7 dump-memory ### Description Dump a memory region from the target ARM7TDMI processor. ### Usage ``` usage: glasgow run debug-arm7 dump-memory [-h] [-f FILENAME] ADDRESS LENGTH ``` ### Arguments - `address` - start at ADDRESS - `length` - dump LENGTH bytes ### Options - `-h, --help` - show this help message and exit - `-f , --file ` - dump contents to FILENAME ``` -------------------------------- ### program-ice40-flash main usage Source: https://glasgow-embedded.org/en/applets/program/ice40_flash.html Shows the command-line usage and available options for the main program-ice40-flash command. Includes options for pins, frequency, SPI modes, address width, page size, and custom opcodes. ```text usage: glasgow run program-ice40-flash [-h] [-V SPEC] [--cs PIN] [--sck PIN] [--io PINS] [--reset PIN] [--done PIN] [-f FREQ] [--dual-spi] [--quad-spi] [-A WIDTH] [-P SIZE] [--opcode-erase-4k OPCODE] [--opcode-erase-32k OPCODE] [--opcode-erase-64k OPCODE] OPERATION ... ```