Sunday, January 16, 2022

Compiling and deploying TinyML examples to SparkFun Edge

Trying out the SparkFun Edge board. Seems there are changes to the source repositories and many online instructions are outdated.


For example, to build and deploy the micro_speech example:


#set env
export BAUD_RATE=921600
export DEVICENAME=/dev/ttyUSB0

# compile the code
make micro_speech

# convert the binary. "~work/apollo3/downloads/AmbiqSuiteSDK-master" is where I have the SDK installed
arm-none-eabi-objcopy gen/bin/micro_speech gen/bin/micro_speech.bin -O binary

python ~/work/apollo3/downloads/AmbiqSuiteSDK-master/tools/apollo3_scripts/create_cust_image_blob.py --bin gen/bin/micro_speech.bin --load-address 0xC000 --magic-num 0xCB -o gen/bin/micro_speech_nonsecure_ota --version 0x0

python ~/work/apollo3/downloads/AmbiqSuiteSDK-master/tools/apollo3_scripts/create_cust_wireupdate_blob.py --load-address 0x20000 --bin gen/bin/micro_speech_nonsecure_ota.bin -i 6 -o gen/bin/micro_speech_nonsecure_wire --options 0x1

# deploy
python ~/work/apollo3/downloads/AmbiqSuiteSDK-master/tools/apollo3_scripts/uart_wired_update.py -b ${BAUD_RATE} ${DEVICENAME} -r 1 -f gen/bin/micro_speech_nonsecure_wire.bin -i 6