Hello, I'm migrating a project from nrf51 to nrf52, and there is this function:
uint32_t dfu_init(void)
{
m_cmd_handler = *((bl_if_cmd_handler_t*) (0x20000000 + ((uint32_t) (NRF_FICR->SIZERAMBLOCKS * NRF_FICR->NUMRAMBLOCK) - 4)));
(uint32_t) m_cmd_handler >= (NRF_FICR->CODESIZE * NRF_FICR->CODEPAGESIZE) ||
(uint32_t) m_cmd_handler < NRF_UICR->BOOTLOADERADDR)
Clearly, this "m_cmd_handler" is stored at the calculated address.
In Nrf52, both NRF_FICR->SIZERAMBLOCKS * NRF_FICR->NUMRAMBLOCK are removed. Since I'm using nrf52840, by reading technical documents, I found that it's RAM size is 256KB, so I assume the above code can be modified to:
uint32_t dfu_init(void)
{
m_cmd_handler = *((bl_if_cmd_handler_t*) (0x20000000 + ((uint32_t) (256*1024 - 4)));
there is only one problem: I don't know if the "0x20000000" in above code is still applicable. I don't know exactly what this code is trying to get other than to guess that it's the bootloader start address whatnot, and I'm not sure if this "0x20000000", which I assume has something to do with the RAM starting address, should match my settings in keil:
So... can I just use 0x20000000? Also, is (256*1024 - 4) correct?
Also, as the function name suggests, it has something to do with dfu.