so, after getting it to compile, now i can no longer write to flash memory and i don't knwo why i am getting this error now. now sure if it is a result of nrf_dfu_flash and me using rds calls but i didn't change this function from the time it was working yesterday until today
static ret_code_t record_write(uint32_t fid,
uint32_t key,
void const * p_data,
uint32_t len)
{
fds_record_t const rec =
{
.file_id = fid,
.key = key,
.data.p_data = p_data,
.data.length_words = (len + 3) / sizeof(uint32_t)
};
NRF_LOG_INFO("writing record to flash...\r\n"
"file: 0x%x, key: 0x%x, \"%s\", len: %u bytes\r\n",
fid, key, p_data, len);
ret_code_t rc = fds_record_write(NULL, &rec);
if (rc != FDS_SUCCESS)
{
NRF_LOG_INFO("Failed to write: 0x%02X", rc);
}
return rc;
}
I get print of Failed to write: 0x03. Yesterday it was writing fine. The error code is FDS_ERR_UNALIGNED_ADDR but i fail to understand why it is an issue today nor do i understand how to correct. I tried increase my data to 8 but that didn't work.
My memory mappings are as follows
FLASH RX 0x0 0x80000
RAM RWX 0x20000000 0x10000
bootloader_settings_page R 0x0007F000 0x1000
uicr_bootloader_start_address R 0x10001014 0x4
FLASH_PH_START=0x0
FLASH_PH_SIZE=0x80000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x10000
FLASH_START=0x26000
FLASH_SIZE=0x56000
RAM_START=0x20005000
RAM_SIZE=0xb000
Here is the weird part. If I erase chip using SES and then go into debug mode and download the debug files, it works correctly as expected. If i go to released and compile and download that program to the module. it doesnt work at all. and if i take the release file and compile it into the full app_sd_app_bl.hex file using the following batch file, it uploads but isnt able to record the data as in debug mode.
set APP_FILE=app
set APP_FILE_LOC=Output\Release\Exe
set SOFTDEVICE_LOC=sdk_nRF1520\components\softdevice\s132\hex
set SOFTDEVICE=s132_nrf52_6.1.0_softdevice.hex
set BOOTLOADER_LOC=secure_bootloader\pca10040_ble\ses\Output\Release\Exe
set BOOTLOADER=secure_bootloader_ble_s132_pca10040.hex
set OUTPUT_FILE_LOC=Output\Release
@echo Preparing: nordic dfu settings file...
nrfutil settings generate --family NRF52 --application %APP_FILE_LOC%\%APP_FILE%.hex --application-version 1 --bootloader-version 2 --bl-settings-version 1 %APP_FILE_LOC%\%APP_FILE%_bl_settings.hex
mergehex --merge %APP_FILE_LOC%\%APP_FILE%.hex %APP_FILE_LOC%\%APP_FILE%_bl_settings.hex --output %APP_FILE_LOC%\%APP_FILE%_app+bl_settings.hex
@echo Preparing: nordic DFU zip
nrfutil pkg generate --hw-version 52 --sd-req 0xAE --application-version 1 --application %APP_FILE_LOC%\%APP_FILE%.hex --key-file %APP_FILE_LOC%\..\..\..\keys\sbd_mlock_private_key.pem %OUTPUT_FILE_LOC%\%APP_FILE%_app_dfu_pkg.zip
@echo merging softdevice, secure bootloader, bootloader settings and application...
mergehex --merge %SOFTDEVICE_LOC%\%SOFTDEVICE% %BOOTLOADER_LOC%\%BOOTLOADER% %APP_FILE_LOC%\%APP_FILE%_app+bl_settings.hex --output %OUTPUT_FILE_LOC%\%APP_FILE%_sd_app_bl.hex
and here are my preprocessor calls
BOARD_CUSTOM
CONFIG_GPIO_AS_PINRESET
FLOAT_ABI_HARD
INITIALIZE_USER_SECTIONS
NO_VTOR_CONFIG
NRF52
NRF52832_XXAA
NRF52_PAN_74
NRF_DFU_SVCI_ENABLED
NRF_DFU_TRANSPORT_BLE=1
NRF_DFU_SETTINGS_VERSION=1
NRF_SD_BLE_API_VERSION=6
S132
SOFTDEVICE_PRESENT
SWI_DISABLE0
To simplify: Debug compile and run -> fds actions work
Release compile and run -> i get error 0x03 when trying to write to fds