serious issue when using IAR

Learn MoreFAQsTutorials

10 posts / 0 new
Last post
kevinchen_sz
Offline
Last seen:15小时37分钟前
加入:2017-12-06 09:24
serious issue when using IAR

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 .(remapped at 0?)

Then data start from are all be overwritten ,then cause crash.

/******************************************************************************************************************@file boot.h**@brief此文件包含启动相关变量的声明。**版权所有(C)2019-2020 Dialog Semiconductor。*此计算机程序包括Dialog Semiconducyabo国际娱乐tor的机密专有信息。版权所有。****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************外部结构长度;#定义编码地区和地区的长度(2 uint32\U t)定义编码地区和地区的长度(2 uint32\U t)定义编码地区和地区的长度(2 U U U U地区的长度(2 U U U U U U U U U U地区的长度)和;pragma 35;pragma 35;pragma#pragma 35; pragma #\\umumumum地区的保留区的成员和地区的地区的长度(U U区的地区的地区的不不受地区的RET))#定义非\u RET \u heap \u END(uint32&u t*)((uint32&u t*)((uint32&u t*))(((uint32&uint32&u t t*))))))))))));定义非_ret堆堆堆长度(非_ret堆堆堆端-非_t堆堆端-非t32\u t堆堆端-非tt t t t t 32&u t*)))))(()))定义定义非_ret堆堆堆堆长度(非t堆堆堆堆堆堆端-端-非t堆端-非t堆堆端-非#定义db_heap_LENGTH(db_heap_end-db_heap_BASE)#endif//\u启动\u_

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\u db\u area]之后放置一些初始化变量,仍然存在风险。

Device:
PM_Dialog
Offline
Last seen:3 hours 12 min ago
工作人员
加入:2018-02-08 11:03
Hi kevinchen_sz,

Hi kevinchen_sz,

为迟来的回复致歉,新年快乐。您能否说明您是否正在使用SDK中的prox\u reporter IAR项目来复制此问题?我是指位于projects\target\u apps\ble\u examples\prox\u reporter\IAR SDK path中的项目。

Thanks, PM_Dialog

kevinchen_sz
Offline
Last seen:15小时37分钟前
加入:2017-12-06 09:24
yes.it is prox_reporter\IAR.

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.

PM_Dialog
Offline
Last seen:3 hours 12 min ago
工作人员
加入:2018-02-08 11:03
Hi kevinchen_sz,

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

kevinchen_sz
Offline
Last seen:15小时37分钟前
加入:2017-12-06 09:24
I have attached my screenshot

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ïu main.c,启用睡眠时

休眠代码用于计算哪个RAM块需要保留。

Above issue only found in IAR IDE.

Attachment:
PM_Dialog
Offline
Last seen:3 hours 12 min ago
工作人员
加入:2018-02-08 11:03
Hi kevinchen_sz,

Hi kevinchen_sz,

谢谢你的截图。还有一个问题,我将在内部升级以复制它:您是使用SDK提供的项目,还是进行了任何修改?

Thanks, PM_Dialog

kevinchen_sz
Offline
Last seen:15小时37分钟前
加入:2017-12-06 09:24
both.

both.

and i also tried different version of IAR.

all have the same question.

PM_Dialog
Offline
Last seen:3 hours 12 min ago
工作人员
加入:2018-02-08 11:03
Hi kevinchen_sz,

Hi kevinchen_sz,

I’ll escalated this internally to check this out and will get back to you.

Thanks, PM_Dialog

Bogisich
Offline
Last seen:1 week 2 days ago
加入:2021-01-13 09:08
Thanks for the update and

Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Looking for the same issue. Bumped into your thread.

myfordbenefits

PM_Dialog
Offline
Last seen:3 hours 12 min ago
工作人员
加入:2018-02-08 11:03
嗨janosN,非常感谢

你好,janosN,非常感谢您的评论和宝贵的反馈!我们将审阅您的所有意见/解决方案。

Hi sfuentes-digi, thanks for verifying this!

如果您有任何其他问题或反馈的无代码,请提出一个新的论坛门票!

Thanks, PM_Dialog