Add support for both LPC822 and LPC824 with different memory sizes
authorNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 1 Feb 2022 03:41:05 +0000 (04:41 +0100)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Fri, 10 Feb 2023 18:02:59 +0000 (19:02 +0100)
Makefile
lpc_link_lpc822.ld [new file with mode: 0644]
lpc_link_lpc824.ld [new file with mode: 0644]

index bf83415..4845b12 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 
 TARGET_DIR = apps/$(MODULE)/$(NAME)
 
-LPC = lpc82x
+LPC ?= lpc824
 CPU = cortex-m0
 ARCH = armv6-m
 
diff --git a/lpc_link_lpc822.ld b/lpc_link_lpc822.ld
new file mode 100644 (file)
index 0000000..794ab69
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * C linker script file for LPC822
+ */
+
+MEMORY
+{
+       sram (rwx) : ORIGIN = 0x10000000, LENGTH = 4k
+       flash (rx) : ORIGIN = 0x00000000, LENGTH = 16k
+}
+
+_sram_size = LENGTH(sram);
+_sram_base = ORIGIN(sram);
+_end_stack = (_sram_base + _sram_size);
+
+ENTRY(Reset_Handler)
+
+SECTIONS {
+       . = ORIGIN(flash);
+
+       .text :
+       {
+               FILL(0xFF);
+               KEEP(*(.vectors))
+               *(.text.Reset_Handler .text.SystemInit)
+               . = 0x000002FC;
+               KEEP(*(.crp))
+               . = 0x00000300;
+               *(.text*)
+               *(.rodata*)
+               *(.got*)
+               . = ALIGN(4);
+               _end_text = .;
+       } >flash
+
+       . = ALIGN(4);
+
+       .data :
+       {
+               _start_data = .;
+               *(.data*)
+               _end_data = .;
+       } >sram AT >flash
+
+       . = ALIGN(4);
+
+       .bss :
+       {
+               _start_bss = .;
+               *(.bss*)
+               *(COMMON)
+               _end_bss = .;
+       } >sram
+
+       . = ALIGN(4);
+
+}
+
+_end = .;
+PROVIDE(end = .);
diff --git a/lpc_link_lpc824.ld b/lpc_link_lpc824.ld
new file mode 100644 (file)
index 0000000..7daa67c
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * C linker script file for LPC824
+ */
+
+MEMORY
+{
+       sram (rwx) : ORIGIN = 0x10000000, LENGTH = 8k
+       flash (rx) : ORIGIN = 0x00000000, LENGTH = 32k
+}
+
+_sram_size = LENGTH(sram);
+_sram_base = ORIGIN(sram);
+_end_stack = (_sram_base + _sram_size);
+
+ENTRY(Reset_Handler)
+
+SECTIONS {
+       . = ORIGIN(flash);
+
+       .text :
+       {
+               FILL(0xFF);
+               KEEP(*(.vectors))
+               *(.text.Reset_Handler .text.SystemInit)
+               . = 0x000002FC;
+               KEEP(*(.crp))
+               . = 0x00000300;
+               *(.text*)
+               *(.rodata*)
+               *(.got*)
+               . = ALIGN(4);
+               _end_text = .;
+       } >flash
+
+       . = ALIGN(4);
+
+       .data :
+       {
+               _start_data = .;
+               *(.data*)
+               _end_data = .;
+       } >sram AT >flash
+
+       . = ALIGN(4);
+
+       .bss :
+       {
+               _start_bss = .;
+               *(.bss*)
+               *(COMMON)
+               _end_bss = .;
+       } >sram
+
+       . = ALIGN(4);
+
+}
+
+_end = .;
+PROVIDE(end = .);