Setup
Intro + setup.
Getting to blinky.
Writing tests.
Calling RPCs.
Key Value Store.
Testing in the factory.
Blinky introduces the basics of building, flashing and checking log output. The instructions here will be the same for each exercise and binary to be flashed.
Instructions for building with a teensy40
board.
Create the out
build directory if needed.
gn gen out --export-compile-commands --args=' pw_arduino_build_CORE_PATH="//third_party/pigweed/third_party/arduino/cores" pw_arduino_build_CORE_NAME="teensy" pw_arduino_build_PACKAGE_NAME = "teensy/avr" pw_arduino_build_BOARD="teensy40" pw_arduino_use_test_server=false '
Run the compile with pw watch
or ninja -C out
.
Flash blinky.elf
.
Teensy
arduino_unit_test_runner --verbose --config out/arduino_debug/gen/arduino_builder_config.json --upload-tool teensyloader --flash-only out/arduino_debug/obj/workshop/01-blinky/bin/blinky.elf
stm32f429i_disc1
openocd -s ${PW_PIGWEED_CIPD_INSTALL_DIR}/share/openocd/scripts -f ${PW_ROOT}/targets/stm32f429i_disc1/py/stm32f429i_disc1_utils/openocd_stm32f4xx.cfg -c "program out/stm32f429i_disc1_debug/obj/workshop/01-blinky/bin/blinky.elf reset exit"
pw_log_BACKEND = "$dir_pw_log_basic"
is set in //targets/common_backends.gni
. The default is set to use tokenized logging over HDLC as shown below.Tail the output with miniterm
, (use Ctrl-]
to quit).
python -m serial.tools.miniterm --raw - 115200
Optional: Create / update the log token database. This will be automatically updated when compiling.
python -m pw_tokenizer.database create --force --database workshop/01-blinky/tokenizer_database.csv out/arduino_debug/obj/workshop/01-blinky/bin/blinky.elf
Start the rpc_console that saves log output to a file.
python -m pw_hdlc.rpc_console -o logfile.txt -d /dev/ttyACM0 ./third_party/pigweed/pw_rpc/echo.proto
Tail the log output.
python -m pw_tokenizer.detokenize base64 workshop/01-blinky/tokenizer_database.csv -i logfile.txt --follow