@@ -918,22 +918,22 @@ __asm(".global __use_no_semihosting\n\t");
918
918
#endif
919
919
920
920
#if !defined(ISR_STACK_START)
921
- extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
922
- extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
921
+ extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
922
+ extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
923
923
#define ISR_STACK_START Image$$ARM_LIB_STACK$$ZI$$Base
924
924
#define ISR_STACK_SIZE Image$$ARM_LIB_STACK$$ZI$$Length
925
925
#endif
926
926
927
927
#if !defined(HEAP_START)
928
928
// Heap here is considered starting after ZI ends to Stack start
929
- extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
929
+ extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
930
930
#define HEAP_START Image$$RW_IRAM1$$ZI$$Limit
931
- #define HEAP_SIZE ((uint32_t )(ISR_STACK_START - HEAP_START))
931
+ #define HEAP_SIZE ((uint32_t )(( uint32_t ) ISR_STACK_START - ( uint32_t ) HEAP_START))
932
932
#endif
933
933
934
- #define HEAP_LIMIT (HEAP_START + HEAP_SIZE)
934
+ #define HEAP_LIMIT (( uint32_t )(( uint32_t ) HEAP_START + ( uint32_t ) HEAP_SIZE) )
935
935
936
- extern __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap (uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
936
+ extern " C " MBED_WEAK __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap (uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
937
937
{
938
938
uint32_t heap_base = (uint32_t )HEAP_START;
939
939
struct __initial_stackheap r;
@@ -946,7 +946,7 @@ extern __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uin
946
946
return r;
947
947
}
948
948
949
- extern " C" extern __value_in_regs struct __argc_argv $Super$$__rt_lib_init(unsigned heapbase, unsigned heaptop);
949
+ extern " C" __value_in_regs struct __argc_argv $Super$$__rt_lib_init(unsigned heapbase, unsigned heaptop);
950
950
951
951
extern " C" __value_in_regs struct __argc_argv $Sub$$__rt_lib_init(unsigned heapbase, unsigned heaptop)
952
952
{
@@ -1243,10 +1243,10 @@ extern "C" WEAK void __cxa_pure_virtual(void)
1243
1243
1244
1244
#if !defined(HEAP_START)
1245
1245
/* Defined by linker script */
1246
- extern uint32_t __end__;
1247
- extern uint32_t __HeapLimit;
1248
- #define HEAP_START ( __end__)
1249
- #define HEAP_LIMIT ( __HeapLimit)
1246
+ extern " C " uint32_t __end__;
1247
+ extern " C " uint32_t __HeapLimit;
1248
+ #define HEAP_START __end__
1249
+ #define HEAP_LIMIT __HeapLimit
1250
1250
#else
1251
1251
#define HEAP_LIMIT ((uint32_t )(HEAP_START + HEAP_SIZE))
1252
1252
#endif
@@ -1258,17 +1258,16 @@ extern "C" int errno;
1258
1258
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
1259
1259
extern " C" WEAK caddr_t _sbrk (int incr)
1260
1260
{
1261
- static uint32_t heap = (uint32_t ) &HEAP_START;
1262
- uint32_t prev_heap = heap;
1263
- uint32_t new_heap = heap + incr;
1261
+ static unsigned char * heap = (unsigned char * ) &HEAP_START;
1262
+ unsigned char * prev_heap = heap;
1263
+ unsigned char * new_heap = heap + incr;
1264
1264
1265
1265
/* __HeapLimit is end of heap section */
1266
- if (new_heap >= (uint32_t ) &HEAP_LIMIT) {
1266
+ if (new_heap >= (unsigned char * ) &HEAP_LIMIT) {
1267
1267
errno = ENOMEM;
1268
1268
return (caddr_t ) -1 ;
1269
1269
}
1270
1270
1271
- heap = new_heap;
1272
1271
return (caddr_t ) prev_heap;
1273
1272
}
1274
1273
#endif
0 commit comments