From f9278431c52584cce5bae70eb6a441f9cbeb4385 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sun, 2 Jun 2024 08:21:28 -0500 Subject: [PATCH] fix(CMSIS): Declare libc function stubs as weak Declares _getpid() and _kill() function stubs as weak to avoid conflicting with similar function stubs defined in zephyr libc-hooks. This fixes linker errors when building zephyr with newlib on max32 boards. Signed-off-by: Maureen Helm --- .../CMSIS/Device/Maxim/MAX32520/Source/system_max32520.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32570/Source/system_max32570.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32572/Source/system_max32572.c | 4 ++-- .../Device/Maxim/MAX32572/Source/system_riscv_max32572.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32650/Source/system_max32650.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32655/Source/system_max32655.c | 4 ++-- .../Device/Maxim/MAX32655/Source/system_riscv_max32655.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32657/Source/system_max32657.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32660/Source/system_max32660.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32662/Source/system_max32662.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32670/Source/system_max32670.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32672/Source/system_max32672.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32675/Source/system_max32675.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32680/Source/system_max32680.c | 4 ++-- .../Device/Maxim/MAX32680/Source/system_riscv_max32680.c | 4 ++-- .../CMSIS/Device/Maxim/MAX32690/Source/system_max32690.c | 4 ++-- .../Device/Maxim/MAX32690/Source/system_riscv_max32690.c | 4 ++-- .../CMSIS/Device/Maxim/MAX78000/Source/system_max78000.c | 4 ++-- .../Device/Maxim/MAX78000/Source/system_riscv_max78000.c | 4 ++-- .../CMSIS/Device/Maxim/MAX78002/Source/system_max78002.c | 4 ++-- .../Device/Maxim/MAX78002/Source/system_riscv_max78002.c | 4 ++-- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Libraries/CMSIS/Device/Maxim/MAX32520/Source/system_max32520.c b/Libraries/CMSIS/Device/Maxim/MAX32520/Source/system_max32520.c index 4fdbbe9bca7..4f98ee0c34a 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32520/Source/system_max32520.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32520/Source/system_max32520.c @@ -39,12 +39,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32570/Source/system_max32570.c b/Libraries/CMSIS/Device/Maxim/MAX32570/Source/system_max32570.c index 8c0fc6d125d..d437a2f9890 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32570/Source/system_max32570.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32570/Source/system_max32570.c @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_max32572.c b/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_max32572.c index 13d09951ed1..c14d69d15c0 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_max32572.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_max32572.c @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_riscv_max32572.c b/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_riscv_max32572.c index b922ac0d4d6..6d51ac0a79e 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_riscv_max32572.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_riscv_max32572.c @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32650/Source/system_max32650.c b/Libraries/CMSIS/Device/Maxim/MAX32650/Source/system_max32650.c index 567c6ca19d7..0cb9e4191b6 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32650/Source/system_max32650.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32650/Source/system_max32650.c @@ -38,12 +38,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_max32655.c b/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_max32655.c index d269e39c513..c735e55dd17 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_max32655.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_max32655.c @@ -37,12 +37,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_riscv_max32655.c b/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_riscv_max32655.c index 58f4f77d3f4..c9d37353235 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_riscv_max32655.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_riscv_max32655.c @@ -38,12 +38,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32657/Source/system_max32657.c b/Libraries/CMSIS/Device/Maxim/MAX32657/Source/system_max32657.c index 417f887b2ab..ac9719da57d 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32657/Source/system_max32657.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32657/Source/system_max32657.c @@ -35,12 +35,12 @@ uint32_t SystemCoreClock = IPO_FREQ; // Part defaults to IPO on startup There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32660/Source/system_max32660.c b/Libraries/CMSIS/Device/Maxim/MAX32660/Source/system_max32660.c index bb818302ff5..024c30fefa1 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32660/Source/system_max32660.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32660/Source/system_max32660.c @@ -41,12 +41,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32662/Source/system_max32662.c b/Libraries/CMSIS/Device/Maxim/MAX32662/Source/system_max32662.c index 1d0fcd037d4..29e5c8b94b6 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32662/Source/system_max32662.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32662/Source/system_max32662.c @@ -40,12 +40,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c b/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c index a7e5bb1411c..2729e992edd 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c @@ -43,12 +43,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32670/Source/system_max32670.c b/Libraries/CMSIS/Device/Maxim/MAX32670/Source/system_max32670.c index 7b8b644d6c2..b7951e511a4 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32670/Source/system_max32670.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32670/Source/system_max32670.c @@ -37,12 +37,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32672/Source/system_max32672.c b/Libraries/CMSIS/Device/Maxim/MAX32672/Source/system_max32672.c index fbe7fc3b453..67a1c371c62 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32672/Source/system_max32672.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32672/Source/system_max32672.c @@ -35,12 +35,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32675/Source/system_max32675.c b/Libraries/CMSIS/Device/Maxim/MAX32675/Source/system_max32675.c index 190e2b21852..ce9f218b571 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32675/Source/system_max32675.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32675/Source/system_max32675.c @@ -37,12 +37,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_max32680.c b/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_max32680.c index 33191b596dd..b3395119eef 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_max32680.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_max32680.c @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_riscv_max32680.c b/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_riscv_max32680.c index b5528022bf3..b0296209e64 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_riscv_max32680.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32680/Source/system_riscv_max32680.c @@ -38,12 +38,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_max32690.c b/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_max32690.c index 08c66bc3094..f51599c5bc9 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_max32690.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_max32690.c @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_riscv_max32690.c b/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_riscv_max32690.c index e4787f588bb..cf40e1d0033 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_riscv_max32690.c +++ b/Libraries/CMSIS/Device/Maxim/MAX32690/Source/system_riscv_max32690.c @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_max78000.c b/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_max78000.c index 2b05de216cc..4c5c1dc564b 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_max78000.c +++ b/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_max78000.c @@ -36,12 +36,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_riscv_max78000.c b/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_riscv_max78000.c index b706dafca0b..c54653cb329 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_riscv_max78000.c +++ b/Libraries/CMSIS/Device/Maxim/MAX78000/Source/system_riscv_max78000.c @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_max78002.c b/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_max78002.c index 1f153a3bd0b..d6cbd2fcbbf 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_max78002.c +++ b/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_max78002.c @@ -35,12 +35,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; } diff --git a/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_riscv_max78002.c b/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_riscv_max78002.c index ba04dec793d..14a8fdc39ae 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_riscv_max78002.c +++ b/Libraries/CMSIS/Device/Maxim/MAX78002/Source/system_riscv_max78002.c @@ -33,12 +33,12 @@ The libc implementation from GCC 11+ depends on _getpid and _kill in some places There is no concept of processes/PIDs in the baremetal PeriphDrivers, therefore we implement stub functions that return an error code to resolve linker warnings. */ -int _getpid(void) +__weak int _getpid(void) { return E_NOT_SUPPORTED; } -int _kill(void) +__weak int _kill(void) { return E_NOT_SUPPORTED; }