How to add the NOINIT section in keil scatter file?
⚠️ Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
因为你是使用DA14580和假设SDK5.04,couple of SDK changes should be don win order to retain initialized data during reset. DA14585/6 and our newest SDK6 (latest version 6.0.10), has the capability if storing initialized data. Do you have any thought for moving into DA14585/6? There is a software example demonstrating this functionality.
Can you tell me the changes I should make to sdk 5.0.4 to store and get values after reset. In my idea, I should make changes to the scatter file, any other places I should modify in the sdk 5.0.4 in order to retain values after reset?
I use extend sleep in normal mode, when sleep command received on ble, then da14580 will fall into deep sleep, another mcu will give DA14580 an reset signal when need to restart, after restart, I need the bond information be retained to connected back to bonded ios device.
I noticed my data to be stored is located in the area that is marked as uninit in the scatter file, for example, the map file show my data start address is 0x00082448, and data length is 476 bytes, and the scatter file list this area as UNINIT "ZI_RET20 0x00080768 UNINIT 0x22b8", but it seems that my data is still been lost after reset even if when I set da14580 to extend sleep before reset(since I notice this area is in SysRAM area).
Please check the SystemInit() function, and you will find the SetBits16(PMU_CTRL_REG, RETENTION_MODE, 0xF); , so all the bits of the retention ram are set to zero As you already have seen the zeroing out of the retention memory area is something that should be done when the device boots up since the retention area while in deep sleep holds, besides the user data, additional BLE information (BLE heap, stack, etc).
After reset the zeroing out function will run again and will wipe out any data that you have in the retention memory area. In order to avoid that what you can do is to know where your “data” reside in the retention memory area and during the initialization you should avoid zeroing them out. There is no reference design or example that demonstrates that, what I would do is the following:
In the scatterfile where the retention memory area is defined for deep sleep allocate a space that will hold your data that should be not initialized.
Part of the RETRAM_LEN will be used from your new section so remove from the #define RETRAM_LEN the amount of bytes that you will use and add the size of the new section (the new RETRAM_LEN = RETRAM_LEN – SZ_AFT_RST_DATA):
Declare an execution area in the LR_RETENTION_RAM0 that is starting from 0x00080768. The new execution area will start from area 0x00080768 and will have the range of your requirement (lets say for example that the range you would like would be SZ_AFT_RST_DATA 80 bytes). So the scatterfile would change to:
§ RET_RESET01 0x00080768 UNINIT SZ_AFT_RST_DATA { .ANY (unitialized_data_test)} <- Tag the new area.
After doing that the ZI_RET00 will start from the address 0x00080768 + SZ_AFT_RST_DATA and not from 0x00080768.
所以现在你知道wi的数据ll be tagged with the unitialized_data_test will reside from the address 0x00080768 up to the address 0x00080768 + SZ_AFT_RST_DATA. Since you are aware of that you can go to the SystemInit() function and instruct the function not to zero out the memory between the 0x00080768 and 0x00080768+SZ_AFT_RST_DATA.
// Fill 0x80000 - 0x83000 with zeros unsigned int *p_retmem = (unsigned int *)0x80000; for (i = 0xBFF; i >= 0; i--) { if((p_retmem > (unsigned int *)0x80768) && (p_retmem < (unsigned int *)(0x80768 + 80)) ) *(volatile unsigned *)p_retmem++; else *(volatile unsigned *)p_retmem++ = 0; }
Hi cgha,
因为你是使用DA14580和假设SDK5.04,couple of SDK changes should be don win order to retain initialized data during reset. DA14585/6 and our newest SDK6 (latest version 6.0.10), has the capability if storing initialized data. Do you have any thought for moving into DA14585/6? There is a software example demonstrating this functionality.
SW Example: DA14585/586 Detect the Source of the Reset
Thanks, PM_Dialog
Can you tell me the changes I should make to sdk 5.0.4 to store and get values after reset. In my idea, I should make changes to the scatter file, any other places I should modify in the sdk 5.0.4 in order to retain values after reset?
I use extend sleep in normal mode, when sleep command received on ble, then da14580 will fall into deep sleep, another mcu will give DA14580 an reset signal when need to restart, after restart, I need the bond information be retained to connected back to bonded ios device.
I noticed my data to be stored is located in the area that is marked as uninit in the scatter file, for example, the map file show my data start address is 0x00082448, and data length is 476 bytes, and the scatter file list this area as UNINIT "ZI_RET20 0x00080768 UNINIT 0x22b8", but it seems that my data is still been lost after reset even if when I set da14580 to extend sleep before reset(since I notice this area is in SysRAM area).
Hi cgha,
Please check the SystemInit() function, and you will find the SetBits16(PMU_CTRL_REG, RETENTION_MODE, 0xF); , so all the bits of the retention ram are set to zero As you already have seen the zeroing out of the retention memory area is something that should be done when the device boots up since the retention area while in deep sleep holds, besides the user data, additional BLE information (BLE heap, stack, etc).
After reset the zeroing out function will run again and will wipe out any data that you have in the retention memory area. In order to avoid that what you can do is to know where your “data” reside in the retention memory area and during the initialization you should avoid zeroing them out. There is no reference design or example that demonstrates that, what I would do is the following:
In the scatterfile where the retention memory area is defined for deep sleep allocate a space that will hold your data that should be not initialized.
Part of the RETRAM_LEN will be used from your new section so remove from the #define RETRAM_LEN the amount of bytes that you will use and add the size of the new section (the new RETRAM_LEN = RETRAM_LEN – SZ_AFT_RST_DATA):
Declare an execution area in the LR_RETENTION_RAM0 that is starting from 0x00080768. The new execution area will start from area 0x00080768 and will have the range of your requirement (lets say for example that the range you would like would be SZ_AFT_RST_DATA 80 bytes). So the scatterfile would change to:
After doing that the ZI_RET00 will start from the address 0x00080768 + SZ_AFT_RST_DATA and not from 0x00080768.
所以现在你知道wi的数据ll be tagged with the unitialized_data_test will reside from the address 0x00080768 up to the address 0x00080768 + SZ_AFT_RST_DATA. Since you are aware of that you can go to the SystemInit() function and instruct the function not to zero out the memory between the 0x00080768 and 0x00080768+SZ_AFT_RST_DATA.
Thanks, PM_Dialog