📄 bubble.dld
字号:
/* ---------------------------------------------------------------------------- * example/coldfire/bubble.dld: Linker Command File for Bubble Sort example. * * Target: Coldfire. * * This sample linker command file is specific to the Bubble Sort example. It * and linker command files in the conf directory are a guide to building a * file for your own system. * * CAUTION: The .text2 section referred to in this file is defined explicitly * in bubble.c. See default.dld in the conf directory for a general * guide to building a linker command file. * * For a description of the different statements in this file, please refer * to the D-LD Linker User's Manual. * ------------------------------------------------------------------------- *//* The MEMORY command is used to name four areas of memory: "rom1", "rom2", * "ram", and "stack" as pictured below. A #pragma directive is used during * compilation to assign the "sort" function to a .text2 section, while a * "section" assembler directive assigns the "swap" function to .text2. * * On the right are symbols used during initialization and by memory allocation * routines. These symbols are defined at the end of this file. * * * +-------------------------------+ * 0xf0000 | input_count: simulated I/O | Located by "#pragma section * | register | ... address=0xf0000" in * +-------------------------------+ bubble.c * * 192KB gap -- unreserved * * 0xc0000 +-------------------------------+ <- ___SP_INIT * | | | * "stack" | stack, 64KB, grows down | * | | | * 0xb0000 +-------------------------------+ <- ___SP_END, ___HEAP_END * | | used for heap by malloc if | * | | present (all unused "ram") | * | +-------------------------------+ <- ___HEAP_START * | | .bss: uninitialized data, | * "ram" | zeroed by ___init_main | * | +-------------------------------+ <- ___DATA_END, ___BSS_START * | | .data: initialized data, | * | | including "array", | * | | copied here from "rom2" | * | | by ___init_main | * 0x80000 +-------------------------------+ <- ___DATA_RAM * * 256KB gap -- unreserved * * 0x40000 +-------------------------------+ * | | / / / / / (unused) / / / / / | * | +-------------------------------+ * | | physical image of .data to be | * "rom2" | copied to "ram" | * | +-------------------------------+ <- ___DATA_ROM * | | swap function | * | | .text2: sort function | * 0x30000 +-------------------------------+ * | | / / / / / (unused) / / / / / | * | +-------------------------------+ * "rom1" | library code | * | | main function | * | | .text: crt0 code | * 0x20000 +-------------------------------+ * | | * | reserved for debug monitor | * | | * 0x0 +-------------------------------+ * * ------------------------------------------------------------------------- */MEMORY{ rom1: org = 0x20000, len = 0x10000 /* 3rd 64KB */ rom2: org = 0x30000, len = 0x10000 /* 4th 64KB */ ram: org = 0x80000, len = 0x30000 /* 512KB - 703KB */ stack: org = 0xb0000, len = 0x10000 /* 7043B - 768KB */}SECTIONS{ /* Collect all code sections from all input files to make a single output * .text section and locate it in "rom1" memory (except for .text2 code * sections). */ .text : { *(.text) *(.init) *(.fini) } > rom1 /* Collect all ".text2" sections and locate in "rom2" memory. */ .text2 : { *(.text2) ___DATA_ROM = .; } > rom2 /* Collect initialized data sections (.data) from all input files to make * a single output .data section. Reserve space for the .data section in * "ram" memory (via "> ram"). However use the LOAD clause to place the * actual data after the ".text2" section in the "rom2" memory. * ___init_main() will move the actual data from "rom2" to "ram". * * Reserve space for all .bss sections in "ram" memory after the .data * section. Any remaining space will be used as heap by malloc(). * * The GROUP command guarantees that sections will be kept together * and in the order given. */ GROUP : { ___DATA_RAM = .; /* With the LOAD specification, the next command will * reserve space for the .data section at the beginning of * "ram" (the "logical" address), but actually place the * data in the image at the end of the .text section as * defined by ___DATA_ROM in the GROUP above (the "physical" * address). */ .data LOAD(___DATA_ROM) : {} ___DATA_END = .; /* Allocate uninitialized sections. */ ___BSS_START = .; .bss : {} ___BSS_END = .; .ctors ALIGN(4):{ ctordtor.o(.ctors) *(.ctors) } .dtors ALIGN(4):{ ctordtor.o(.dtors) *(.dtors) } /* Any remaining space will be used as a heap. */ ___HEAP_START = .; } > ram}/* Definitions of identifiers used by sbrk.c, init.c and the different * crt0.s files. Their purpose is to control initialization and memory * memory allocation. * * ___HEAP_START : Used by sbrk.c: start of memory used by malloc() etc. * ___HEAP_END : Used by sbrk.c: end of heap memory * ___SP_INIT : Used by crt0.s: initial address of stack pointer * ___SP_END : Used by sbrk.c: only used when stack probing * ___DATA_ROM : Used by init.c: start of initialized data in ROM * ___DATA_RAM : Used by init.c: start of initialized data in RAM * ___DATA_END : Used by init.c: end of initialized data in RAM * ___BSS_START : Used by init.c: start of uninitialized data * ___BSS_END : Used by init.c: end of data to be cleared * ------------------------------------------------------------------------- */___HEAP_END = ADDR(ram ) + SIZEOF(ram );___SP_INIT = ADDR(stack ) + SIZEOF(stack );___SP_END = ADDR(stack );/* ---------------------------------------------------------------------------- * Additional notes: * ---------------------------------------------------------------------------- * (1) Constants and strings will be in the .text segment unless the * -Xconst-in-text=0 option is used. * * (2) If ___SP_END and ___HEAP_END point to the same address (i.e., the "ram" * and "stack" memory areas are contiguous), then programs compiled with * -Xstack-probe or -Xrtc will allocate more stack from the top of the * heap on stack overflow if possible (see ___sp_grow() in sbrk.c). * ------------------------------------------------------------------------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -