running code out of the stack

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

running code out of the stack

1,791 次查看
hajianik
Senior Contributor I

Hi,

I was wondering if any one of the brilliant mind would show me how to load the stack and run the code from there.

I know how to use linker script file to run code out of RAM.

I'm exclusively talking about the stack. I have seen other people do it long time ago, and I know it could be done.

Please don't give me "Stack is used to save machine state" and things of that nature.

 

Thanks,

Koorosh Hajiani

0 项奖励
回复
4 回复数

1,763 次查看
stanish
NXP Employee
NXP Employee

Hi,

could you describe more in the detail what are you trying to achieve by that construction?

Thanks,

Stan

0 项奖励
回复

1,754 次查看
hajianik
Senior Contributor I

Hi Stan,

I just need to run a function from RAM. This is concerning the  the launching command to read/write to Program Once in program flash IFR.

I've done this using a linker script file.I've seen other people use stack to run from RAM however it was a long time ago.

was wondering if any of the brilliant mind out there has an idea!!!!

 

Thanks,

Koorosh

0 项奖励
回复

1,737 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

well, running some function directly from stack is quite unusual way and not much effective - in my opinion. First of all you need to allocate local memory, then memcopy your "function implementation" into allocated memory from flash and after that you can call function pointer. 

Easiest way is just call function from RAM (as you already did). There is a macro in S32K1xx SDK for running functions from RAM - here is simple example: 


START_FUNCTION_DECLARATION_RAMSECTION
void CCIF_Callback(void)
END_FUNCTION_DECLARATION_RAMSECTION

 

Hope it helps. 

Jiri 

0 项奖励
回复

1,733 次查看
hajianik
Senior Contributor I

Hi

I know all that.

My question was/is  specifically on running function out of stack.

Thanks,

0 项奖励
回复