commit | 663c1516c5e303898dae5550b179e69f3f58a4fd | [log] [tgz] |
---|---|---|
author | pigweed-roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com> | Wed Mar 27 09:35:33 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Mar 27 09:35:33 2024 +0000 |
tree | 8a88a25eff04fd0f92b6b55d72d961ca0acf7091 | |
parent | b011b74d79393a743f5f487a7dceb78d8722542f [diff] |
[third_party/pigweed] Roll 24 commits d595cc8bc24ce2e pw_hdlc: Add async router 9bbfe80a2ffff7c pw_{log_basic,sys_io}: Fix Soong definitions 9c33f41cda92196 pw_trace_tokenized: Fix static initialization 3473c9118a43845 pw_log_tokenized: Define as cc_static_library e0888f672378e3e pw_router: Define as cc_static_library 68e898711ea85b8 pw_toolchain: Define as cc_static_library df4efa0243b5dba pw_result: Define as cc_static_library 595fd9562a8d905 pw_build_info: Add log function of GNU build ID 6ebdfaf68c2e080 pw_span: Define as cc_static_library d99ef2cf38ae998 pw_preprocessor: Define as cc_static_library 04fbfa382513335 pw_bluetooth_sapphire: Add emulator start workflow e9441715b774fc7 pw_polyfill: Define as cc_static_library 5c53b840a4ecd3f pw_rpc_transport: Define as cc_static_library d6d27ec27a71859 pw_function: Define as cc_static_library e0abef00c07545a pw_multibuf: Define as cc_static_library cb32298c56d1b71 pw_log_null: Define as cc_static_library 7cffdd83bfd413c pw_thread: Follow Soong guidance 7682e4abe456481 pw_allocator: Add allocation detail storage to Tra ebcc8c717f3980d pw_channel: Add loopback channel 72a1d6f484ecbd1 pw_toolchain: Remove unusued source set 16d3c47ab5a6d45 pw_status: Add StatusWithSize::size_or 55b88ef80fc2403 pw_channel: Split open bits for read and write be2ee681c2c0176 pw_async2: Add PendFuncTask a9d379800be4ccd pw_allocator: Distinguish between requested, usabl https://pigweed.googlesource.com/pigweed/pigweed third_party/pigweed Rolled-Commits: c59bb69e5e17000..d595cc8bc24ce2e Roller-URL: https://ci.chromium.org/b/8752322601903538561 GitWatcher: ignore CQ-Do-Not-Cancel-Tryjobs: true Change-Id: Ic1f386bc3b282673d50d47fc480e38734d5623f7 Reviewed-on: https://pigweed-review.googlesource.com/c/gonk/+/200086 Bot-Commit: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com> Commit-Queue: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
Clone the repo
git clone https://pigweed.googlesource.com/pigweed/gonk
Source bootstrap.sh
to download all compilers and tooling into the environment
directory:
. ./bootstrap.sh
This should init all git submodules for you.
From here on the Pigweed environment is activated. You can activate the environment in a new shell without re-running bootstrap by sourcing activate.sh
. ./activate.sh
Build for the host and device by running:
pw build
This is mostly a shortcut with nice output for running gn gen out/gn
and ninja -C out/gn
.
The build commands are defined in: //tools/gonk_tools/build_project.py
.
The Verilog build requires the following to be installed on Linux:
sudo apt install fpga-icestorm nextpnr-ice40 yosys
Run this to compile:
pw build
The bitstream files will be written with the .bin
extenson under ./out/gn/obj/fpga/*/*.bin
along with log output files.
For example:
$ ls ./out/gn/obj/fpga/toplevel/ nextpnr-log.txt toplevel.asc toplevel.bin toplevel.json toplevel_timing_report.json toplevel_timing_report.txt yosys-log.txt
Flash the stm32f7 and launch the write_fpga.py
script on a bitstream file.
Unplug gonk from USB and replug with MODE button held down.
Run pw flash
on the MCU binary.
pw flash ./out/gn/arduino_size_optimized/obj/applications/fpga_config/fpga_config.bin
Write an FPGA bitstream with the write_fpga.py
script:
python ./tools/gonk_tools/write_fpga.py \ --bitstream-file ./out/gn/obj/fpga/toplevel/toplevel.bin --database ./out/gn/arduino_size_optimized/obj/applications/fpga_config/bin/fpga_config.elf \ --log-to-stderr
You can redirect host and device logs to separate files with:
python ./tools/gonk_tools/write_fpga.py \ --bitstream-file ./out/gn/obj/fpga/toplevel/toplevel.bin --database ./out/gn/arduino_size_optimized/obj/applications/fpga_config/bin/fpga_config.elf \ --host-logfile gonk-host-logs.txt \ --device-logfile gonk-device-logs.txt
./scripts/flash-with-blackmagic-probe.sh ./out/gn/arduino_size_optimized/obj/applications/spi_flash_test/bin/spi_flash_test.elf
On Linux with the FPGA toolchain available run:
pw build
The zip file containing all the dependencies for the gonk python tooling is located in:
out/gn/obj/gonk_bundle.zip
Inside are the Python wheels for gonk_dist
, gonk_firmware
, and all third_party dependencies.
gonk_bundle ├── python_wheels │ ├── appdirs-1.4.4-py2.py3-none-any.whl │ ├── astroid-3.0.1-py3-none-any.whl │ ├── ... │ ├── gonk_dist-0.0.1+20240305140627-py3-none-any.whl │ ├── gonk_firmware-0.0.1+20240305140542-py3-none-any.whl │ ├── ... │ └── wheel-0.40.0-py3-none-any.whl ├── requirements.txt ├── setup.bat └── setup.sh
Run the host app and connect to it via pw-system-console
:
./out/gn/host_device_simulator.speed_optimized/obj/applications/system_example/bin/system_example & \ pw-system-console --socket-addr default \ --proto-globs third_party/pigweed/pw_rpc/echo.proto ; \ killall system_example
Flashing
openocd -s $PW_PIGWEED_CIPD_INSTALL_DIR/share/openocd/scripts \ -f $GONK_ROOT/targets/stm32f769i_disc0_stm32cube/openocd_stm32f7xx.cfg \ -c "program out/gn/stm32f769i_disc0_stm32cube.size_optimized/obj/applications/system_example/bin/system_example.elf reset exit"
Checkout the desired commits in each of these submodules:
third_party/stm32cube_f7/cmsis_core third_party/stm32cube_f7/cmsis_device third_party/stm32cube_f7/hal_driver
Then run from Gonk root:
python -m pw_stm32cube_build gen_file_list third_party/stm32cube_f7
Net | STM32 Pin | STM32 Function | Function |
---|---|---|---|
STATUS | PB13 | GPIO_Output | STAT LED |
Net | FPGA IO# | STM32 Pin | STM32 Function | Flash Pin |
---|---|---|---|---|
ICE_SPI_SS | 71 | PD2 | GPIO_Output | S# |
ICE_SPI_MISO | 68 | PB4 | SPI1_MISO | DQ1 |
ICE_SPI_MOSI | 67 | PB5 | SPI1_MOSI | DQ0 |
ICE_SPI_SCK | 70 | PB3 | SPI1_SCK | C |
FLASH_HOLD | 63 | PC11 | GPIO_Output | HOLD#/DQ3 |
FLASH_WP | 64 | PC12 | GPIO_Output | W#/VPP/DQ2 |
Net | Function | FPGA IO# | STM32 Pin | STM32 Function | Notes |
---|---|---|---|---|---|
FPGA_IO_SPARE_0_2 | rst_i | 135 | PA0 | GPIO_Output | Active high |
FPGA_IO_SPARE_0_0 | mode_i | 137 | PB11 | GPIO_Output | FPGA operation mode |
DSPI_CS | valid_o | 75 | PB6 | GPIO_Output | Data/Transfer Valid |
FPGA_IO_SPARE_1_1 | miso_i | 101 | PC2 | SPI1_MISO | |
FPGA_IO_SPARE_1_0 | mosi_i | 99 | PC3 | SPI1_MOSI | |
I2C_O_SDA | cs_n | 79 | PB9 | SPI1_NSS | |
FPGA_IO_SPARE_0_1 | sclk_i | 136 | PB10 | SPI1_SCK | |
FPGA_IO_SPARE_2_0 | 49 | PA7 | |||
FPGA_IO_SPARE_2_1 | 48 | PA6 | |||
FPGA_IO_SPARE_2_2 | 47 | PA5 | |||
FPGA_IO_SPARE_2_3 | 45 | PA4 |