RAK4631 customized arduino bootloader hangs

I’m trying to customize the bootloader for the RAK4631 using the arduino BSP. I’m using a Linux workstation with a DAPLink device and pyocd software. I have successfully compiled and built the bootloader that is at WisBlock/bootloader/RAK4630/Latest/WisCore_RAK4631_Bootloader at master · RAKWireless/WisBlock · GitHub. I made no changes to the source code yet. I have compiled it with arm gcc 9.2.1 and I also tried with arm gcc 14.2.1.

I can erase the chip and program the hex file. But it doesn’t work. The board acts like it is bricked or in a reboot loop maybe. I am able to get the board working again by erasing the chip, programming the softdevice s140 hex, and then programming the prebuilt bootloader hex that is included with the repo.

Any idea why my locally built hex file wont work? In what order should I be programming the different pieces? sd, mbr, bootloader

thanks!

The nRF52840 requires both the bootloader and the softdevice to start up correct.
Did you merge the softdevice into your custom bootloader before flashing it?
If not, you have to flash the bootloader and the softdevice separate to the device to get it to start up.

Yes I use the make all command to generate all the files including the merged hex. Then I erase the chip, and then flash
_build/build-wiscore_rak4631_board/wiscore_rak4631_board_bootloader-0.4.3_s140_6.1.1.hex
Then the board hangs/is bricked.

To get it back to normal I erase the chip, and flash the softdevice using
make BOARD=wiscore_rak4631_board sd.
And then flash the pre-built bootloader hex using
pyocd flash -t nrf52840 wiscore_rak4631_board_bootloader-0.4.3.hex

Now If I flash my bootloader hex using
pyocd flash -t nrf52840 _build/build-wiscore_rak4631_board/wiscore_rak4631_board_bootloader-0.4.3.hex
then the board hangs again. Putting your pre-built bootloader hex back
pyocd flash -t nrf52840 wiscore_rak4631_board_bootloader-0.4.3.hex
and it is working again.

Then I guess you messed up something with your changed bootloader.

:unamused: I suppressed a gcc warning that is new to v14. Beyond that I havent changed anything in the source code yet. It is direct from the git repo. Maybe I need to try an old arm-gcc. Can I ask what compiler you (RAKWireless) used to build that?

gcc-arm-none-eabi-9-2019-q4-major

as far as I know.

It works now. I switched to using the gcc-arm-none-eabi-9-2019-q4-major compiler - plus I did a big system update on my SUSE computer that installed a bunch of new packages including a new version of python3. Maybe that had a positive effect as well. :man_shrugging:

I flash it like this and it works:
pyocd flash -t nrf52840 _build/build-wiscore_rak4631_board/wiscore_rak4631_board_bootloader-0.4.3_nosd.hex

Thanks for the help

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.