How to relocate/execute a function to DDR.

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

How to relocate/execute a function to DDR.

1,461 次查看
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 回复数

1,336 次查看
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 项奖励
回复

1,336 次查看
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