rhulme / pico-flashloader Goto Github PK
View Code? Open in Web Editor NEWSmall (<4k) flashloader for the RP2040 to allow a power-fail safe update in situations where the built-in bootloader is not suitable.
Small (<4k) flashloader for the RP2040 to allow a power-fail safe update in situations where the built-in bootloader is not suitable.
Hello! Wonderful code you have, thank you for sharing. It looks like I will be able to use this to update code over CAN bus on my robot.
My project currently builds with platformio. A lot of the stuff that this library does is beyond my skill set.
I am going to try to convert my project to cmake so that I can use this, but I am not presently sure if that will create other problems for me.
I am curious, do you have any experience with platformio, and do you happen to have any idea how this library could be implemented with that build system?
Thanks!
Originally posted by erikjonkers January 31, 2022
Hi,
To be able to load the combined application through the SWD interface instead of the usb mount, I used the following command to get a combined HEX file:
srec_cat pico-flashloader.hex app250.hex -o combi.hex
Doing so I noticed that the reset through the SWD interface didn't work but a power reset did and the application was working as expected. I then started the debugger again and issued a reset command. The same problem appeared, it keeps resetting with the following info;
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
..<snip>..
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Read incorrect DLIPDR f0000001 (possibly CTRL/STAT value) when selecting coreid 0
Could not find MEM-AP to control the core
Examination failed, GDB will be halted. Polling again in 6300ms
Polling target rp2040.core1 failed, trying to reexamine
Could not find MEM-AP to control the core
Examination failed, GDB will be halted. Polling again in 6300ms
During these reboots, the debugger isn't able to connect.
I also flashed the pico with the original FLASH_ME.uf2 file but if I reset through the debugger same problem exists.
What can I do to debug this?
-Erik.
Awesome project! I'd love to use this flashloader in my project, but while it works on the Pico it fails to boot the application on a board that is implemented according to the minimal design presented in https://datasheets.raspberrypi.com/rp2040/hardware-design-with-rp2040.pdf , that design uses a W25Q128JVS flash chip.
Thanks for sharing your pico flashloader project. I'm attempting to use it, but get this message about undefined references.
[build] [31/32 93% :: 1.404] Building CXX object CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp.obj [build] [31/32 96% :: 1.503] Building C object CMakeFiles/pico-flashloader.dir/flashloader.c.obj [build] [32/32 100% :: 1.822] Linking CXX executable pico-flashloader.elf **[build] FAILED: pico-flashloader.elf** [build] cmd.exe /C "cd . && C:\PROGRA~2\GNUARM~1\102021~1.10\bin\AR10B2~1.EXE -mcpu=cortex-m0plus -mthumb -Og -g -Wl,--build-id=none -Wl,-Map=pico-flashloader.elf.map -Wl,--script=C:/VSARM/Pico/pico-sdk/src/rp2_common/pico_standard_link/memmap_default.ld -Wl,-z,max-page-size=4096 -Wl,--gc-sections CMakeFiles/pico-flashloader.dir/flashloader.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_sync/sync.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_claim/claim.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/pico_platform/platform.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_flash/flash.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/pico_bootrom/bootrom.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_watchdog/watchdog.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_xosc/xosc.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_clocks/clocks.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_gpio/gpio.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_irq/irq.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_sync/sem.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_sync/lock_core.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_time/time.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_time/timeout_helper.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_timer/timer.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_util/datetime.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_util/pheap.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_util/queue.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_sync/mutex.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/common/pico_sync/critical_section.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_pll/pll.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_vreg/vreg.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/hardware_dma/dma.c.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/pico_standard_link/crt0.S.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp.obj CMakeFiles/pico-flashloader.dir/C_/VSARM/Pico/pico-sdk/src/rp2_common/pico_standard_link/binary_info.c.obj -o pico-flashloader.elf pico-sdk/src/rp2_common/boot_stage2/bs2_default_padded_checksummed.S && cmd.exe /C "cd /D C:\VSARM\Pico\projects\Bootloader\build && C:\VSARM\Pico\projects\Bootloader\build\elf2uf2\elf2uf2 C:/VSARM/Pico/projects/Bootloader/build/pico-flashloader.elf pico-flashloader.uf2"" [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-sbrkr.o): in function
_sbrk_r':
[build] sbrkr.c:(.text._sbrk_r+0xc): undefined reference to _sbrk' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-signalr.o): in function
_kill_r':
[build] signalr.c:(.text._kill_r+0xe): undefined reference to _kill' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-signalr.o): in function
_getpid_r':
[build] signalr.c:(.text._getpid_r+0x2): undefined reference to _getpid' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-writer.o): in function
_write_r':
[build] writer.c:(.text._write_r+0x10): undefined reference to _write' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-closer.o): in function
_close_r':
[build] closer.c:(.text._close_r+0xc): undefined reference to _close' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-fstatr.o): in function
_fstat_r':
[build] fstatr.c:(.text._fstat_r+0xe): undefined reference to _fstat' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-isattyr.o): in function
_isatty_r':
[build] isattyr.c:(.text._isatty_r+0xc): undefined reference to _isatty' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-lseekr.o): in function
_lseek_r':
[build] lseekr.c:(.text._lseek_r+0x10): undefined reference to _lseek' [build] c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/gnuarm~1/102021~1.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp\libg.a(lib_a-readr.o): in function
_read_r':
[build] readr.c:(.text._read_r+0x10): undefined reference to _read' [build] collect2.exe: error: ld returned 1 exit status [build] ninja: build stopped: subcommand failed. [build] Build finished with exit code 1
Any suggestions for troubleshooting would be appreciated.
Hi,
I was wondering if you planned to license this project under an open-source license? Perhaps something like MIT
.
This would make it clearer about what circumstances code from this project could be used in.
Thanks,
James
Originally posted by websterelec September 1, 2022
I found that with larger programs, the delay in watchdog_reboot (500ms) isn't long enough for the initial flash_range_erase call that erases the target memory area to complete. I measured 730ms for a size of 0x35000. I increased the delay to 2 seconds for my application.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.