From 515f1318f5005cd8c948ad246609f4b683463f5f Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Tue, 1 Feb 2022 04:41:05 +0100 Subject: [PATCH] Add support for both LPC822 and LPC824 with different memory sizes --- Makefile | 2 +- lpc_link_lpc822.ld | 59 ++++++++++++++++++++++++++++++++++++++++++++++ lpc_link_lpc824.ld | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 lpc_link_lpc822.ld create mode 100644 lpc_link_lpc824.ld diff --git a/Makefile b/Makefile index bf83415..4845b12 100644 --- 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 index 0000000..794ab69 --- /dev/null +++ b/lpc_link_lpc822.ld @@ -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 index 0000000..7daa67c --- /dev/null +++ b/lpc_link_lpc824.ld @@ -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 = .); -- 2.43.0