sipeed / TangNano-9K-example

TangNano-9K-example project
211 stars 66 forks source link

Can't flash firmware #1

Open splinedrive opened 2 years ago

splinedrive commented 2 years ago

Hi,

I can only flash the example-fw-flash.v! When I build a firmware with make flash I can't flash it! Do you know why? Also make brom will not fit: /opt/riscv32i/lib/gcc/riscv32-unknown-elf/11.1.0/../../../../riscv32-unknown-elf/bin/ld: region `BROM' overflowed by 1296 bytes

make -C fw/fw-flash make[1]: Entering directory '/home/hd/tmp/TangNano-9K-example/picotiny/fw/fw-flash' make[1]: Nothing to be done for 'all'. make[1]: Leaving directory '/home/hd/tmp/TangNano-9K-example/picotiny/fw/fw-flash' python sw/pico-programmer.py fw/fw-flash/build/fw-flash.v /dev/ttyUSB4 Read program with 8912 bytes

jmthompson commented 2 years ago

Looks like the issue is with the way the loop is written in the isp_exec_wbuf method. If the checksum is legitimately 0x00 the second while loop will terminate immediately without waiting for write confirmation, falling through to the end of the function and returning False.

nekomona commented 2 years ago

BROM overflow is due to a compiler flag problem where my old gcc produce reasonably small code with -O3 while later gcc produce large code with -O3 and small code with -O2. Using -O2 in current gcc generate ispflasher firmware for about 1.4KB code which could fit in the BROM.

Flash failing is, as said, due to an ancient, ancient, buggy python code 😿

Both issue should have been solved in #5