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

Bootloader and settings problem - gcc compiler

I have a custom board with an application that works fine. 

But when adding a secure bootloader my board starts to act weird. I am using the RESET pin on the chip as an input PIN. My chip resets every time the input is used when the app is run with the bootloader. But it works fine without the bootloader.

I am running SDK13 - Softdevice 4.0.5 on a nrf52832CIAA. 

I am compiling with gcc - both the app and bootloader. I have used nrfutil to create bootloader settings file. 

I have used merge-hex to merge the SD, app, Bootloader and settings-file.

All has been run on a MAC / OSX.

I have read somewhere on the Nordic DEVZONE that the gcc compiler places the settingsfile in the wrong place of the memory map. But I lack a good method of fixing it.

  • Hello

    did you take a look at the declaration of CONFIG_GPIO_AS_PINRESET in both your app and your bootloader?

    Check the comment in system_nrf52.c:

    /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
    defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
    reserved for PinReset and not available as normal GPIO. */


    Best,

  • Hi Cyril,

    I have defined the PIN reset to a normal GPIO. 

    The app works fine. But the bootloader does not work. Strange, because both are using the same board file. 

    regards

    Jens

  • Hi Jens, 

    Please readout  UICR.PSELRESET[x] after programming the bootloader to verify that it's not set. It should be 0xFF.. if pinreset is disabled. E.g., with nrfjprog

    nrfjprog --memrd 0x10001200

    This option is enabled if you build the project with CONFIG_GPIO_AS_PINRESET independent of what board file you use. 

    Regards,

    Vidar

  • Hi Vidar, 

    Pinreset is disabled. Readout of memory: 0xFF. 

    I am using mergehex to merge and nrfjprog to program the board. Does GCC compile it wrong?

    Please help.

    Jens

  • Hi Jens,

    Thanks for verifying that the pinreset functionality is indeed disabled.  

    I have read somewhere on the Nordic DEVZONE that the gcc compiler places the settingsfile in the wrong place of the memory map. But I lack a good method of fixing it.

    I don't recall seeing this issue. We did, however, have a bug where the buttonless app and bootloader placed data in the same flash region which would cause merge conflicts when combining the two. I think we fixed that in SDK 12.3.0.

    The format of the settings page generated is the same regardless of the toolchain you use. Also, the bootloader would not have booted the app if you had an invalid settings page.  

    But when adding a secure bootloader my board starts to act weird. I am using the RESET pin on the chip as an input PIN. My chip resets every time the input is used when the app is run with the bootloader. But it works fine without the bootloader.

    Are you able to debug the app to see what causes the reset? You can build with -DDEBUG to catch code assertions (error handler will perform a reset otherwise).

    Best regards,

    Vidar

Related