Dtcm alignment hardfault

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Dtcm alignment hardfault

522 次查看
ola_gook
Contributor III

Hi,

I am upgrading a project from DS3.4 to DS3.6 and have a problem.

DS3.6 example and system files all use dtcm as stack area, whereas 3.4 used sram. This makes sense and I would prefer to use dtcm also in my project.

However, as my SW uses numerous memcpy with stack as destination and sometimes with unaligned data, I get hardfaults when calling memcpy.

If I understand correctly, the dtcm is aligned differently than sram and that this cannot be changed.

Is there a way around this or do I need to replace all my memcpy calls with an aligned alternative memcpy?

 

标记 (3)
0 项奖励
回复
2 回复数

504 次查看
ola_gook
Contributor III

Managed to pin it down a bit. It turns out that it is not the memcpy that fails but rather setting up the parameters for memcpy, specifically the misaligned destination address. This is unfortunate because it means I cannot replace the memcpy with an alternative.

Making a hardcoded memcpy to the same address works, but not the parameterised destination address. (Breakpoint at the instruction causing the hardfault.)

 

ola_gook_1-1743425825005.png

Regards,

/Ola

标记 (3)
0 项奖励
回复

476 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

DTCM memory does not have any limitation for read/write accesses in the meaning of data aligment. There is only write access size requirements for ECC initialization that is 64-bit for SRAM and 32-bit for DTCM, but during runtime data accesses may be on any size and alignment.

0 项奖励
回复