2025-07-10 4:38 AM
Hello,
In my project, I want to hold boot params in BKPSRAM so application project can also write and read this section easily. Therefore, I tried to write and read in this area some parameters. I can see the datas in "BKPSRAM_BASE_S" section while debugging but when I restart the debug session all fill with zero. I know that I am missing something but did not find it.
#define BKP_SRAM_START_ADDRESS ((uint32_t)BKPSRAM_BASE_S)
#define BOOT_PARAMS_PTR ((BootParameters_t*)BKP_SRAM_START_ADDRESS)
/* USER CODE BEGIN Init */
__HAL_RCC_BKPSRAM_MEM_CLK_ENABLE();
HAL_PWREx_EnableBkupRAMRetention();
HAL_PWR_EnableBkUpAccess();
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* Configure the peripherals common clocks */
PeriphCommonClock_Config();
/* USER CODE BEGIN SysInit */
SystemIsolation_Config();
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_HPDMA1_Init();
MX_XSPI2_Init();
/* USER CODE BEGIN 2 */
MX_EXTMEM_MANAGER_Init();
s_boot_params.o_boot_mode = TRUE;
memcpy(&s_boot_params.ab_version[0], k_BOOTLOADER_VERSION, 4);
/* Write to backup ram */
memcpy((void*) BOOT_PARAMS_PTR, &s_boot_params, sizeof(BootParameters_t));
/*Read from backup ram */
// memcpy(&s_boot_params, (void*) BOOT_PARAMS_PTR, sizeof(BootParameters_t));
Any help appreciated.
Best Regards.