Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 1 | #define ASM |
| 2 | #include "config.h" |
| 3 | #include "cpu.h" |
| 4 | #include "mks5lboot.h" |
| 5 | |
| 6 | ENTRY(_start) |
| 7 | OUTPUT_FORMAT(elf32-littlearm) |
| 8 | OUTPUT_ARCH(arm) |
| 9 | |
| 10 | #define BIN_ORIG DFU_LOADADDR + BIN_OFFSET |
| 11 | #define BIN_SIZE MAX_PAYLOAD |
| 12 | |
| 13 | MEMORY |
| 14 | { |
| 15 | IRAM : ORIGIN = BIN_ORIG, LENGTH = BIN_SIZE |
| 16 | } |
| 17 | |
| 18 | SECTIONS |
| 19 | { |
| 20 | .text : { |
| 21 | *(.init.text*) |
| 22 | *(.text*) |
| 23 | *(.icode*) |
| 24 | . = ALIGN(4); |
| 25 | } > IRAM |
| 26 | |
| 27 | /* include initialized BSS (if any) into DFU image */ |
| 28 | .bss : { |
| 29 | *(.bss*) |
| 30 | *(.ibss*) |
| 31 | *(COMMON) |
| 32 | . = ALIGN(4); |
| 33 | } > IRAM |
| 34 | |
| 35 | #if 1 |
| 36 | /* reuse pwnage as stack, 0x30c bytes available */ |
| 37 | _exception_stack = BIN_ORIG; |
| 38 | _supervisor_stack = _exception_stack; |
| 39 | #else |
| 40 | /* include stack into DFU image */ |
| 41 | .stack : { |
| 42 | . += 0x400; |
| 43 | _supervisor_stack = .; |
| 44 | . += 0x200; |
| 45 | _exception_stack = .; |
| 46 | } > IRAM |
| 47 | #endif |
| 48 | |
| 49 | .data : { |
| 50 | *(.data*) |
| 51 | *(.rodata*) |
| 52 | *(.idata*) |
| 53 | *(.irodata*) |
| 54 | /* place bootloader IM3 header at the end, mkdfu |
| 55 | will concatenate the bootloader binary here */ |
| 56 | . = ALIGN(16); |
| 57 | *(.im3info.data*) |
| 58 | } > IRAM |
| 59 | } |