S12Z Core Stack Size View usage

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

S12Z Core Stack Size View usage

1,492 次查看
michaellee
Contributor I

Dear All

 

We are using Code Warrior 10.x.
And we are developing using S12Z Core.

 

We want to know the usage of Stack of S12Z Core.
I want to know how I can verify with the Code Warrior IDE.

 

I found the stack size and memory address in the .prm / map file.

 

S12ZVC Stack Size View usage

 

Thank you for Regrads

标签 (1)
0 项奖励
回复
4 回复数

1,062 次查看
iggi
NXP Employee
NXP Employee

That Asm_func(); is just for reference. It says it is in test.asm. So you can create test.asm and define the function inside with soem basic asm instructions.

Anyway, there is no tool in CW to check the real used stack size.

A method you can use to check it is like this:

1. After reset, firstly write some value like 0xAA or 0X55 to all stack size.

2. Then the main program should run.

3. After some time pause/stop the program.

4. See in debugger memory window at address where stack starts how far the initial values written into stack has been overwritten by main program.

Hope it helps.

0 项奖励
回复

1,062 次查看
michaellee
Contributor I

 Hi, Thank you for your reply.

 I want to know where to find the Asm part.
  ==> Asm_func (); / * Call to an assembly function defined in test.asm * /


  Is it a way to see the real of used stack size?

 Thank you Regards

0 项奖励
回复

1,062 次查看
iggi
NXP Employee
NXP Employee

Hi,

The stack may be located anywhere in the 16-megabyte address space that has RAM, and can be any size up to the amount of available RAM. The stack is used to automatically save the return address for subroutine calls, the return address and CPU registers during interrupts, and for local variables.

There is an option in project properties to see stack consumption:
pastedImage_1.png

The stack consumption computation is a feature of the linker that helps compute the theoretical maximal amount of stack space an application requires at runtime. This estimation can be done for the whole application or for user-specified call sub-trees. The result of the estimation is printed out in the map file along with the corresponding call tree paths. This feature is controlled by the -StackConsumption  command line option. However, the specific information needed for this feature is issued by the compiler and encoded in the object file.

Usage of CONSUMPTION Directive - Test Case

shows a test case of usage of CONSUMPTION directive.

Listing 3.59 Usage of CONSUMPTION Directive


Void main() {
Asm_func(); /* Call to an assembly function defined in test.asm*/
}

Stack usage of main to Asm_func is given by compiler in object file but assembler does not provide stack usage of Asm_func routine. CONSUMPTION directive can be added to specify the stack usage of Asm_func.

PRM Directive specification, as shown in the following listing:

Listing 3.60 PRM Directive


STACK_CONSUMPTION
ROOT _Startup
END
CONSUMPTION Asm_func 100;
END

1,062 次查看
michaellee
Contributor I

 Hi, Thank you for your reply.

 

 I want to know where to find the Asm part.
  ==> Asm_func (); / * Call to an assembly function defined in test.asm * /


  Is it a way to see the real of used stack size?

 

 Thank you Regards

0 项奖励
回复