From fcab0f2cb4830f8a1269fdbce9a789ffce566d0b Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sat, 4 Aug 2018 14:59:29 +0800 Subject: [PATCH] [BSP] Fix the compiling issue with GCC6 --- .../Libraries/startup/gcc/start_gcc.S | 15 +++++--------- bsp/lm3s8962/lm3s_rom.ld | 11 +++++++--- .../Libraries/startup/gcc/start_gcc.S | 15 +++++--------- bsp/lm3s9b9x/lm3s_rom.ld | 11 +++++++--- bsp/mb9bf500r/CMSIS/start_gcc.S | 20 +++++++------------ bsp/mb9bf500r/fm3_rom.ld | 11 +++++++--- 6 files changed, 41 insertions(+), 42 deletions(-) diff --git a/bsp/lm3s8962/Libraries/startup/gcc/start_gcc.S b/bsp/lm3s8962/Libraries/startup/gcc/start_gcc.S index 3a4abbe3c3..53d5471f5c 100644 --- a/bsp/lm3s8962/Libraries/startup/gcc/start_gcc.S +++ b/bsp/lm3s8962/Libraries/startup/gcc/start_gcc.S @@ -1,9 +1,4 @@ -.section .bss.init -.equ Stack_Size, 0x00000200 -.space Stack_Size -Initial_spTop: - - .syntax unified + .syntax unified .cpu cortex-m3 .fpu softvfp .thumb @@ -32,13 +27,13 @@ defined in linker script */ * @retval : None */ - .section .text.Reset_Handler + .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: /* restore original stack pointer */ - LDR r0, =Initial_spTop - MSR msp, r0 + ldr sp, =_estack /* set stack pointer */ + /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 b LoopCopyDataInit @@ -98,7 +93,7 @@ Infinite_Loop: g_pfnVectors: - .word Initial_spTop + .word _estack .word Reset_Handler .word Default_Handler //NMI_Handler .word HardFault_Handler diff --git a/bsp/lm3s8962/lm3s_rom.ld b/bsp/lm3s8962/lm3s_rom.ld index 5572ae4186..d4a2f968d0 100644 --- a/bsp/lm3s8962/lm3s_rom.ld +++ b/bsp/lm3s8962/lm3s_rom.ld @@ -10,6 +10,7 @@ MEMORY DATA (rw) : ORIGIN = 0x20000000, LENGTH = 0x00010000 } ENTRY(Reset_Handler) +_system_stack_size = 0x200; SECTIONS { @@ -72,6 +73,13 @@ SECTIONS _edata = . ; } >DATA + .stack : + { + . = . + _system_stack_size; + . = ALIGN(4); + _estack = .; + } >DATA + __bss_start = .; .bss : { @@ -85,9 +93,6 @@ SECTIONS . = ALIGN(4); /* This is used by the startup in order to initialize the .bss secion */ _ebss = . ; - _estack = .; - - *(.bss.init) } > DATA __bss_end = .; diff --git a/bsp/lm3s9b9x/Libraries/startup/gcc/start_gcc.S b/bsp/lm3s9b9x/Libraries/startup/gcc/start_gcc.S index 3a4abbe3c3..53d5471f5c 100644 --- a/bsp/lm3s9b9x/Libraries/startup/gcc/start_gcc.S +++ b/bsp/lm3s9b9x/Libraries/startup/gcc/start_gcc.S @@ -1,9 +1,4 @@ -.section .bss.init -.equ Stack_Size, 0x00000200 -.space Stack_Size -Initial_spTop: - - .syntax unified + .syntax unified .cpu cortex-m3 .fpu softvfp .thumb @@ -32,13 +27,13 @@ defined in linker script */ * @retval : None */ - .section .text.Reset_Handler + .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: /* restore original stack pointer */ - LDR r0, =Initial_spTop - MSR msp, r0 + ldr sp, =_estack /* set stack pointer */ + /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 b LoopCopyDataInit @@ -98,7 +93,7 @@ Infinite_Loop: g_pfnVectors: - .word Initial_spTop + .word _estack .word Reset_Handler .word Default_Handler //NMI_Handler .word HardFault_Handler diff --git a/bsp/lm3s9b9x/lm3s_rom.ld b/bsp/lm3s9b9x/lm3s_rom.ld index 5572ae4186..d4a2f968d0 100644 --- a/bsp/lm3s9b9x/lm3s_rom.ld +++ b/bsp/lm3s9b9x/lm3s_rom.ld @@ -10,6 +10,7 @@ MEMORY DATA (rw) : ORIGIN = 0x20000000, LENGTH = 0x00010000 } ENTRY(Reset_Handler) +_system_stack_size = 0x200; SECTIONS { @@ -72,6 +73,13 @@ SECTIONS _edata = . ; } >DATA + .stack : + { + . = . + _system_stack_size; + . = ALIGN(4); + _estack = .; + } >DATA + __bss_start = .; .bss : { @@ -85,9 +93,6 @@ SECTIONS . = ALIGN(4); /* This is used by the startup in order to initialize the .bss secion */ _ebss = . ; - _estack = .; - - *(.bss.init) } > DATA __bss_end = .; diff --git a/bsp/mb9bf500r/CMSIS/start_gcc.S b/bsp/mb9bf500r/CMSIS/start_gcc.S index 20a4e131f6..b1a93e52be 100644 --- a/bsp/mb9bf500r/CMSIS/start_gcc.S +++ b/bsp/mb9bf500r/CMSIS/start_gcc.S @@ -12,12 +12,7 @@ * 2011-07-01 lgnq first version */ -.section .bss.init -.equ Stack_Size, 0x00000200 -.space Stack_Size -Initial_spTop: - - .syntax unified + .syntax unified .cpu cortex-m3 .fpu softvfp .thumb @@ -48,13 +43,13 @@ defined in linker script */ * @retval : None */ - .section .text.Reset_Handler + .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: /* restore original stack pointer */ - LDR r0, =Initial_spTop - MSR msp, r0 + ldr sp, =_estack /* set stack pointer */ + /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 b LoopCopyDataInit @@ -107,13 +102,12 @@ Infinite_Loop: * 0x0000.0000. * ******************************************************************************/ - .section .isr_vector,"a",%progbits + .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors - - + g_pfnVectors: - .word Initial_spTop + .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler diff --git a/bsp/mb9bf500r/fm3_rom.ld b/bsp/mb9bf500r/fm3_rom.ld index 67f1a973b3..3d0151d23b 100644 --- a/bsp/mb9bf500r/fm3_rom.ld +++ b/bsp/mb9bf500r/fm3_rom.ld @@ -5,6 +5,7 @@ MEMORY DATA (rw) : ORIGIN = 0x1FFFC000, LENGTH = 0x0000C000 } ENTRY(Reset_Handler) +_system_stack_size = 0x200; SECTIONS { @@ -70,6 +71,13 @@ SECTIONS _edata = . ; } >DATA + .stack : + { + . = . + _system_stack_size; + . = ALIGN(4); + _estack = .; + } >DATA + __bss_start = .; .bss : { @@ -84,9 +92,6 @@ SECTIONS . = ALIGN(4); /* This is used by the startup in order to initialize the .bss secion */ _ebss = . ; - _estack = .; - - *(.bss.init) } > DATA __bss_end = .; -- GitLab