summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYilin Sun <[email protected]>2024-02-06 08:41:10 +0800
committerMeco Man <[email protected]>2024-02-07 21:57:28 -0500
commit4570a9047ddc30ec9e694a3273b1589f9a506b13 (patch)
tree644e5ce55df5bcee772941042e438f35a243112b
parent7be9ae16b34cf4a4e0676d4c1bffdc66a78aa827 (diff)
[bsp][lpc55sxx] GNU toolchain: fix broken port.
1 - The current linker flags undefines `Reset_Handler' and uses `entry()' as default entry point (specified by `-e'), which will cause a invalid reset vector in the image without proper crt0 init assembly routine. 2 - The default startup files provided by NXP violate the crt0 assumption that bss section will be filled with zero unless macro `__STARTUP_CLEAR_BSS' is defined. This will cause RTT hook funtion pointers set to non-NULL values at kernel start, thus successfully passes the `RT_nnnn_HOOK_CALL` checks and jumps to an invalid pointer. 3 - The default heap size used by TCB and kernel objects are set by linker file macros, which is 0x400 (1024 bytes). The size is too small for main task and the allocation will fail before the first task being created. This patch restores Reset_Handler as default reset vector and executes entry by replacing __START from newlib, defines the `__STARTUP_CLEAR_BSS` macro to forcibly zeroize the bss section to avoid unexpected hard faults, set proper heap sizes based on the SRAM sizes. Some unused compiler/linker flags are also removed or replaced to avoid future confusion. The heap sizes for different devices are: * LPC55(S)69/LPC55(S)28: 64kB * LPC55(S)06/LPC55(S)16/LPC55(S)36: 32kB Signed-off-by: Yilin Sun <[email protected]>
-rw-r--r--bsp/lpc55sxx/lpc55s06_nxp_evk/rtconfig.py8
-rw-r--r--bsp/lpc55sxx/lpc55s16_nxp_evk/rtconfig.py8
-rw-r--r--bsp/lpc55sxx/lpc55s28_nxp_evk/rtconfig.py8
-rw-r--r--bsp/lpc55sxx/lpc55s36_nxp_evk/rtconfig.py8
-rw-r--r--bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py8
5 files changed, 20 insertions, 20 deletions
diff --git a/bsp/lpc55sxx/lpc55s06_nxp_evk/rtconfig.py b/bsp/lpc55sxx/lpc55s06_nxp_evk/rtconfig.py
index 4f7c9654a1..c3d401d9f9 100644
--- a/bsp/lpc55sxx/lpc55s06_nxp_evk/rtconfig.py
+++ b/bsp/lpc55sxx/lpc55s06_nxp_evk/rtconfig.py
@@ -44,10 +44,10 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
STRIP = PREFIX + 'strip'
- DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S06JBD64'
- CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT -eentry'
- AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -D__START=entry'
- LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/LPC55S06_flash.ld'
+ DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S06JBD64'
+ CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__START=entry -D__STARTUP_CLEAR_BSS'
+ LFLAGS = DEVICE + ' -specs=nano.specs -specs=nosys.specs -Wl,--defsym=__heap_size__=0x8000,--gc-sections,-Map=rtthread.map,--print-memory-usage -Tboard/linker_scripts/LPC55S06_flash.ld'
CPATH = ''
LPATH = ''
diff --git a/bsp/lpc55sxx/lpc55s16_nxp_evk/rtconfig.py b/bsp/lpc55sxx/lpc55s16_nxp_evk/rtconfig.py
index 059245f3a2..98fa3dcaf6 100644
--- a/bsp/lpc55sxx/lpc55s16_nxp_evk/rtconfig.py
+++ b/bsp/lpc55sxx/lpc55s16_nxp_evk/rtconfig.py
@@ -44,10 +44,10 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
STRIP = PREFIX + 'strip'
- DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S16JBD100'
- CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT -eentry'
- AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -D__START=entry'
- LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/LPC55S16_flash.ld'
+ DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S16JBD100'
+ CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__START=entry -D__STARTUP_CLEAR_BSS'
+ LFLAGS = DEVICE + ' -specs=nano.specs -specs=nosys.specs -Wl,--defsym=__heap_size__=0x8000,--gc-sections,-Map=rtthread.map,--print-memory-usage -Tboard/linker_scripts/LPC55S16_flash.ld'
CPATH = ''
LPATH = ''
diff --git a/bsp/lpc55sxx/lpc55s28_nxp_evk/rtconfig.py b/bsp/lpc55sxx/lpc55s28_nxp_evk/rtconfig.py
index ab70291753..8d275e415a 100644
--- a/bsp/lpc55sxx/lpc55s28_nxp_evk/rtconfig.py
+++ b/bsp/lpc55sxx/lpc55s28_nxp_evk/rtconfig.py
@@ -44,10 +44,10 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
STRIP = PREFIX + 'strip'
- DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S28JBD100'
- CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT -eentry'
- AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -D__START=entry'
- LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/LPC55S28_flash.ld'
+ DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S28JBD100'
+ CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__START=entry -D__STARTUP_CLEAR_BSS'
+ LFLAGS = DEVICE + ' -specs=nano.specs -specs=nosys.specs -Wl,--defsym=__heap_size__=0x10000,--gc-sections,-Map=rtthread.map,--print-memory-usage -Tboard/linker_scripts/LPC55S28_flash.ld'
CPATH = ''
LPATH = ''
diff --git a/bsp/lpc55sxx/lpc55s36_nxp_evk/rtconfig.py b/bsp/lpc55sxx/lpc55s36_nxp_evk/rtconfig.py
index 80a288917b..c40fad0629 100644
--- a/bsp/lpc55sxx/lpc55s36_nxp_evk/rtconfig.py
+++ b/bsp/lpc55sxx/lpc55s36_nxp_evk/rtconfig.py
@@ -44,10 +44,10 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
STRIP = PREFIX + 'strip'
- DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S36JBD100'
- CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT -eentry'
- AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -D__START=entry'
- LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/LPC55S36_flash.ld'
+ DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S36JBD100'
+ CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__START=entry -D__STARTUP_CLEAR_BSS'
+ LFLAGS = DEVICE + ' -specs=nano.specs -specs=nosys.specs -Wl,--defsym=__heap_size__=0x8000,--gc-sections,-Map=rtthread.map,--print-memory-usage -Tboard/linker_scripts/LPC55S36_flash.ld'
CPATH = ''
LPATH = ''
diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py
index d26e34f59b..2ce1f00d14 100644
--- a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py
+++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py
@@ -44,10 +44,10 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
STRIP = PREFIX + 'strip'
- DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT -eentry'
- AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -D__START=entry'
- LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/LPC55S69_cm33_core0_flash.ld'
+ DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -DCPU_LPC55S69JBD100 -DCPU_LPC55S69JBD100_cm33_core0'
+ CFLAGS = DEVICE + ' -Wall -D__FPU_PRESENT'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__START=entry -D__STARTUP_CLEAR_BSS'
+ LFLAGS = DEVICE + ' -specs=nano.specs -specs=nosys.specs -Wl,--defsym=__heap_size__=0x10000,--gc-sections,-Map=rtthread.map,--print-memory-usage -Tboard/linker_scripts/LPC55S69_cm33_core0_flash.ld'
CPATH = ''
LPATH = ''