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

Writing some parameters to flash using nrfjprog.

Hi all,

I am developing a BLE device prototype. There will be multiple such devices. How can I write the UUIDs to flash while flashing the hex file. Or how can I get the address of the location where to write UUID?

Suppose I am using static uint8_t UUID[16]; array to store UUID. How can I get the location of this array in flash or hex file to rewrite a new generated UUID to it?

e.g. nrfjprog -f nrf52 --snr <Segger-chip-Serial-Number> --memwr <mem_loc> --val <UUID>

Now how to get mem_loc so that it writes at the address where static uint8_t UUID[16] array is located?

Parents
  • Hi Yike, 

    If you want you can print out in the log the value of the UUID pointer so you know where it's located in the flash. Or you can set a breakpoint and check the value of the UUID pointer. 

    But if you modify the application code, or if you use different compiler, the location of the variable/array may change. So it's better to set the array to a specified location that you choose. 
    To do that you can use the __attribute__ keyword. Please refer to how we configure the m_uicr_bootloader_start_address variable to the location 0x10001014 in nrf_bootloader_info.c in the bootloader example, or the m_dfu_settings_buffer array in nrf_dfu_settings.c to address 0x0007F000. 

Reply
  • Hi Yike, 

    If you want you can print out in the log the value of the UUID pointer so you know where it's located in the flash. Or you can set a breakpoint and check the value of the UUID pointer. 

    But if you modify the application code, or if you use different compiler, the location of the variable/array may change. So it's better to set the array to a specified location that you choose. 
    To do that you can use the __attribute__ keyword. Please refer to how we configure the m_uicr_bootloader_start_address variable to the location 0x10001014 in nrf_bootloader_info.c in the bootloader example, or the m_dfu_settings_buffer array in nrf_dfu_settings.c to address 0x0007F000. 

Children
Related