From e3018e766b5fc0f90924c6a9fa971e757b4e0502 Mon Sep 17 00:00:00 2001 From: fritzprix Date: Thu, 17 Jul 2014 23:37:11 +0900 Subject: [PATCH 1/3] - Add Default Heap Size --- .../TOOLCHAIN_GCC_ARM/startup_stm32f407xx.s | 35 +++++++++++++++++++ .../TOOLCHAIN_ARM_MICRO/startup_stm32f401xe.s | 2 +- .../TOOLCHAIN_ARM_STD/startup_stm32f401xe.s | 22 ++++++++++++ .../TOOLCHAIN_GCC_ARM/startup_STM32F40x.s | 2 +- .../TOOLCHAIN_IAR/stm32f401xe.icf | 2 +- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/TOOLCHAIN_GCC_ARM/startup_stm32f407xx.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/TOOLCHAIN_GCC_ARM/startup_stm32f407xx.s index d8b832c300..3a29ec9c6a 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/TOOLCHAIN_GCC_ARM/startup_stm32f407xx.s +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_DISCO_F407VG/TOOLCHAIN_GCC_ARM/startup_stm32f407xx.s @@ -72,6 +72,41 @@ defined in linker script */ * @param None * @retval : None */ + .section .stack + .align 3 +#ifdef __STACK_SIZE + .equ Stack_Size, __STACK_SIZE +#else + .equ Stack_Size, 0xc00 +#endif + .globl __StackTop + .globl __StackLimit +__StackLimit: + .space Stack_Size + .size __StackLimit, . - __StackLimit +__StackTop: + .size __StackTop, . - __StackTop + + .section .heap + .align 3 +#ifdef __HEAP_SIZE + .equ Heap_Size, __HEAP_SIZE +#else + .equ Heap_Size, 0x400 +#endif + .globl __HeapBase + .globl __HeapLimit +__HeapBase: + .if Heap_Size + .space Heap_Size + .endif + .size __HeapBase, . - __HeapBase +__HeapLimit: + .size __HeapLimit, . - __HeapLimit + + + + .section .text.Reset_Handler .weak Reset_Handler diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/startup_stm32f401xe.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/startup_stm32f401xe.s index d9887d3884..deb9839bdb 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/startup_stm32f401xe.s +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/startup_stm32f401xe.s @@ -58,7 +58,7 @@ __initial_sp EQU 0x20018000 ; Top of RAM ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; -Heap_Size EQU 0x00000000 +Heap_Size EQU 0x00000400 AREA HEAP, NOINIT, READWRITE, ALIGN=3 EXPORT __heap_base diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s index b065e7b128..05eec69385 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s @@ -39,7 +39,29 @@ ; ;******************************************************************************* +Stack_Size EQU 0x00000400 + + AREA STACK, NOINIT, READWRITE, ALIGN=3 + EXPORT __initial_sp + +Stack_Mem SPACE Stack_Size __initial_sp EQU 0x20018000 ; Top of RAM + + +; Heap Configuration +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; + +Heap_Size EQU 0x00000400 + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 + EXPORT __heap_base + EXPORT __heap_limit + +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + PRESERVE8 THUMB diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/startup_STM32F40x.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/startup_STM32F40x.s index 69dc569b68..6be60fb6d4 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/startup_STM32F40x.s +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/startup_STM32F40x.s @@ -52,7 +52,7 @@ __StackTop: #ifdef __HEAP_SIZE .equ Heap_Size, __HEAP_SIZE #else - .equ Heap_Size, 0 + .equ Heap_Size, 0x400 #endif .globl __HeapBase .globl __HeapLimit diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_IAR/stm32f401xe.icf b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_IAR/stm32f401xe.icf index ab50ed1edd..ea7540aeb6 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_IAR/stm32f401xe.icf +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_IAR/stm32f401xe.icf @@ -16,7 +16,7 @@ define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM /* Stack and Heap */ define symbol __size_cstack__ = 0x400; -define symbol __size_heap__ = 0x200; +define symbol __size_heap__ = 0x400; define block CSTACK with alignment = 8, size = __size_cstack__ { }; define block HEAP with alignment = 8, size = __size_heap__ { }; define block STACKHEAP with fixed order { block HEAP, block CSTACK }; From 8c7e738263783a14dc9dc9c120e27613bcd7b87d Mon Sep 17 00:00:00 2001 From: fritzprix Date: Thu, 17 Jul 2014 23:38:34 +0900 Subject: [PATCH 2/3] - fix some type mismatch which causes error in build time --- libraries/mbed/common/InterruptManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/mbed/common/InterruptManager.cpp b/libraries/mbed/common/InterruptManager.cpp index 6fe31f6531..59ce56b94d 100644 --- a/libraries/mbed/common/InterruptManager.cpp +++ b/libraries/mbed/common/InterruptManager.cpp @@ -7,7 +7,7 @@ namespace mbed { typedef void (*pvoidf)(void); -InterruptManager* InterruptManager::_instance = NULL; +InterruptManager* InterruptManager::_instance = (InterruptManager*)NULL; InterruptManager* InterruptManager::get() { if (NULL == _instance) @@ -25,7 +25,7 @@ void InterruptManager::destroy() { // is very likely to occur if (NULL != _instance) { delete _instance; - _instance = NULL; + _instance = (InterruptManager*)NULL; } } @@ -68,7 +68,7 @@ bool InterruptManager::remove_handler(pFunctionPointer_t handler, IRQn_Type irq) if (_chains[irq_pos]->size() == 1 && NULL != _chains[irq_pos]->get(0)->get_function()) { NVIC_SetVector(irq, (uint32_t)_chains[irq_pos]->get(0)->get_function()); delete _chains[irq_pos]; - _chains[irq_pos] = NULL; + _chains[irq_pos] = (CallChain*) NULL; } return true; } From d1fc90fd509554b377e159cd90b7c73e80e3a429 Mon Sep 17 00:00:00 2001 From: DooWoong Lee Date: Sat, 19 Jul 2014 00:00:55 +0900 Subject: [PATCH 3/3] Update startup_stm32f401xe.s revert new change into what it was previously --- .../TOOLCHAIN_ARM_STD/startup_stm32f401xe.s | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s index 05eec69385..caa62ac714 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/startup_stm32f401xe.s @@ -39,30 +39,9 @@ ; ;******************************************************************************* -Stack_Size EQU 0x00000400 - AREA STACK, NOINIT, READWRITE, ALIGN=3 - EXPORT __initial_sp - -Stack_Mem SPACE Stack_Size __initial_sp EQU 0x20018000 ; Top of RAM - -; Heap Configuration -; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> -; - -Heap_Size EQU 0x00000400 - - AREA HEAP, NOINIT, READWRITE, ALIGN=3 - EXPORT __heap_base - EXPORT __heap_limit - -__heap_base -Heap_Mem SPACE Heap_Size -__heap_limit - - PRESERVE8 THUMB