Skip to content

Commit 46003d4

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 0718c76 + 96101ae commit 46003d4

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

libraries/mbed/common/retarget.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,3 +425,30 @@ extern "C" void __iar_argc_argv() {
425425
mbed_main();
426426
}
427427
#endif
428+
429+
// Provide implementation of _sbrk (low-level dynamic memory allocation
430+
// routine) for GCC_ARM which compares new heap pointer with MSP instead of
431+
// SP. This make it compatible with RTX RTOS thread stacks.
432+
#if defined(TOOLCHAIN_GCC_ARM)
433+
// Linker defined symbol used by _sbrk to indicate where heap should start.
434+
extern "C" int __end__;
435+
436+
// Turn off the errno macro and use actual global variable instead.
437+
#undef errno
438+
extern "C" int errno;
439+
440+
// Dynamic memory allocation related syscall.
441+
extern "C" caddr_t _sbrk(int incr) {
442+
static unsigned char* heap = (unsigned char*)&__end__;
443+
unsigned char* prev_heap = heap;
444+
unsigned char* new_heap = heap + incr;
445+
446+
if (new_heap >= (unsigned char*)__get_MSP()) {
447+
errno = ENOMEM;
448+
return (caddr_t)-1;
449+
}
450+
451+
heap = new_heap;
452+
return (caddr_t) prev_heap;
453+
}
454+
#endif

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pwmout_api.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,28 @@ static const PinMap PinMap_PWM[] = {
3939
{D10, PWM_1 , 4}, // PTD0 , TPM0 CH0
4040
{D11, PWM_3 , 4}, // PTD2 , TPM0 CH2
4141
{D12, PWM_4 , 4}, // PTD3 , TPM0 CH3
42-
{D13, PWM_2 , 4}, // PTD1 , TPM0 CH1
42+
{D13, PWM_2 , 4}, // PTD1 , TPM0 CH1,
43+
44+
{PTA0, PWM_6, 3},
45+
{PTA3, PWM_1, 3},
46+
{PTB0, PWM_7, 3},
47+
{PTB1, PWM_8, 3},
48+
{PTB2, PWM_9, 3},
49+
{PTB3, PWM_10, 3},
50+
{PTC1, PWM_1, 4},
51+
{PTC2, PWM_2, 4},
52+
{PTC3, PWM_3, 4},
53+
{PTC4, PWM_4, 4},
54+
{PTE20, PWM_7, 3},
55+
{PTE21, PWM_8, 3},
56+
{PTE22, PWM_9, 3},
57+
{PTE23, PWM_10, 3},
58+
{PTE24, PWM_1, 3},
59+
{PTE25, PWM_2, 3},
60+
{PTE29, PWM_3, 3},
61+
{PTE30, PWM_4, 3},
62+
{PTE31, PWM_5, 3},
63+
4364
{NC , NC , 0}
4465
};
4566

0 commit comments

Comments
 (0)