[third_party/pigweed] Roll 21 commits

9640cdef100f87d roll: gn
cace272e9216279 roll: qemu
41b455bcbc7d49c pw_env_setup: Retrieve qemu on ARM Macs
a587c5eebced9d3 pw_presubmit: Exclude docs on Mac ARM hosts
4c95093e6f39f4a pw_build: Add pw_cc_binary variant to generate .ma
d06ec146fbe683d targets/host_device_simulator: Update docs
ed3b51b88ff6246 pw_digital_io: Remove conditional interrupt disabl
aadaf20b356323a docs: Update changelog
13739dabe1a3881 pw_build: Introduce default_link_extra_lib
68af5d8f586dbaf docs: Merge first-time setup guides into one page
420672d94c74c53 pw_tokenizer: Remove <assert.h> include for static
a29bf57c735c7c7 pw_span: Follow new module docs guidelines
856491408766e7d pw_ide: Fix VSC extension build command
749043357bc3303 pw_ide: Improve Python `--install-editable`
06aca398f331735 pw_toolchain: Enable thread safety warnings for ba
f6cc07b4dd431e2 SEED-0122: Update status, facilitator
cba4fdeaa2e16f9 pw_presubmit: Remove transitional coverage upload
7235731565cecea build: Add --verbose_failures to .bazelrc
12690fbff8b1271 pw_tokenizer: Directory database docs fixes
12298dc69496227 pw_presubmit: Fix codesearch coverage type
2bc58521173f81e pw_presubmit: Allow multiple uploading of coverage

https://pigweed.googlesource.com/pigweed/pigweed
third_party/pigweed Rolled-Commits: 6d2b92a0ec93430..9640cdef100f87d
Roller-URL: https://ci.chromium.org/b/8758845583473335761
GitWatcher: ignore
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: Iaad0b51b1debf6bef26ee82c07778406da403bdb
Reviewed-on: https://pigweed-review.googlesource.com/c/gonk/+/187971
Bot-Commit: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
1 file changed
tree: 5b97b8260f97fa0c4e14827c7a33e9ff7a7d24eb
  1. applications/
  2. build_overrides/
  3. fpga/
  4. lib/
  5. scripts/
  6. targets/
  7. third_party/
  8. tools/
  9. .gitignore
  10. .gitmodules
  11. .gn
  12. banner.txt
  13. bootstrap.sh
  14. BUILD.gn
  15. BUILDCONFIG.gn
  16. OWNERS
  17. pigweed.json
  18. README.md
README.md

Gonk

Getting Started

  1. Clone the repo

    git clone https://pigweed.googlesource.com/pigweed/gonk
    
  2. Source bootstrap.sh to download all compilers and tooling into the environment directory:

    . ./bootstrap.sh
    

    This should init all git submodules for you.

  3. 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
    

Compile:

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.

Gonk Verilog:

The Verilog build requires the following to be installed on Linux:

sudo apt install fpga-icestorm nextpnr-ice40 yosys

Run this to compile the Gonk Verilog:

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

Gonk fpga_config Example

Flash the stm32f7 and launch the write_fpga.py script on a bitstream file.

Flash with dfu-util

  1. Unplug gonk from USB and replug with MODE button held down.

  2. Run pw flash on the MCU binary.

    pw flash ./out/gn/arduino_size_optimized/obj/applications/fpga_config/fpga_config.bin
    

Write the FPGA bitstream

  1. Write an FPGA bitstream with the write_fpga.py script:

    python ./tools/gonk_tools/write_fpga.py ./applications/fpga_config/fpga_blinky.bin
    

Gonk spi_flash_test Example

Flash with dfu-util

  1. Unplug gonk from USB and replug with MODE button held down.

  2. Run pw flash on the MCU binary.

    pw flash ./out/gn/arduino_size_optimized/obj/applications/spi_flash_test/spi_flash_test.bin
    
  3. Unplug Gonk from USB and replug to reset the hardware. SPI bus issues have been observed without this step.

  4. Connect over serial.

    python -m serial.tools.miniterm --raw /dev/ttyGonk 1000000
    

    You should see output matching:

    --- Miniterm on /dev/ttyGonk  1000000,8,N,1 ---
    --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
    INF  Device id: 1f 84 1
    INF  Device id: 1f 84 1
    INF  Device id: 1f 84 1
    INF  Device id: 1f 84 1
    

Flash with BlackMagic Probe:

./scripts/flash-with-blackmagic-probe.sh ./out/gn/arduino_size_optimized/obj/applications/spi_flash_test/bin/spi_flash_test.elf

pw_system Example

Run on Host

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

Run on Device

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"

Updating STM32Cube

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

Pin Map

Misc

NetSTM32 PinSTM32 FunctionFunction
STATUSPB13GPIO_OutputSTAT LED

SPI Flash Connection

NetFPGA IO#STM32 PinSTM32 FunctionFlash Pin
ICE_SPI_SS71PD2GPIO_OutputS#
ICE_SPI_MISO68PB4SPI1_MISODQ1
ICE_SPI_MOSI67PB5SPI1_MOSIDQ0
ICE_SPI_SCK70PB3SPI1_SCKC
FLASH_HOLD63PC11GPIO_OutputHOLD#/DQ3
FLASH_WP64PC12GPIO_OutputW#/VPP/DQ2

FPGA Connection

NetFunctionFPGA IO#STM32 PinSTM32 FunctionNotes
FPGA_IO_SPARE_0_2rst_i135PA0GPIO_OutputActive high
FPGA_IO_SPARE_0_0mode_i137PB11GPIO_OutputFPGA operation mode
FPGA_IO_SPARE_0_1valid_o136PB10GPIO_OutputData/Transfer Valid
DSPI_IO0miso_i73PC9QUADSPI_BK1_IO0
DSPI_IO1mosi_i74PC10QUADSPI_BK1_IO1
DSPI_CScs_n75PB6QUADSPI_BK1_NCS
DSPI_SCKsclk_i76PB2QUADSPI_CLK
FPGA_IO_SPARE_2_049PA7SPI1_MOSI
FPGA_IO_SPARE_2_148PA6SPI1_MISO
FPGA_IO_SPARE_2_247PA5SPI1_SCK
FPGA_IO_SPARE_2_345PA4SPI1_NSS