Skip to content

compile success, but flash fails #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chtfrank opened this issue Apr 1, 2023 · 1 comment
Open

compile success, but flash fails #63

chtfrank opened this issue Apr 1, 2023 · 1 comment

Comments

@chtfrank
Copy link

chtfrank commented Apr 1, 2023

Hi all,
I tried to fix this problem several days, but I still cannot find the solution. Could someone help me? Thx in advance.
I use the Apple Os, and have installed all the tools required, such as python, make, git and so on. Here are my steps:

  1. clone this repo: git clone https://github.com/advaitjain/tflite-micro-sparkfun-edge-examples.git
  2. cd into the directory, and type: make TARGET=sparkfun_edge micro_speech
  3. during the make process, the arm compiler was downloaded success into the downloads directory.
  4. the process finished without any error and the result file was saved at gen/bin/micro_speech, also the libtflm.a.
  5. I prepared the OTA bin and Wired bin files according to the steps of the tutorial: https://codelabs.developers.google.com/codelabs/sparkfun-tensorflow#3, but with the offical AmbiqSuite SDK: https://github.com/sparkfun/AmbiqSuiteSDK. Because I found we dont have some tools, such as AmbiqSuite-Rel2.2.0/tools/*. Then I got some size warnings like:
    python tools/apollo3_scripts/create_cust_wireupdate_blob.py --load-address 0x20000 --bin micro_speech_ota.bin -i 6 -o micro_speech_wire --options 0x1
    Header Size = 0x60
    app_size 0x4f69a4 ( 5204388 )
    Image size bigger than max - Creating Split image
    Writing to file micro_speech_wire.bin
    Image from 0x0 to 0x48000 will be loaded at 0x20000
    Writing to file micro_speech_wire.bin
    Image from 0x48000 to 0x90000 will be loaded at 0x68000
    Writing to file micro_speech_wire.bin
    Image from 0x90000 to 0xd8000 will be loaded at 0xb0000
    Writing to file micro_speech_wire.bin
    Image from 0xd8000 to 0x120000 will be loaded at 0xf8000
    Writing to file micro_speech_wire.bin
    Image from 0x120000 to 0x168000 will be loaded at 0x140000
    Writing to file micro_speech_wire.bin
    Image from 0x168000 to 0x1b0000 will be loaded at 0x188000
    Writing to file micro_speech_wire.bin
    Image from 0x1b0000 to 0x1f8000 will be loaded at 0x1d0000
    Writing to file micro_speech_wire.bin
    Image from 0x1f8000 to 0x240000 will be loaded at 0x218000
    Writing to file micro_speech_wire.bin
    Image from 0x240000 to 0x288000 will be loaded at 0x260000
    Writing to file micro_speech_wire.bin
    Image from 0x288000 to 0x2d0000 will be loaded at 0x2a8000
    Writing to file micro_speech_wire.bin
    Image from 0x2d0000 to 0x318000 will be loaded at 0x2f0000
    Writing to file micro_speech_wire.bin
    Image from 0x318000 to 0x360000 will be loaded at 0x338000
    Writing to file micro_speech_wire.bin
    Image from 0x360000 to 0x3a8000 will be loaded at 0x380000
    Writing to file micro_speech_wire.bin
    Image from 0x3a8000 to 0x3f0000 will be loaded at 0x3c8000
    Writing to file micro_speech_wire.bin
    Image from 0x3f0000 to 0x438000 will be loaded at 0x410000
    Writing to file micro_speech_wire.bin
    Image from 0x438000 to 0x480000 will be loaded at 0x458000
    Writing to file micro_speech_wire.bin
    Image from 0x480000 to 0x4c8000 will be loaded at 0x4a0000
    Writing to file micro_speech_wire.bin
    Image from 0x4c8000 to 0x4f69a4 will be loaded at 0x4e8000
  6. Anyway, the wired bin is generated successfully, then I used the python script to flash the Wired bin file to my SparkFun Edge Board, according to the tutorial: https://codelabs.developers.google.com/codelabs/sparkfun-tensorflow#5, but I was failed with no Response error.
  7. I think I operated correctly when pressing and releasing the buttons, since I successfully flash the example bin file from the offical AmbiqSuite SDK BSP repo: https://github.com/sparkfun/SparkFun_Apollo3_AmbiqSuite_BSPs/tree/6398086a1a87ddea78274521683ba3ad817bee82/edge/examples/tensorflow_micro_speech , accordind to the SparkFun tutorial: https://learn.sparkfun.com/tutorials/using-sparkfun-edge-board-with-ambiq-apollo3-sdk/example-applications
  8. I was surprised to find that the size of the generated bin file gen/bin/micro_speech here (~5.2Mb) is larger than the pre-compiled one in SparkFun_Apollo3_AmbiqSuite_BSPs repo (98Kb), which may result in the warning in step 6 and finally lead to the failure of flashing.
  9. I changed to the Ubuntu and Windows, but still cannot flash successfully.

图片

I donnt know how to search the solution, it has taken many days for me to find the answer.
Thx everyone.

@KunYi
Copy link

KunYi commented Oct 19, 2024

build & flash, just run the below

# build & generation binarys
$ git clone https://github.com/advaitjain/tflite-micro-sparkfun-edge-examples.git edge
$ cd edge
$ make examples # build all examples
$ cd gen/bin 
$ arm-none-eabi-objcopy -O binary micro_speech micro_speech.bin
$ git clone https://github.com/sparkfun/Apollo3_Uploader_ASB  ASB
$ cp micro_speech.bin ASB
$ python3 asb.py --bin ./micro_speech.bin --load-address-blob 0x20000 --magic-num 0xCB -o ./tmp_micro_speech.bin --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 921600 -port /dev/ttyUSB0 -r 2 -v   # Serial port /dev/ttyUSB0
 
 ----
 Header Size =  0x80
original app_size  0x1bbb0 ( 113584 )
load_address  0xc000 ( 49152 )
app_size  0x1bbb0 ( 113584 )
w0 = 0xcb01bc30
Security Value  0x10
w2 =  0x10008080
addrWord =  0xc000
versionKeyWord =  0x0
child0/feature =  0xffffffff
child1 =  0xffffffff
crc =   0x9c6a21c0
Writing to file  ./tmp_micro_speech.bin_OTA_blob.bin
testing: ./tmp_micro_speech.bin_OTA_blob.bin
Header Size =  0x60
app_size  0x1bc30 ( 113712 )
Writing to file  ./tmp_micro_speech.bin_Wired_OTA_blob.bin
Image from  0x0  to  0x1bc30  will be loaded at 0x20000
Connecting over serial port /dev/ttyUSB0...
Sending Hello.
Received response for Hello
Bootloader connected
Received Status
length = 0x58
version = 0x5
Max Storage = 0x4ffa0
Status = 0x2
State = 0x7
AMInfo = 
0x1
0xff2da3ff
0x55fff
0x1
0x4cd00005
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
Sending OTA Descriptor = 0xfe000
Sending Update Command.
number of updates needed = 1
Sending block of size 0x1bc90 from 0x0 to 0x1bc90
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 7468
Sending Reset Command.
Tries = 0
Upload complete!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants