Skip to content

Commit fe3b80a

Browse files
authored
Merge pull request #2090 from jamike/fix#2089
Fix#2089
2 parents c034f48 + b73fd5e commit fe3b80a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

hal/targets/hal/TARGET_STM/TARGET_STM32F3/gpio_object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ typedef struct {
4444
PinName pin;
4545
uint32_t mask;
4646
__IO uint32_t *reg_in;
47-
__IO uint16_t *reg_set;
48-
__IO uint16_t *reg_clr;
47+
__IO uint32_t *reg_set;
48+
__IO uint32_t *reg_clr;
4949
} gpio_t;
5050

5151
static inline void gpio_write(gpio_t *obj, int value)

rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,14 +534,20 @@ extern uint32_t __end__[];
534534
#define HEAP_START (__end__)
535535
#elif defined(__ICCARM__)
536536
#pragma section="HEAP"
537-
#define HEAP_START (void *)__section_begin("HEAP")
537+
#define HEAP_END (void *)__section_end("HEAP")
538538
#endif
539539

540540
void set_main_stack(void) {
541541
uint32_t interrupt_stack_size = ((uint32_t)OS_MAINSTKSIZE * 4);
542+
#if defined(__ICCARM__)
543+
/* For IAR heap is defined .icf file */
544+
uint32_t main_stack_size = ((uint32_t)INITIAL_SP - (uint32_t)HEAP_END) - interrupt_stack_size;
545+
#else
546+
/* For ARM , uARM, or GCC_ARM , heap can grow and reach main stack */
542547
uint32_t heap_plus_stack_size = ((uint32_t)INITIAL_SP - (uint32_t)HEAP_START) - interrupt_stack_size;
543548
// Main thread's stack is 1/4 of the heap
544-
uint32_t main_stack_size = heap_plus_stack_size / 4;
549+
uint32_t main_stack_size = heap_plus_stack_size/4;
550+
#endif
545551
// The main thread must be 4 byte aligned
546552
uint32_t main_stack_start = ((uint32_t)INITIAL_SP - interrupt_stack_size - main_stack_size) & ~0x7;
547553

0 commit comments

Comments
 (0)