This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't run secure bootloader example on nRF51822

I have nRF51822 AA with SDK 12.3.0 and SEGGER SES 3.10f.

I was able to run and experiment with ble_app_beacon example, fixing known SES troubles, mainly with memory sections in flash_placement.xml (those are described in devzone).

But I was unable to run dfu/bootloader_secure example.

First there was build problems, and I managed to fix them in flash_placement.xml, but I'm not sure if it was a right thing. There were:

  • `UNPLACED_SECTIONS' error for .bootloaderSettings
  • undefined reference to `__stop_dfu_trans' (as well as start)
  • undefined reference to `__isr_vector'

The first to were more or less referenced on forums here. So I did:
<ProgramSection alignment="4" load="Yes" name=".bootloaderSettings" start="$(BOOTLOADER_SETTINGS_START:0x0003FC00)" size="$(BOOTLOADER_SETTINGS_SIZE:0x400)" />
and
<ProgramSection alignment="4" load="No" keep="Yes" name=".dfu_trans_run" address_symbol="__start_dfu_trans" end_symbol="__stop_dfu_trans" />

But __isr_vector produced not so much results, and I ended with 
<ProgramSection alignment="0x100" load="No" name=".vectors_ram" address_symbol="__isr_vector" start="$(RAM_START:$(SRAM_START:))" />
of wich I'm most doubtful.

Now it builds, but it does not work. Debug shows one jump at 0x6B0 location and then all goes to unmapped memory. I could say that then I was not sure where to place bootloader and softdevice in memory, there were Debug runs that led to main{} and Hardfaulted after some initialization. But I'm unable to reproduce it.

Here is the project itself, which I just copied from example and placed alongside with it: yadi.sk/.../45x4TLDw6Wxk_g
I use pca10028\arm5_no_packs as the basis.

  • Hi,

    I ran into some linker issues while trying to import the project (SES seem to ignore memory segments that I declare in the xml). The bootloader is a bit more complicated to get working because of the additional linker sections, but I will see if I can make a working project for you.   

  • Thank you for your help.

    I need to say that there is something more to this case.
    I tried to restore the app itself on this board, since no luck with bootloader. At first it had firmware verification failure at address 0x10001000. Then after several erases it flashed OK, but ceased to run with absolutely same symptoms as the bootloader: first stop at 0x6B0 and then jump to nowhere. I think we can conclude that there is something wrong with the board itself, on the first place, since before that a dozen of same boards were flashed with app and worked OK.

    And then I tried to --recover it with nrfjprog, but recovery just failed. Then I tried to flash it several more times and it jumped to main! Application works now on that one. It will be unavailable to me for a week, so I'll definitely try bootloader on an another module that I know works for sure. As it turns up the bootloader may just be working.

    What could be the reason of such a behavior?  

  • Interestingly, I flashed many times proven module with bootloader and got all the same - Verification failed @ address 0x10001000 and 0x6B0.

  • So, does someone have an idea what to check here? Or maybe what settings should be for __isr_vector?
    Or maybe correct SEGGER project file?

  • Hi,

    I have ported the bootloader example (pca10028_debug version) to SES, see attachment below. Some additional notes:

    1. I've only tested with SES version 3.50 and 4.12, suggest that you upgrade to a more recent version.

    2. You need to apply some minor changes to the SDK  ( use the "_vectors" linker symbol instead __isr_vector), see diff file in the project folder.

    3.  Keep the original folder structure since the project relies on relative paths. To avoid overwriting existing project files you can make a new bootloader folder so that the path to your project looks like this: "\nRF5_SDK_12.3.0_d7731ad\examples\dfu\bootloader_secure_ses\pca10028_debug\ses\secure_dfu_secure_dfu_ble_s130_pca10028_debug.emProject"

    4. Is not thoroughly tested. 

    bootloader_secure_ses.zip

Related