The segment information from objdump is not consistent with the information specified in the Linker file.

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

The segment information from objdump is not consistent with the information specified in the Linker file.

ソリューションへジャンプ
1,368件の閲覧回数
kongdetao
Contributor III

Development environment:  S32K148+ S32 Develop Studio for arm 

Now compile a S32K148 program, and then use the objdump tool to print out the segment information of the file, and found a problem: the result of objdump shows that the LMA address of the code segment is inconsistent with the address specified by Linker?

 

The results of objdump are as follows:

Sections:
Idx Name Size VMA LMA File off Algn
0 .interrupts 00000400 00000000 00000000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .flash_config 00000010 00000400 00000400 00010400 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .text 00002178 00000410 00000410 00010410 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .interrupts_ram 00000400 1ffe0000 1ffe0000 00030000 2**0
ALLOC
4 .data 00000348 1ffe0400 00002588 00020400 2**3
CONTENTS, ALLOC, LOAD, DATA
5 .code 00000000 1ffe0748 1ffe0748 0002f000 2**0
CONTENTS

Linker的内容如下:

.data : AT(__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .; /* Create a global symbol at data start. */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
__data_end__ = .; /* Define a global symbol at data end. */
} > m_data

__DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
__CODE_ROM = __DATA_END; /* Symbol is used by code initialization. */

.code : AT(__CODE_ROM)
{
. = ALIGN(4);
__CODE_RAM = .;
__code_start__ = .; /* Create a global symbol at code start. */
__code_ram_start__ = .;
*(.code_ram) /* Custom section for storing code in RAM */
. = ALIGN(4);
__code_end__ = .; /* Define a global symbol at code end. */
__code_ram_end__ = .;
} > m_data

ラベル(1)
タグ(4)
1 解決策
1,198件の閲覧回数
stanish
NXP Employee
NXP Employee

Hi,

You are probably referring to LMA address of .code section:

5 .code 00000000 1ffe0748 1ffe0748 0002f000 2**0

The load address is calculated by the expression __CODE_ROM:

__DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
__CODE_ROM = __DATA_END; /* Symbol is used by code initialization. */

You probably expect the load address is located in rom 0x000028D0 instead of ram (0x1FFE0748)

This seems to be caused by the fact the .code section is zero size.

If it has a non-zero size the load address should match with the linker file.

You can make an easy check by adding the attribute below prior to any your C function e.g. main():

__attribute__((section(".code_ram")))
int main(void)

Hope it helps.

Stan

元の投稿で解決策を見る

2 返答(返信)
1,199件の閲覧回数
stanish
NXP Employee
NXP Employee

Hi,

You are probably referring to LMA address of .code section:

5 .code 00000000 1ffe0748 1ffe0748 0002f000 2**0

The load address is calculated by the expression __CODE_ROM:

__DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
__CODE_ROM = __DATA_END; /* Symbol is used by code initialization. */

You probably expect the load address is located in rom 0x000028D0 instead of ram (0x1FFE0748)

This seems to be caused by the fact the .code section is zero size.

If it has a non-zero size the load address should match with the linker file.

You can make an easy check by adding the attribute below prior to any your C function e.g. main():

__attribute__((section(".code_ram")))
int main(void)

Hope it helps.

Stan

1,198件の閲覧回数
kongdetao
Contributor III

OK,thks very much!!!

0 件の賞賛