1.1 --- a/payload.ld Sat Oct 20 19:16:03 2018 +0200
1.2 +++ b/payload.ld Sat Oct 20 19:17:46 2018 +0200
1.3 @@ -1,6 +1,8 @@
1.4 OUTPUT_ARCH(mips)
1.5 ENTRY(_start)
1.6
1.7 +IRQ_STACK_SIZE = 256;
1.8 +
1.9 /* See...
1.10 * FIGURE 4-5: MEMORY MAP ON RESET FOR PIC32MX170/270 DEVICES (64 KB RAM, 256 KB FLASH)
1.11 * PIC32MX1XX/2XX 28/36/44-pin Family Data Sheet
1.12 @@ -8,11 +10,12 @@
1.13
1.14 MEMORY
1.15 {
1.16 - kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x10000
1.17 kseg0_boot_mem (rx) : ORIGIN = 0x9FC00000, LENGTH = 0xBF0
1.18 kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x40000
1.19 + kseg0_data_mem (w!x) : ORIGIN = 0x80000000, LENGTH = 0x10000
1.20 physical_boot_mem (rx) : ORIGIN = 0x1FC00000, LENGTH = 0xBF0
1.21 physical_program_mem (rx) : ORIGIN = 0x1D000000, LENGTH = 0x40000
1.22 + physical_data_mem (w!x) : ORIGIN = 0x00000000, LENGTH = 0x10000
1.23 sfrs : ORIGIN = 0xBF800000, LENGTH = 0x100000
1.24 configsfrs : ORIGIN = 0xBFC00BF0, LENGTH = 0x10
1.25 config3 : ORIGIN = 0xBFC00BF0, LENGTH = 0x4
1.26 @@ -27,17 +30,41 @@
1.27
1.28 SECTIONS
1.29 {
1.30 + /* Boot program. */
1.31 +
1.32 .boot : { *(.boot*) } > kseg0_boot_mem AT > physical_boot_mem
1.33 +
1.34 + /* Exception/interrupt vectors and general program code. */
1.35 +
1.36 .vectors : { *(.vectors*) } > kseg0_program_mem AT > physical_program_mem
1.37 .text : { *(.text*) } > kseg0_program_mem AT > physical_program_mem
1.38 - .bss : { *(.bss*) } > kseg1_data_mem
1.39 +
1.40 + /* Reserve space at the bottom of RAM for the IRQ stack. */
1.41 +
1.42 + .irqstack : {
1.43 + . += IRQ_STACK_SIZE;
1.44 + } > kseg0_data_mem AT > physical_data_mem
1.45 +
1.46 + /* Add other data after the IRQ stack. */
1.47 +
1.48 + .bss : { *(.bss*) } > kseg0_data_mem AT > physical_data_mem
1.49 + .data : { *(.data*) } > kseg0_data_mem AT > physical_data_mem
1.50 +
1.51 + /* Store constant data in program memory. */
1.52 +
1.53 .rodata : { *(.rodata*) } > kseg0_program_mem AT > physical_program_mem
1.54 .got : {
1.55 _gp = ALIGN(16);
1.56 *(.got*)
1.57 } > kseg0_program_mem AT > physical_program_mem
1.58 +
1.59 + /* Device configuration registers to be flashed. */
1.60 +
1.61 .devcfg0 : { *(.devcfg0) } > config0 AT > physical_config0
1.62 .devcfg1 : { *(.devcfg1) } > config1 AT > physical_config1
1.63 .devcfg2 : { *(.devcfg2) } > config2 AT > physical_config2
1.64 - /DISCARD/ : { *(.reginfo) *(.MIPS.abiflags) }
1.65 +
1.66 + /* Discard things that might overwrite useful data. */
1.67 +
1.68 + /DISCARD/ : { *(.reginfo) *(.MIPS.abiflags) *(.pdr) *(.gnu.attributes) *(.comment) }
1.69 }