リンカー スクリプトに問題があります。セクション .data2、.nonsharedram、および .bss の LMA が間違っています。これらは FLASH に配置する必要がありますが、代わりに SHARED1 および SHARED2 領域に配置されます。
リンカー スクリプト:
MEMORY
{
FLASH : org = 0x100000, len = 1M
NON_SHARED : org = 0x100, len = 0x4600
STACK : org = 0x4700, len = 0x900
BOOTPROG : org = 0x8080, len = 0x1D80
SHARED1 : org = 0x10000, len = 0x3000
SHARED2 : org = 0x18000, len = 0x4000
LATCH : org = 0x40000, len = 2
DSPCODE : org = 0x1030000, len = 0x4000
EXTRAM : org = 0x200000, len = 1M
}
SECTIONS
{
.cstack 0x4700 (NOLOAD) : {
__STACK_START = .;
. = . + 0x800;
_STACK_END = . -4;
} >STACK
.istack 0x4F00 (NOLOAD) : {
__ISTACK_START = .;
. = . + 0x100;
_ISTACK_END = . -4;
} >STACK
.bootprog 0x8080 (NOLOAD) : { *(.bootprog); } >BOOTPROG
.bmcdataram 0x10000 (NOLOAD) : { *(.bmcdataram); } >SHARED1
.dspdataram 0x102C0 (NOLOAD) : { *(.dspdataram); } >SHARED1
.pwron_ctrl 0x12000 (NOLOAD) : { *(.pwron_ctrl); } >SHARED1
.dspstack 0x12F00 (NOLOAD) : { *(.dspstack); } >SHARED1
.dsp2dataram 0x18000 (NOLOAD) : { *(.dsp2dataram); } >SHARED2
.output_latch 0x40000 (NOLOAD) : { *(.output_latch); } >LATCH
.dspcoderam 0x1030000 (NOLOAD) : { *(.dspcoderam); } >DSPCODE
.promst 0x100000 :
{
*(.promst)
} >FLASH
.version 0x100100 :
{
*(.version)
} >FLASH
.cstart 0x100200 :
{
*(.cstart)
} >FLASH
.rodata ALIGN(0x2) : AT (ADDR (.cstart) + SIZEOF (.cstart))
{ *(.rodata*) ;
} >FLASH
.text : AT (ADDR (.rodata) + SIZEOF (.rodata))
{
*(.text);
*(.ctors);
*(.dtors);
*(.eh_frame);
*(.jcr);
} >FLASH
.init ALIGN(0x2) : AT (ADDR (.text) + SIZEOF (.text))
{
*(.init*) ;
} >FLASH
.fini ALIGN(0x2) : AT (ADDR (.init) + SIZEOF (.init))
{
*(.fini*) ;
} >FLASH
.data 0x12004 : AT (ADDR (.fini) + SIZEOF (.fini))
{
_datas = . ;
*(EXCLUDE_FILE (*lib_a-impure.o *lib_a-mallocr.o) .data);
_datae = . ;
} >SHARED1
.data2 0x19000 : AT (ADDR (.data) + SIZEOF (.data))
{
_data2s = . ;
*lib_a-impure.o(.data);
*lib_a-mallocr.o(.data);
_data2e = . ;
} >SHARED2
.nonsharedram 0x100 : AT (ADDR (.data2) + SIZEOF (.data2))
{
_nonsharedrams = . ;
*(.nonsharedram);
_nonsharedrame = . ;
} >NON_SHARED
.bss 0x200000 : AT (ADDR (.data2) + SIZEOF (.data2))
{
_bsss = . ;
*(.bss);
*(COMMON);
_bsse = . ;
} >EXTRAM
}
objdump から:
Sections:
Idx Name Size VMA LMA File off Algn
0 .cstack 00000800 00004700 00004700 000fbf70 2**0
CONTENTS
1 .istack 00000100 00004f00 00004f00 000fc770 2**0
CONTENTS
2 .bootprog 00001d7f 00008080 00008080 000001d4 2**1
ALLOC
3 .bmcdataram 00000210 00010000 00010000 000001d4 2**0
ALLOC
4 .dspdataram 00001d40 000102c0 000102c0 000001d4 2**1
ALLOC
5 .pwron_ctrl 00000004 00012000 00012000 000001d4 2**2
ALLOC
6 .dsp2dataram 00001000 00018000 00018000 000009a8 2**1
ALLOC
7 .output_latch 00000002 00040000 00040000 00000aac 2**1
ALLOC
8 .dspcoderam 00004000 01030000 01030000 000fbf70 2**1
ALLOC
9 .promst 00000056 00100000 00100000 00000aac 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
10 .version 00000015 00100100 00100100 00000b02 2**1
CONTENTS, ALLOC, LOAD, READONLY, DATA
11 .cstart 00000042 00100200 00100200 00000b18 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .rodata 0009af26 00100242 00100242 00000b5a 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
13 .text 0005fb00 0019b168 0019b168 0009ba80 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .init 0000000c 001fac68 001fac68 000fb580 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .fini 00000008 001fac74 001fac74 000fb58c 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .data 000009dc 00012004 001fac7c 000fb594 2**2
CONTENTS, ALLOC, LOAD, DATA
17 .data2 000007d4 00019000 000129e0 000001d4 2**2
CONTENTS, ALLOC, LOAD, DATA
18 .nonsharedram 00000104 00000100 000197d4 000009a8 2**2
CONTENTS, ALLOC, LOAD, DATA
19 .bss 0001e6f4 00200000 000197d4 00000aac 2**2
ALLOC
20 .comment 0000004b 00000000 00000000 000fc870 2**0
CONTENTS, READONLY
21 .debug_frame 00015a84 00000000 00000000 000fc8bc 2**2
CONTENTS, READONLY, DEBUGGING
22 .debug_abbrev 00006fe7 00000000 00000000 00112340 2**0
CONTENTS, READONLY, DEBUGGING
23 .debug_info 00025b72 00000000 00000000 00119327 2**0
CONTENTS, READONLY, DEBUGGING
24 .debug_line 00008f7a 00000000 00000000 0013ee99 2**0
CONTENTS, READONLY, DEBUGGING
25 .debug_loc 0001db0a 00000000 00000000 00147e13 2**0
CONTENTS, READONLY, DEBUGGING
26 .debug_pubnames 00000e8c 00000000 00000000 0016591d 2**0
CONTENTS, READONLY, DEBUGGING
27 .debug_pubtypes 00003612 00000000 00000000 001667a9 2**0
CONTENTS, READONLY, DEBUGGING
28 .debug_aranges 000008c0 00000000 00000000 00169dbb 2**0
CONTENTS, READONLY, DEBUGGING
29 .debug_str 0000297e 00000000 00000000 0016a67b 2**0
CONTENTS, READONLY, DEBUGGING
30 .debug_ranges 00000648 00000000 00000000 0016cff9 2**0
CONTENTS, READONLY, DEBUGGING