How to relocate/execute a function to DDR.

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

How to relocate/execute a function to DDR.

604 Views
tandinh
Contributor II

I based on the link: https://community.nxp.com/servlet/JiveServlet/download/104433-4-291307/Relocating+Code+and+Data+Usin... and was able to relocate a function to the external DDR (0xa000_0000). I verified the relocated function was copied to the DDR and was able to single step to the function. However, as soon as I stepped to the first instruction "a4000000: push {r7, lr}", it led to the HardFault handler. Please help and let me know what am I missing. 

I include the KDS example project in the attachment.

Thanks

2 Replies

479 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi  TAN DINH,

Make sure to initialize the external memory controller before trying to access the DDR memory.

Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos

479 Views
tandinh
Contributor II

Hi Carlos,

Thanks for the reply. I did initialize the DDR before copying. I did find the solution for this. Instead of using physical address of DDR (0xA000_0000), I use the DDR_ALIAS address for code (0x1800_0000), then the issue goes away. I am able to step inside the function in DDR without any issue.

Thanks.

-- Tan Dinh