Dtcm alignment hardfault

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dtcm alignment hardfault

560 Views
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?

 

Tags (3)
0 Kudos
Reply
2 Replies

542 Views
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

Tags (3)
0 Kudos
Reply

514 Views
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 Kudos
Reply