tree: 15adf4f23d5cad89fac37fa7c5934c4ce098a85a [path history] [tgz]
  1. BUILD.gn
  2. README.md
  3. public/
  4. teensy_flash.cc
  5. teensy_flash_test_key_value_store.cc
  6. teensy_flash_test_partition.cc
source/teensy_flash/README.md

Teensy Flash Example

Instructions for building with a teensy40 board.

Build/Flash/Run

  1. Create the out build directory.

    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'
    
  2. Patch arduino core.

    Running the following command after installing the arduino core:

    sed -i -e 's/^static void flash_/void flash_/' third_party/pigweed/third_party/arduino/cores/teensy/hardware/teensy/avr/cores/teensy4/eeprom.c
    
  3. Run the compile.

    ninja -C out
    
  4. Flash and run test.

    arduino_unit_test_runner --config out/arduino_debug/gen/arduino_builder_config.json --upload-tool teensyloader --verbose out/arduino_debug_tests/obj/source/teensy_flash/test/teensy_flash_test.elf
    

    You should see something somewhat similar to:

    DBG Successfully flashed firmware to device
    INF [==========] Running all tests.
    INF [ RUN      ] FlashPartitionTest.FillTest
    INF DBG  FillTest iteration 0, write '0'
    INF DBG  FillTest iteration 0, write '0xff'
    INF DBG  FillTest iteration 0, write '0x55'
    INF DBG  FillTest iteration 0, write '0xa3'
    INF DBG  Completed iterations 0, Total errors 0
    INF DBG  FillTest iteration 1, write '0'
    INF DBG  FillTest iteration 1, write '0xff'
    INF DBG  FillTest iteration 1, write '0x55'
    INF DBG  FillTest iteration 1, write '0xa3'
    INF DBG  Completed iterations 1, Total errors 0
    INF [       OK ] FlashPartitionTest.FillTest
    INF [ RUN      ] FlashPartitionTest.EraseTest
    INF [       OK ] FlashPartitionTest.EraseTest
    INF [ RUN      ] FlashPartitionTest.AlignmentCheck
    INF [       OK ] FlashPartitionTest.AlignmentCheck
    INF [ RUN      ] FlashPartitionTest.IsErased
    DBG [       OK ] EmptyInitializedKvs.Basic
    DBG [==========] Done running all tests.
    DBG [  PASSED  ] 4 test(s).
    INF Test passed!