Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

Memory Layout is mainly divided into:

1. Code

2. Code running in RAM

3. Constant

4. Initialized global variables

5. Uninitialized global variables

6. Stack

Step1:

The most important thing for a link file is to assign the allocated section (Section) to a fixed location
(MemLayout). These sections can be packaged into a Group.

Therefore, the most important thing is the definition of the segment. The definition of the segment is
divided into:

1. Code segment

2. Constant segment

3. Stack segment

4. Initialized and uninitialized variable segments

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 1/8
5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

1. The code segment is divided into:

1. Startup code segment

2. Code segment running in RAM

3、Option Byte

4. Task and interrupt code

5. Other code segments

2. The constant section is divided into:

1.  Interrupt vector table

2. Some configuration parameter conversion constants of  Autosar OS

3. Other constants

3. Stack area

1. Both Task and interrupt are configured with a stack

2. The stack used in the OS

4. Initialized and uninitialized variables

1.  bss  , data area

2. Some global variables defined by Autosar OS

Step2:

1. After the relevant Section definition is completed, it must be constrained in the form of a group

1. Code and Constant Section are specified in Const Group

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 2/8
5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

2. The relevant Group can control which allocated Memeory Section it is specified to exist in

3. For the part that needs to be copied and run in RAM, it can be specified by the relevant Group

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 3/8
5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

 4. In the Group, related Sections can be recombined into larger Section Groups. At the same time,
you can set the alignment and initialization method of the relevant Section Group

Step3:

Some symbol variables can be defined in the link file, and these symbol variables can be used in the
code, and the relevant symbol variables need to be declared in the header file or source file.

For example: define the start and end of a segment as related symbol variables, and the related
symbol variables can be detected in the code to obtain the corresponding address information.

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 4/8
5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

Define the Symbol in the link file, which has a corresponding address. You can use either the symbol
defined in the link file or the absolute address when defining the related Symbol in vLinkGen. As
above, _RESET uses symbols, and you can also fill in the absolute address in Value.

At the same time, if you want to use the corresponding symbol variable in the code, you need
to declare the corresponding symbol in the header file or source file.

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 5/8
5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

It can be seen that the value of FunctionInRam_START_SEC is consistent with the value of
FunctionInRam$$Base.

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 6/8
5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

Step4:

variable segment control

1. Initialized variables

2. Uninitialized variables

3. Stack allocated in Task and ISR

Step5:

This is the most important part, which is the specific division of the existing structure of the chip:

1. Interrupt vector table

2、OPTION BYTE

3. Code area

4. Stack area

The above code area and stack area can also be divided into small areas to store data with different
functions

like

The stack area may also be divided to store programs running in RAM

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 7/8
5/12/23, 3:27 PM vLinkGen Memory Layout_WlzSnail's Blog-CSDN Blog

The code area should be divided into the startup code area and the regular code area

It is best to open up a part of the stack area used by the startup code in the stack area

https://blog.csdn.net/WlzSnail/article/details/121518168?ops_request_misc=%257B%2522request%255Fid%2522%253A%252216838853441680018… 8/8

You might also like