Skip to content

Commit 537b364

Browse files
author
Deepika
committed
Resolve build/type cast errors
1 parent 462f339 commit 537b364

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

platform/mbed_retarget.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -918,22 +918,22 @@ __asm(".global __use_no_semihosting\n\t");
918918
#endif
919919

920920
#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[];
923923
#define ISR_STACK_START Image$$ARM_LIB_STACK$$ZI$$Base
924924
#define ISR_STACK_SIZE Image$$ARM_LIB_STACK$$ZI$$Length
925925
#endif
926926

927927
#if !defined(HEAP_START)
928928
// 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[];
930930
#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))
932932
#endif
933933

934-
#define HEAP_LIMIT (HEAP_START + HEAP_SIZE)
934+
#define HEAP_LIMIT ((uint32_t)((uint32_t)HEAP_START + (uint32_t)HEAP_SIZE))
935935

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)
937937
{
938938
uint32_t heap_base = (uint32_t)HEAP_START;
939939
struct __initial_stackheap r;
@@ -946,7 +946,7 @@ extern __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uin
946946
return r;
947947
}
948948

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);
950950

951951
extern "C" __value_in_regs struct __argc_argv $Sub$$__rt_lib_init(unsigned heapbase, unsigned heaptop)
952952
{
@@ -1243,10 +1243,10 @@ extern "C" WEAK void __cxa_pure_virtual(void)
12431243

12441244
#if !defined(HEAP_START)
12451245
/* 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
12501250
#else
12511251
#define HEAP_LIMIT ((uint32_t)(HEAP_START + HEAP_SIZE))
12521252
#endif
@@ -1258,17 +1258,16 @@ extern "C" int errno;
12581258
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
12591259
extern "C" WEAK caddr_t _sbrk(int incr)
12601260
{
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;
12641264

12651265
/* __HeapLimit is end of heap section */
1266-
if (new_heap >= (uint32_t) &HEAP_LIMIT) {
1266+
if (new_heap >= (unsigned char *) &HEAP_LIMIT) {
12671267
errno = ENOMEM;
12681268
return (caddr_t) -1;
12691269
}
12701270

1271-
heap = new_heap;
12721271
return (caddr_t) prev_heap;
12731272
}
12741273
#endif

rtos/TARGET_CORTEX/TOOLCHAIN_ARM_STD/mbed_boot_arm_std.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ __value_in_regs struct __argc_argv __rt_lib_init(unsigned heapbase, unsigned hea
2828
void _platform_post_stackheap_init(void);
2929

3030
#if !defined(ISR_STACK_START)
31-
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
32-
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
31+
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
32+
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
3333
#define ISR_STACK_START Image$$ARM_LIB_STACK$$ZI$$Base
3434
#define ISR_STACK_SIZE Image$$ARM_LIB_STACK$$ZI$$Length
3535
#endif
3636

3737
#if !defined(HEAP_START)
3838
// Heap here is considered starting after ZI ends to Stack start
39-
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
39+
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
4040
#define HEAP_START Image$$RW_IRAM1$$ZI$$Limit
41-
#define HEAP_SIZE ((uint32_t)(ISR_STACK_START - HEAP_START))
41+
#define HEAP_SIZE ((uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START))
4242
#endif
4343

4444
/*

rtos/TARGET_CORTEX/TOOLCHAIN_GCC_ARM/mbed_boot_gcc_arm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ static osMutexAttr_t env_mutex_attr;
3232
#if !defined(ISR_STACK_SIZE)
3333
extern uint32_t __StackLimit;
3434
extern uint32_t __StackTop;
35-
#define ISR_STACK_START (__StackLimit)
36-
#define ISR_STACK_SIZE ((uint32_t)(__StackTop - __StackLimit))
35+
#define ISR_STACK_START __StackLimit
36+
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)__StackTop - (uint32_t)__StackLimit))
3737
#endif
3838

3939
#if !defined(HEAP_START)
4040
/* Defined by linker script */
4141
extern uint32_t __end__;
4242
extern uint32_t __HeapLimit;
43-
#define HEAP_START (__end__)
44-
#define HEAP_LIMIT (__HeapLimit)
45-
#define HEAP_SIZE ((uint32_t)(HEAP_LIMIT - HEAP_START))
43+
#define HEAP_START __end__
44+
#define HEAP_LIMIT __HeapLimit
45+
#define HEAP_SIZE ((uint32_t)((uint32_t)HEAP_LIMIT - (uint32_t)HEAP_START))
4646
#endif
4747

4848
extern void __libc_init_array(void);
@@ -54,9 +54,9 @@ extern void __libc_init_array(void);
5454
*/
5555
void software_init_hook(void)
5656
{
57-
mbed_stack_isr_start = (unsigned char *) &ISR_STACK_START;
57+
mbed_stack_isr_start = (unsigned char *)ISR_STACK_START;
5858
mbed_stack_isr_size = (uint32_t) ISR_STACK_SIZE;
59-
mbed_heap_start = (unsigned char *) &HEAP_START;
59+
mbed_heap_start = (unsigned char *) HEAP_START;
6060
mbed_heap_size = (uint32_t) HEAP_SIZE;
6161

6262
mbed_init();

targets/TARGET_RENESAS/mbed_rtx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit[];
2626
extern uint32_t Image$$ARM_LIB_HEAP$$Base[];
2727
#define ISR_STACK_START Image$$ARM_LIB_STACK$$Base
28-
#define ISR_STACK_SIZE (uint32_t)(Image$$ARM_LIB_STACK$$ZI$$Limit - Image$$ARM_LIB_STACK$$Base)
28+
#define ISR_STACK_SIZE (uint32_t)((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Limit - (uint32_t)Image$$ARM_LIB_STACK$$Base)
2929
#define INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
3030
#define HEAP_START Image$$ARM_LIB_HEAP$$Base
31-
#define HEAP_SIZE (uint32_t)(ISR_STACK_START - HEAP_START)
31+
#define HEAP_SIZE (uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START)
3232
#elif defined(__GNUC__)
3333
#define INITIAL_SP (&__StackTop)
3434
#elif defined(__ICCARM__)

0 commit comments

Comments
 (0)