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

Bootloader update problem

I'm having an issue programming the bootloader using .hex file. I have "Erase all" by nrf52832 and was trying to debug my bootloader the code didn't stop at the beginning of the main. By breaking the code I was it was running in the Softdevice. Finally I figure out that the UICR[0] register wasn't written to the address of the bootloader. I manually write the address with nrfjprog.exe using the following command line and it start running properly:

nrfjprog.exe --family NRF52 --memwr 0x10001014 --val 0x00078000

Then I try to update the softdevice and applicative firmware and everything work fine.

I then try to update the bootloader version but it doesn't work. I'm trying to figure out what is not working properly but having some problem to run the bootloader in debug. Anyway I figure out that if I write the UICR[1] register to the __mbr_params_page_start__ (0x0007E000).

I was trying to see in the code where the UICR[1] register is use that could cause my problem. There is the following definition that I found but it doesn't seems to be used:

#define MBR_PARAMS_PAGE_ADDRESS (NRF_UICR->NRFFW[1])

Any idea why I can't update my bootloader if NRF_UICR->NRFFW[1] != 0x0007E000?

Also is there a way to have the NRF_UICR->NRFFW[0] and NRF_UICR->NRFFW[1] values included in the .hex file without modifying it manually?

Thank!

  • Is this what you are talking about?

    "C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 4.50\bin\mkld" -memory-map-segments "FLASH RX 0x0 0x80000;RAM RWX 0x20000000 0x10000;mbr_params_page RX 0x0007E000 0x1000;bootloader_settings_page RX 0x0007F000 0x1000; uicr_bootloader_start_address 0xFF8 0x4; uicr_mbr_params_page 0xFFC 0x4;" -section-placement-file d:/config/flash_placement_bootloader.xml -check-segment-overflow -symbols __STACKSIZE__=2048;__STACKSIZE_PROCESS__=0;__HEAPSIZE__=0 -section-placement-macros FLASH_PH_START=0x0;FLASH_PH_SIZE=0x80000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x10000;FLASH_START=0x78000;FLASH_SIZE=0x6000;RAM_START=0x20000008;RAM_SIZE=0xfff8 "d:/Output/Bootloader Release/Obj/Bootloader.ld"
    "C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 4.50\gcc\arm-none-eabi\bin\ld" -X --omagic -eReset_Handler --defsym=__vfprintf=__vfprintf_long --defsym=__vfscanf=__vfscanf_long -EL --gc-sections "-Td:/Output/Bootloader Release/Obj/Bootloader.ld" -Map Output/Release/Exe/Bootloader.map -u_vectors -o Output/Release/Exe/Bootloader.elf --emit-relocs --start-group "@d:/Output/Bootloader Release/Obj/Bootloader.ind" --end-group
    "C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 4.50\gcc\arm-none-eabi\bin\objcopy" Output/Release/Exe/Bootloader.elf d:/Output/Release/Exe/Bootloader.hex -Oihex

    I've just added the uicr_bootloader_start_address 0xFF8 0x4; uicr_mbr_params_page 0xFFC 0x4;" in the -memory-map-segments parameter but it doesn't change anything.

    I'm using Segger Embedded Studio.

  • You need to change the objcopy command. It processes only .text section by default IIRC.

  • In Segger studio, in the project option, Code/Build section, the memory segment must have the uicr_bootloader_start_address and the uicr_mbr_params_page segment define WITH the RX parameter. I have added it manualy but forgot the RX.

    FLASH RX 0x0 0x80000;RAM RWX 0x20000000 0x10000;mbr_params_page RX 0x0007E000 0x1000;bootloader_settings_page RX 0x0007F000 0x1000"

Related