How to mark a function to be executed from internal Ram?

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

How to mark a function to be executed from internal Ram?

跳至解决方案
1,222 次查看
simmania
Contributor IV

Hi,
For performance reasons I need some functions (e.g. interrupt routines) to be executed from internal memory.
When I compile it seems no Ram is used for code yet. So I guess I have to tell the linker somehow which functions need to be executed from Ram.

How can I do that? I'm using MCUXpresso and the MIMXRT1010-EVK.
I did search the forum on this. And there are topics about it, but I have a hard time filtering this for the correct info.

I hope someone can help me with this.

0 项奖励
回复
1 解答
1,152 次查看
mayliu1
NXP Employee
NXP Employee

Hi @simmania ,

 

Thank you so much for your interest in our products and for using our community.

I suggest you can refer this link wrote by a NXP expert.

https://www.nxpic.org.cn/module/forum/thread-623079-1-1.html

I use a MIMXRT1170-EVKB board for example, MCUXpresso IDE v24.9.25 version to do this validation.

It is same if you use MIMXRT1010 board, Please refer to what I have done.

I import a SDK demo "evkbmimxrt1170_igpio_input_interrupt_cm7"

In the next MCUXpresso IDE project config , the SRAM_DTC_cm7 space is specified for storing the readwrite segment.

mayliu1_0-1732703727449.png

 

Method 1:    use __RAMFUNC() 

In my project, I put function "EXAMPLE_GPIO_IRQHandler" to Ram.

mayliu1_2-1732704146645.png

mayliu1_3-1732704187207.png

the .map file describe the address of function EXAMPLE_GPIO_IRQHandler is in Ram.

Method 2:  use Specify functions for custom sections 

__attribute__((section("TestSection")))

mayliu1_4-1732704283965.png

mayliu1_5-1732704424216.pngmayliu1_6-1732704450342.png

This method is also working.

Wish it helps you.
If you still have question about it, please kindly let me know.

Best Regards

mayliu

 

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,179 次查看
simmania
Contributor IV

When I put __DATA(RAM2) in front of the function

like this:

__DATA(RAM2) void ADC1_IRQHANDLER(void) {

.....

}

the function seems to be placed in SRAM_ITC (I assume this is ITCM ram).
But the program does not work. The HardFault_Handler(void) function is called. I do not know why.

What else do I need to do to make this work?

In which documentation should I be able to find the answer (I found it difficult ti find good documentation).
Is there some example somewhere? I guess executing a fast interrupt from ITCM is something more people need to do.

0 项奖励
回复
1,153 次查看
mayliu1
NXP Employee
NXP Employee

Hi @simmania ,

 

Thank you so much for your interest in our products and for using our community.

I suggest you can refer this link wrote by a NXP expert.

https://www.nxpic.org.cn/module/forum/thread-623079-1-1.html

I use a MIMXRT1170-EVKB board for example, MCUXpresso IDE v24.9.25 version to do this validation.

It is same if you use MIMXRT1010 board, Please refer to what I have done.

I import a SDK demo "evkbmimxrt1170_igpio_input_interrupt_cm7"

In the next MCUXpresso IDE project config , the SRAM_DTC_cm7 space is specified for storing the readwrite segment.

mayliu1_0-1732703727449.png

 

Method 1:    use __RAMFUNC() 

In my project, I put function "EXAMPLE_GPIO_IRQHandler" to Ram.

mayliu1_2-1732704146645.png

mayliu1_3-1732704187207.png

the .map file describe the address of function EXAMPLE_GPIO_IRQHandler is in Ram.

Method 2:  use Specify functions for custom sections 

__attribute__((section("TestSection")))

mayliu1_4-1732704283965.png

mayliu1_5-1732704424216.pngmayliu1_6-1732704450342.png

This method is also working.

Wish it helps you.
If you still have question about it, please kindly let me know.

Best Regards

mayliu

 

0 项奖励
回复
1,146 次查看
simmania
Contributor IV

Thanks a lot, this worked.

I would like to read that article. But the link refers to a Chinese forum. Unfortunately I can not read Chinese.

0 项奖励
回复
1,129 次查看
mayliu1
NXP Employee
NXP Employee

Hi @simmania ,

 

You are welcome!

I 'm sorry I  have no article about it in English form.
If your question is solved, please Accept as solution, and tell me to  close this case, thanks.

 

Best Regards

mayliu

0 项奖励
回复