MEMORY { header_ram : ORIGIN = 2M-16, LENGTH = 16 vector_ram : ORIGIN = 2M, LENGTH = 64 ram : ORIGIN = 2M + 64, LENGTH = 64K - 64 } RAM_BASE = 2M; RAM_SIZE = 64k; SECTIONS { .header : { KEEP(*nxt_binary_header.s.o (*.text *.text.*)) . = ALIGN(16); } > header_ram /* The vectors are at 0, but since this is overlapped with * the ram area we need to reserve some space for the vector * table */ .vectors : { KEEP(*tpl_vector_table.s.o (*.vectbl *.text.*)) . = ALIGN(16); } > vector_ram __vectors_ram_start__ = ADDR(.vectors); __vectors_ram_end__ = (ADDR(.vectors) + SIZEOF(.vectors)); __vectors_load_start__ = LOADADDR(.vectors); __vectors_load_end__ = (LOADADDR(.vectors) + SIZEOF(.vectors)); .entry : { KEEP(*nxt_entry_point.s.o (*.text *.text.*)) . = ALIGN(16); } > ram /* * The initialisation code goes first, followed by the text. * For a ram build it goes into ram, for a rom build it goes into rom. */ /*.init : { KEEP(*ecrobot_init.s.o (*.text *.text.*)) . = ALIGN(16); } > ram */ /* * code and consts of the operating system (Trampoline). * this section is not accessible from an untrusted process */ . = ALIGN(4); ostext : { *(.osCode) *(.appCommonCode) } > ram . = ALIGN(4); osconst : { *(.osConst) } > ram /* * vars of the operating system (Trampoline) */ . = ALIGN(4); osvars : { *(.osVar) *(.stacks) /* TODO : is it the best place ? */ } > ram /* * code and consts of the processes of the applications */ apptext ALIGN(16) : { /* MPC5510 MPU requires 16 bytes alignment */ __SEG_START_APP_CODE_CONST_RGN = .; *(.osApiConst) /* API constants */ *(.osApiCode) /* API functions */ /* Sections for code of tasks and ISR */% foreach proc in PROCESSES do % *(.% !proc::KIND %_% !proc::NAME %Code) % end foreach foreach isr in ISRS1 do % *(.ISR_% !isr::NAME %Code) % end foreach % } > ram appconst ALIGN(16) : { /* Sections for application const */ % foreach app in APPLICATIONS do for DATA_SIZE in "32BIT","16BIT","8BIT","BOOLEAN","UNSPECIFIED" do for SECTION_KIND in "_CONST_","_CALIB_","_CARTO_","_CONFIG_DATA_" do % *(.OS_APP_% !app::NAME %_SEC% !SECTION_KIND !DATA_SIZE %) % end for end for end foreach % } > ram procconst ALIGN(16) : { /* Sections for const of tasks and ISR */ % foreach proc in PROCESSES do for DATA_SIZE in "32BIT","16BIT","8BIT","BOOLEAN","UNSPECIFIED" do for SECTION_KIND in "_CONST_","_CALIB_","_CARTO_","_CONFIG_DATA_" do % *(.% !proc::KIND %_% !proc::NAME %_SEC% !SECTION_KIND !DATA_SIZE %) % end for end for end foreach % . = ALIGN(16); __SEG_STOP_APP_CODE_CONST_RGN = . - 1; } > ram /* * private data of processes */ procvars : { % foreach proc in PROCESSES do % __SEG_START_% !proc::KIND %_% !proc::NAME %_VAR_RGN = .; /* Initialized variables section of % !proc::KIND % % !proc::NAME % */ % for DATA_SIZE in "32BIT","16BIT","8BIT","BOOLEAN","UNSPECIFIED" do for SECTION_KIND in "_NOINIT_","_POWER_ON_INIT_","_FAST_","_" do % *(.% !proc::KIND %_% !proc::NAME %_SEC_VAR% !SECTION_KIND !DATA_SIZE %) % end for end for % __SEG_END_% !proc::KIND %_% !proc::NAME %_VAR_RGN = ALIGN(16) - 1; % end foreach % } > ram /* * stack of processes */ procstack : { % foreach proc in PROCESSES do % /* Section of stack of % !proc::KIND % % !proc::NAME % */ __SEG_START_% !proc::KIND %_% !proc::NAME %_STACK_RGN = .; *(.% !proc::KIND %_% !proc::NAME %Stack) __SEG_END_% !proc::KIND %_% !proc::NAME %_STACK_RGN = ALIGN(16) - 1; % end foreach % } > ram /* * os application data */ appvars : { % foreach app in APPLICATIONS do % __SEG_START_OS_APP_% !app::NAME %_VAR_RGN = .; /* Initialized variables section of OS_APP % !app::NAME % */ % for DATA_SIZE in "32BIT","16BIT","8BIT","BOOLEAN","UNSPECIFIED" do for SECTION_KIND in "_NOINIT_","_POWER_ON_INIT_","_FAST_","_" do % *(.OS_APP_% !app::NAME %_SEC_VAR% !SECTION_KIND !DATA_SIZE %) % end for end for % __SEG_END_OS_APP_% !app::NAME %_VAR_RGN = ALIGN(16) - 1; % end foreach % } > ram /* * remaining .text (ie no section given) */ . = ALIGN(4); text_garbage : { *(.text*) . = ALIGN(16); } > ram __ramtext_ram_start__ = ADDR(ostext); __ramtext_ram_end__ = ADDR(text_garbage) + SIZEOF(text_garbage); __ramtext_load_start__ = LOADADDR(ostext); __ramtext_load_end__ = __ramtext_load_start__ + SIZEOF(ostext) + SIZEOF(osconst) + SIZEOF(osvars) + SIZEOF(apptext) + SIZEOF(appconst) + SIZEOF(procconst) + SIZEOF(procvars) + SIZEOF(procstack) + SIZEOF(appvars) + SIZEOF(text_garbage) ; .data : { * (*.data *.data.*) *(.rodata) /* litteral strings */ *(.rodata*) . = ALIGN(16); } > ram /* * bss data */ .bss ALIGN(16) : { *(.bss) *(.bss*) } > ram . = ALIGN(16); /* * garbage */ garbage : { *(COMMON) } > ram /* LOADADDR is the same as the ADDR if it is a ram build */ __data_ram_start__ = ADDR(.data); __data_ram_end__ = ADDR(garbage) + SIZEOF(garbage); __data_load_start__ = LOADADDR(.data); __data_load_end__ = __data_load_start__ + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(garbage) ; .comment : { *(.glue_7*) *(.comment) } > ram /* debug : { *(.debug); . = ALIGN(4); *(.debug_srcinfo); . = ALIGN(4); *(.debug_sfnames); . = ALIGN(4); *(.debug_aranges*); . = ALIGN(4); *(.debug_pubnames*); . = ALIGN(4); *(.debug_info*); . = ALIGN(4); *(.debug_abbrev*); . = ALIGN(4); *(.debug_line*); . = ALIGN(4); *(.debug_frame*); . = ALIGN(4); *(.debug_str*); . = ALIGN(4); *(.debug_loc*); . = ALIGN(4); *(.debug_macinfo); . = ALIGN(4); *(.debug_weaknames); . = ALIGN(4); *(.debug_funcnames); . = ALIGN(4); *(.debug_typenames); . = ALIGN(4); *(.debug_varnames); . = ALIGN(4); } > ram*/ }