1OUTPUT_ARCH( "riscv" ) 2ENTRY(_start) 3 4MEMORY 5{ 6 /* FlashBoot location on Flash */ 7 FLASH (rwx) : ORIGIN = 0x400000+0x5A0, LENGTH = 32K-0x5A0-0x3C0 8 /* ram for stack */ 9 STACK(xrw) : ORIGIN = 0x100000,LENGTH = 8K 10 /* ram for common bss and data */ 11 SRAM(xrw) : ORIGIN = 0x100000+8K,LENGTH = 8K 12 /* ram for fix rom bss and data */ 13 ROM_BSS_DATA(rx): ORIGIN = 0x100000+16K,LENGTH = 2K 14 /* ram for code rom bss and data */ 15 CODE_ROM_BSS_DATA(rx): ORIGIN = 0x100000+18K,LENGTH = 2K 16 /* signature */ 17 SIGN(rx): ORIGIN = 0x100000+40K,LENGTH = 0x5A0 18 /* ram for flashboot */ 19 FLASH_BOOT(rx): ORIGIN = 0x100000+40K+0x5A0,LENGTH = 80K-0x5A0 20 /* ram for heap */ 21 HEAP(xrw): ORIGIN = 0xdc000,LENGTH = 144K 22 /* rom for fixed rom */ 23 FIXED_ROM(rx): ORIGIN = 0x00000000+11K,LENGTH = 21K 24 /* rom for code rom */ 25 CODE_ROM(rx): ORIGIN = 0x003b8000+278K,LENGTH = 10K 26} 27 28SECTIONS 29{ 30 /* The startup code goes first into FLASH */ 31 .text.entry : ALIGN(4) 32 { 33 KEEP(*(.text.entry)) 34 } > FLASH_BOOT AT>FLASH 35 36 .rom.text : 37 { 38 . = ALIGN(4); 39 KEEP(SORT(libbase.o)(.text*)) 40 KEEP(SORT(libbase.o)(.rodata*)) 41 . = ALIGN(4); 42 } > FIXED_ROM 43 44 .rom.code.text : 45 { 46 . = ALIGN(4); 47 KEEP(SORT(libcodebase.o)(.text*)) 48 KEEP(SORT(libcodebase.o)(.rodata*)) 49 . = ALIGN(4); 50 } > CODE_ROM 51 52 /* Stack in SRAM at Highest addresses */ 53 .stacks (NOLOAD) : 54 { 55 . = ALIGN(4); 56 __SYSTEM_STACK_BEGIN__ = ORIGIN(STACK); 57 KEEP(*(.stacks)) 58 __SYSTEM_STACK_END__ = ORIGIN(STACK) + LENGTH(STACK); 59 } > STACK 60 __SYSTEM_STACK_SIZE__ = __SYSTEM_STACK_END__ - __SYSTEM_STACK_BEGIN__; 61 __stack_top = __SYSTEM_STACK_END__; 62 63 .rom.data : 64 { 65 . = ALIGN(4); 66 __rom_copy_start = LOADADDR(.rom.data); 67 . = ALIGN(4); 68 __rom_copy_ram_start = .; 69 __global_pointer$ = .; 70 KEEP(SORT(libbase.o) (.data*)) 71 . = ALIGN(4); 72 __rom_copy_ram_end = .; 73 } > ROM_BSS_DATA AT>FIXED_ROM 74 __rom_copy_size = __rom_copy_ram_end - __rom_copy_ram_start; 75 76 .rom.code.data : 77 { 78 . = ALIGN(4); 79 __code_rom_copy_start = LOADADDR(.rom.code.data); 80 . = ALIGN(4); 81 __code_rom_copy_ram_start = .; 82 KEEP(SORT(libcodebase.o) (.data*)) 83 . = ALIGN(4); 84 __code_rom_copy_ram_end = .; 85 }>CODE_ROM_BSS_DATA AT>CODE_ROM 86 __code_rom_copy_size = __code_rom_copy_ram_end - __code_rom_copy_ram_start; 87 88 .rom.bss : 89 { 90 . = ALIGN(4); 91 __rom_bss_start = .; 92 KEEP(libbase.o (.bss)) 93 KEEP(libbase.o (.bss*)) 94 KEEP(libbase.o (COMMON)) 95 . = ALIGN(4); 96 __rom_bss_end = .; 97 } > ROM_BSS_DATA AT>FIXED_ROM 98 99 .rom.code.bss : 100 { 101 . = ALIGN(4); 102 __code_rom_bss_start = .; 103 KEEP(libcodebase.o (.bss)) 104 KEEP(libcodebase.o (.bss*)) 105 KEEP(libcodebase.o (COMMON)) 106 . = ALIGN(4); 107 __code_rom_bss_end = .; 108 }>CODE_ROM_BSS_DATA AT>CODE_ROM 109 110 .text : ALIGN(4) 111 { 112 __start_addr = .; 113 SORT(*)(.boot.data.key) 114 *(.text*) 115 . = ALIGN(4); 116 __rodata_start = .; 117 *(.rodata*) 118 . = ALIGN(4); 119 __rodata_end = .; 120 __text_end = .; 121 } > FLASH_BOOT AT>FLASH 122 123 /* data section */ 124 .data : ALIGN(4) 125 { 126 __data_load = LOADADDR(.data); 127 __data_start = .; 128 *(.data*) 129 . = ALIGN(4); 130 __data_end = .; 131 } > FLASH_BOOT AT>FLASH 132 133 /* bss section */ 134 .bss (NOLOAD) : ALIGN(4) 135 { 136 __bss_begin__ = .; 137 *(.bss*) 138 *(COMMON) 139 . = ALIGN(4); 140 __bss_end__ = .; 141 } > FLASH_BOOT 142 __bss_size__ = __bss_end__ - __bss_begin__; 143 144 .heap (NOLOAD) : 145 { 146 . = ALIGN(4); 147 __heap_begin__ = ORIGIN(HEAP); 148 KEEP(*(.heap)) 149 __heap_end__ = __heap_begin__ + LENGTH(HEAP); 150 } > HEAP 151} 152