@@ -1464,6 +1464,10 @@ extern "C" WEAK void __cxa_pure_virtual(void)
1464
1464
// SP. This make it compatible with RTX RTOS thread stacks.
1465
1465
#if defined(TOOLCHAIN_GCC_ARM)
1466
1466
1467
+ // Turn off the errno macro and use actual global variable instead.
1468
+ #undef errno
1469
+ extern " C" int errno;
1470
+
1467
1471
#if defined(MBED_SPLIT_HEAP)
1468
1472
1469
1473
// Default RAM memory used for heap
@@ -1506,10 +1510,6 @@ extern "C" WEAK caddr_t _sbrk(int incr)
1506
1510
extern " C" uint32_t __end__;
1507
1511
extern " C" uint32_t __HeapLimit;
1508
1512
1509
- // Turn off the errno macro and use actual global variable instead.
1510
- #undef errno
1511
- extern " C" int errno;
1512
-
1513
1513
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
1514
1514
extern " C" WEAK caddr_t _sbrk (int incr)
1515
1515
{
@@ -1529,6 +1529,27 @@ extern "C" WEAK caddr_t _sbrk(int incr)
1529
1529
#endif
1530
1530
#endif
1531
1531
1532
+ #if defined(TOOLCHAIN_GCC_ARM)
1533
+
1534
+ // Implementation of getpid for Newlib, following signature here:
1535
+ // https://github.com/bminor/newlib/blob/55485616ba2afedca05da40f5cde59ee336b9f28/newlib/libc/sys/arm/syscalls.c#L32
1536
+ extern " C" pid_t _getpid ()
1537
+ {
1538
+ // Since PIDs aren't a thing on embedded, just return 0
1539
+ return 0 ;
1540
+ }
1541
+
1542
+ // Implementation of kill for Newlib, following signature here:
1543
+ // https://github.com/bminor/newlib/blob/55485616ba2afedca05da40f5cde59ee336b9f28/newlib/libc/sys/arm/syscalls.c#L33
1544
+ extern " C" int _kill (int pid, int signal)
1545
+ {
1546
+ // Always return error
1547
+ errno = ENOSYS;
1548
+ return -1 ;
1549
+ }
1550
+
1551
+ #endif
1552
+
1532
1553
#if defined(TOOLCHAIN_GCC_ARM)
1533
1554
extern " C" void _exit (int return_code)
1534
1555
{
0 commit comments