Hi,
i'm using IAR(8.11.1) to develop.
I found a serious issue that some values always be changed when booting.
Finally I find the code which break the RAM:
void arch_rom_init(void) { #if defined (__DA14531__) && (!USE_CHACHA20_RAND) // Store value of _rand_state stdlib/rand.c RW variable uint32_t rand_temp = _rand_state_ROM_DATA; #endif test1 = DB_HEAP_BASE; test2 = RAM_UNINIT_START_ADDRESS; test3 = RAM_UNINIT_END_ADDRESS - RAM_UNINIT_START_ADDRESS; test4 = (__section_begin(".heap_db_area")); test5 = RET_MEM_BASE; #if defined (__DA14531__) && (USE_TRNG) // Given that the DA14531 secondary bootloader and flash programmer // (UART version) leaves untouched the memory area between // RAM_UNINIT_START_ADDRESS and RAM_UNINIT_END_ADDRESS address, // this memory area can be used to feed the TRNG buffer with // true random data (random values after RAM block power up). // The maximum size of the TRNG buffer is the difference between the // RAM_UNINIT_END_ADDRESS and RAM_UNINIT_START_ADDRESS. // // Note: The maximum TRNG buffer size should be recalculated // if the application uses the Free Area region (check the // scatter file). In any case, if the used TRNG buffer size is // small enough, the TRNG algorithm will operate with true random // data independently to the maximum size used in the following // memory copy. For further details check the SDK6 documentation. if (trng_state_val != 0x12348765) { memcpy((uint8_t *) DB_HEAP_BASE, (uint8_t *) RAM_UNINIT_START_ADDRESS, RAM_UNINIT_END_ADDRESS - RAM_UNINIT_START_ADDRESS); } #endif
when first boot,the TRNG is enabled and here will do copy to DB_HEAP_BASE.
but i find in boot.h ,all the definitions are compiled to 0.(on keil project,it contains the right address)
at address 0,it contains the address of
Then data start from
/ ** **************************************************************************************** * * @file boot.h * * *@brief此文件包含引导相关变量的声明。* *版权所有(c)2019-2020对话半导体。雷竞技电竞平台*此计算机程序包括对话半导体的机密,专有信息*。雷竞技电竞平台版权所有。* **************************************************************************************** * / #ifndef _boot_h_ #define _boot_h_ #include extern const uint32_t __er_irom3_base __ [];#define code_area_base((uint32_t)__ er_irom3_base__)extern const uint32_t __er_irom3_length __ [];#define code_area_length((uint32_t)__ er_irom3_length__)#pragma部分=“.retention_mem_area_uninit”#define ret_mem_base(*(uint32_t *)(__ section_begin(“Retention_mem_area_uninit”)))#pragma部分=“.heap_mem_area_not_ret”#define non_ret_heap_base(*(UInt32_t *)(__ section_begin(“堆_mem_area_not_ret”)))#define non_ret_heap_end(*(uint32_t *)(__ section_end(“heap_mem_area_not_ret”)))#define non_ret_heap_length(non_ret_heap_end - non_ret_heap_base)#pragma部分=“.heap_db_area”#define DB_HEAP_BASE (*(uint32_t*)(__section_begin(".heap_db_area"))) #define DB_HEAP_END (*(uint32_t*)(__section_end(".heap_db_area"))) #define DB_HEAP_LENGTH (DB_HEAP_END - DB_HEAP_BASE) #endif // _BOOT_H_
Futher more,
even if the address is right,
how can it promise the section[heap_db_area] is bigger than (RAM_UNINIT_END_ADDRESS - RAM_UNINIT_START_ADDRESS)?
如果编译器在Secton [HeaP_DB_AREA]之后将一些初始变量放置一些初始变量,它仍然是一种风险。
Device:
Hi kevinchen_sz,
为迟到的回应和新年快乐道歉。您是否可以从SDK中使用Prox_Reporter IAR项目来复制此问题?我的意思是位于Projects \ target_apps \ ble_examples \ prox_reporter \ IAR SDK路径的项目。
Thanks, PM_Dialog
yes.it is prox_reporter\IAR.
but i think it has nothing to do with the application code.
The code using these defination from compiler is located in the system init or sleep handler functions.
Hi kevinchen_sz,
Are you using the project as provided by the SDK? The prox_reporter\IAR should work out of the box and as provided by the SDK. Please try it with a clear SDK directory.
>>Finally I find the code which break the RAM:
Do you mean that you ran in with the debugger attached and the project got crashed?
If you could provide some extra information/screenshots on this issue, it would be very helpful.
Thanks, PM_Dialog
I have attached my screenshot what I finally found.
The root cause of this issue is : __section_begin() and __section_end() in "boot.h" don't return the right address but zero.
see screenshot in the atthached file.
Two part have use the macro in "boot.h":
1.arch_rom.c, when CFG_TRNG is defined
this cause crash
2.ARCH_MAIN.c,启用睡眠时
睡眠代码用于计算哪个RAM块需要保留。
Above issue only found in IAR IDE.
Hi kevinchen_sz,
谢谢你的屏幕截图。还有一个问题,我会在内部升级它来复制它:您是否使用SDK提供的项目,或者您是否完成了任何修改?
Thanks, PM_Dialog
both.
and i also tried different version of IAR.
all have the same question.
Hi kevinchen_sz,
I’ll escalated this internally to check this out and will get back to you.
Thanks, PM_Dialog
嗨Janosn,非常感谢您的评论和宝贵的反馈!我们将审核您的所有评论/解决方案。
Hi sfuentes-digi, thanks for verifying this!
如果您对无附件有任何其他问题或反馈,请培养新的论坛票!
Thanks, PM_Dialog