4G_module/prebuild/ld/ML302A/DCLM/app_dclm.ld

107 lines
3.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Copyright © 2022 China Mobile IOT.
* All rights reserved.
*
*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(cm_opencpu_entry)
#define ALIGNMENT ALIGN(0x8)
#define IMG_INFO LONG(0x5A5AA5A5) \
LONG(__flash_end - __flash_start) \
LONG(__flash_start) \
LONG(__ram_start)
#define SECTION_INFO(type, section) LONG(type) \
LONG(__##section##_lma_start - __flash_start) \
LONG(__##section##_lma_start) \
LONG(__##section##_vma_start) \
LONG(__##section##_vma_end - __##section##_vma_start)
#define SECTION_TEXT .text .text.* .gnu.linkonce.t.* .glue_7 .glue_7t .vfp11_veneer .v4_bx
#define SECTION_SRAMTEXT .sramtext
#define SECTION_RODATA .rdata .rodata .rodata.* .gnu.linkonce.r.*
#define SECTION_DATA .data .data.* .gnu.linkonce.d.*
#define SECTION_BSS .bss .bss.* COMMON .scommon .sbss .sbss.* .sbss2 .sbss2.* .gnu.linkonce.b.*
MEMORY {
ram (rwx): ORIGIN = 0x7E1B0000, LENGTH = 128K
flash (rwx): ORIGIN = 0x80338000, LENGTH = 512K
}
SECTIONS {
. = ORIGIN(flash);
__flash_start = .;
/*头部信息lma=vma*/
.image_header : {
IMG_INFO
SECTION_INFO(0, text)
SECTION_INFO(1, rodata)
SECTION_INFO(2, data)
SECTION_INFO(3, bss)
SECTION_INFO(4, sramtext)
} > flash
/*.text段lma=vma*/
.text ALIGNMENT : {
__text_vma_start = .;
*(.text.cm_opencpu_entry)
EXCLUDE_FILE(*cm_stub_DCLM.o *.sram.o) *(SECTION_TEXT)
__text_vma_end = .;
. = ALIGNMENT;
__text_lma_start = LOADADDR(.text);
} > flash
/*.rodata段lma=vma*/
.rodata ALIGNMENT : {
__rodata_vma_start = .;
*(SECTION_RODATA)
__rodata_vma_end = .;
. = ALIGNMENT;
__rodata_lma_start = LOADADDR(.rodata);
} > flash
/*vma切换至ram*/
. = ORIGIN(ram);
__ram_start = .;
/*.sramtext段lma=flashvma=ram*/
.sramtext ALIGNMENT : {
__sramtext_vma_start = .;
*cm_stub_DCLM.o(SECTION_TEXT)
*.sram.o(SECTION_TEXT)
*(SECTION_SRAMTEXT)
__sramtext_vma_end = .;
. = ALIGNMENT;
__sramtext_lma_start = LOADADDR(.sramtext);
} AT>flash
/*.data段lma=flashvma=ram*/
.data ALIGNMENT : {
__data_vma_start = .;
*(SECTION_DATA)
__data_vma_end = .;
. = ALIGNMENT;
__data_lma_start = LOADADDR(.data);
} AT>flash
/*.bss段lma=vma*/
.bss ALIGNMENT : {
__bss_vma_start = .;
*(SECTION_BSS)
__bss_vma_end = .;
. = ALIGNMENT;
__bss_lma_start = LOADADDR(.bss);
}
__flash_end = LOADADDR(.data) + SIZEOF(.data);
__ram_end = ADDR(.bss) + SIZEOF(.bss);
end = __ram_end;
ASSERT(__flash_end <= ORIGIN(flash) + LENGTH(flash), "FLASH overflow")
ASSERT(__ram_end <= ORIGIN(ram) + LENGTH(ram), "RAM overflow")
}