stack influencing commands

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

stack influencing commands

1,508件の閲覧回数
Germarmin
Contributor I
Hi all,

I am working on a programm which analyses assembler code to determine the worst case stack usage of the MPC565 and MPC 5554. I read through several documents but I still did not totally understand how to start.

As I can presuppose the definition EABI is followed the stack pointer is r1. But how can I figure out all the commands that influence the stack? I have the instruction set, but there are so many exceptions that it is very complicated. Perhaps there is someone who can point me into the right direction?

Best regards,
Germarmin
0 件の賞賛
返信
2 返答(返信)

733件の閲覧回数
dayve
NXP Employee
NXP Employee

Hey Germarmin,

 

You are correct that this is compilcated.

 

Analysing the assembler to see where it is creating stack frames is probably your best place to start. The assembler will do r1-0x80 when it creates a frame for the z6 core. 

 

You will need to work out how many levels deep that the program you are analysing goes - how many stack frames can be once the stack at any one time. For this you will need to analyse the exception and interrupt settings. 

 

In the case of nested interrurpts in software mode the prologue function that creates the stack frame will only exist in the software once so just counting the number of stack frame creations will not work. If nested interrupts are allowed you will need to work out how many exceptions can be pre-empted to work out how many stack frames you can have active at any one time. 

 

I hope that this is a starting point for you. Let me know how you get on or if you have some more specific questions. 

 

Regards, 

dayve

0 件の賞賛
返信

733件の閲覧回数
Germarmin
Contributor I
Hi dayve,

thanks for your answer. I don't try to get the exact amount of used stack but rather a 'good guess'. What I mean is, that it does not matter if the result is slightly above (as long as it is not below!) the real amout of stack. So for interrupts I just ignore that sometimes an interrupt locks others and simply sum up the size of stack each interrupt uses and add it to the stack my other functions use. For the functions I mind if / how often they are called of course.

What else is there to heed? I try to make it as simple as possible.

Regards,
Germarmin

0 件の賞賛
返信