.map 파일에서 'Stack locally' 및 'Stack prev'는 무엇입니까?

기술노트 24702

아키텍처:

8051

컴포넌트:

linker

업데이트:

2018-02-28 오전 2:50

Introduction

If the Static overlay system map (-xo) linker option (IAR XLINK Linker) has been specified, the list file includes the following information:

"Stack locally" is the number of bytes the function uses. "Stack prev" is the number of bytes that the "children" (the functions called from the function in question, recursively all the way down to the leaves that don't call anything) uses.

The key to understanding how the values are summed is that each level X entry only bothers with the entries that are listed immediately prior to itself and are of level X+1 or higher. It is similar to files and directories in the file system of an operating system. Each level is a directory that contains other directories and some data of disk usage. Each directory is only concerned with itself and the directories it contain.

Toy example

Level Name
4 foo
6 bar
5 baz
5 frotz
4 qwerty

In this example qwerty will contain the stack usage from frotz, baz and bar, but not foo as foo does not have a higher level (qwerty does not call foo). frotz does not make any calls (those would be listed as level 6 entries preceeding frotz if they did exist). That bar is level 6 and also placed in the qwerty tree does not matter as bar belongs to baz.

Real example

                    Stack prev        Stack locally
RSTACK CSTACK RSTACK CSTACK

4 getA 0 0 4 0
4 getB 0 0 4 0
4 getC 0 0 2 0
4 getD 0 0 2 0
4 getE 0 0 2 0
3 Foo2 4 0 2 17
2 Foo1 6 17 2 8

In this example, main (level 1) calls Foo1(level 2) which in turn calls Foo2 (level 3) which in turn calls several leaves (level 4).

Some of the leaves use 4 bytes of RSTACK, while others use 2. This matters in the "Stack prev" column on level 3. "Stack prev" on level X is the highest sum of "Stack prev" + "Stack locally" for level X+1.

For level 3 in this example, it is 0+4, 0+4, 0+2, 0+2, 0+2. The maximum is 4 so level 3 gets an RSTACK prev of 4 and a CSTACK prev of 0.

For level 2 in this example it is 4 + 2 = 6 and 0+17 = 17 as there only is one alternative.

 

All product names are trademarks or registered trademarks of their respective owners.

죄송하지만, 당사 사이트에서는 Internet Explorer를 지원하지 않습니다.보다 편안한 사이트를 위해 Chrome, Edge, Firefox 등과 같은 최신 브라우저를 사용해 주시길 부탁드립니다.