Hi,
I am using the nrf_log_backend_flash in SDK15.3 with IAR 8.32 on Window10. From what I see in the release notes, no improvements were made for 16.0.
In my application using the softdevice and bootloader, the bootloader successfully starts my application the first time. Subsequent resets fail to start the bootloader due to
nrf_dfu_validation: CRC check of app failed. Return 1
It appears that the flash log backend is overwriting part of my application.
My sdk_config.h contains
// <i> If 0, then pages directly after the application are used. #ifndef NRF_LOG_BACKEND_FLASH_START_PAGE #define NRF_LOG_BACKEND_FLASH_START_PAGE 0 #endif
From nrf_log_backend_flash.c, I see that RUNTIME_START_ADDR is set depending on CODE_END which is derived from RO_END.
#define RUNTIME_START_ADDR ((NRF_LOG_BACKEND_FLASH_START_PAGE == 0) ? \ (CODE_PAGE_SIZE*CEIL_DIV((uint32_t)CODE_END, CODE_PAGE_SIZE)) : FLASH_LOG_START_ADDR)
When I debug, I see the value of RUNTIME_START_ADDR is 0x56000. However, the start of bank 1 as retrieved from nrf_dfu_bank1_start_addr() is 0x57000.
My IAR map file shows that the linker assigns data past RO_END, causing data into the next page at 0x56000
"P1", part 2 of 3: 0x0
RO_END 0x5'5fc0 0x0 <Block>
"P1", part 3 of 3: 0x324
Initializer bytes const 0x5'5fc0 0x324 <for P2-1>
- 0x5'62e4 0x324
I believe this may be an SDK bug, at least with IAR. RUNTIME_START_ADDR seems like it should be set to 0x57000. If I hard-code NRF_LOG_BACKEND_FLASH_START_PAGE to a non-zero value >=57, things work well.