nRF52 Fix softdevice.hex flashing issue#5893
Conversation
| # special options when using SoftDevice | ||
| ifneq (,$(filter nordic_softdevice_ble,$(USEPKG))) | ||
| export JLINK_PRE_FLASH := loadfile $(BINDIR)/softdevice.hex | ||
| export JLINK_PRE_FLASH := erase\nloadfile $(BINDIR)/softdevice.hex |
There was a problem hiding this comment.
Like this, on my system, it leads to
erase\nloadfile <path>/softdevice.hex
being the first line of burn.seg, which results in an error message.
There was a problem hiding this comment.
Humm .. what is your system ?
I have tried this on my Ubuntu 14.04.
This may be a side effect of the shell as the JLink.sh is executed by a sh -c.
My system has /bin/sh pointing to dash.
Can you check on your system ? ls -l which sh ?
There was a problem hiding this comment.
I confirmed with a quick test that this is related to bash versus dash.
in bash, echo "erase\nloadfile" will output erase\nloadfile. You will need to add -e to have the \n handled: echo -e "erase\nloadfile" will output:
erase
loadfile
Using dash, echo -e is not supported and the escape characters are handled.
echo "erase\nloadfile" will output:
erase
loadfile
While echo -e "erase\nloadfile" will output:
-e erase
loadfile
It is recommended to use printf for portability as per : https://wiki.ubuntu.com/DashAsBinSh#echo
This will mean: replace echo "${JLINK_PRE_FLASH}" >> pathtobin/burn.seg
by
printf "${JLINK_PRE_FLASH}\n" >> pathtobin/burn.seg
Let me know what you think
There was a problem hiding this comment.
another solution is to use /bin/echo instead of echo like it is done some lines above in dist/tools/jlink/jlink.sh.
/bin/echo behaves as the bash version, so we will need to call it with -e .
Let me if you have a preference.
For portability I would better move to printf but for linux based system /bin/echo should work.
There was a problem hiding this comment.
Then printf is the way to go.
There was a problem hiding this comment.
ok, I'll update the patch and push it.
Jeff.
Would you mind creating another PR for the jlink.sh change? |
|
I updated the PR with a new commit for the printf in jlink.sh. |
Sorry, I was too slow. Please rename the jlink.sh change commit so it says sth like "dist: tools: jlink.sh: use printf for JLINK_*_FLASH to allow use of backslash escapes", and make it also fix JLINK_POST_FLASH to use printf. |
cc3f169 to
fd87e3d
Compare
|
So, I updated this branch to only have the addition of the "Erase" in the boards/nrf52/Makefile.include and I created another PR for just the printf for JLINK_*_FLASH variables: #5900 |
Thanks a lot for finding this and also thank you for taking the time to polish the PRs! |
|
I checked the CI errors: |
|
ACK&go! |
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with that memory set to 0xff as it is the rom reset value. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff according to RIOT-OS#5893 and testing. However, the addresses [0x8bc, 0x3000[ are not set in softdevice.hex. So use a modified hex file with all the memory set to 0xff as it is the rom reset value anyway. This change updates the `.hex` file instead on relying on erasing the memory.
I found the following issue with nRF52DK board:
When flashing the microcoap_server example after the hello_world example, the microcoap_server application will not work (nothing on the serial interface).
This is due to the fact that the microcoap_server uses the softdevice.hex stack and this stack is checking that value at 0x2000 is 0xFFFFFFFF. This address is not present in the softdevice.hex.
The work around found on the forums is to do an "nrfjprog --family NRF52 --recover" before flashing the microcoap_server application(and the softdevice).
This patch avoid to do a manual "nrfjprog --family NRF52 --recover" by including an erase command to the JLink pre flash command before flashing the softdevice.hex.