@@ -35,7 +35,7 @@ extern "C" {
3535#define MG_ARCH_FREERTOS 5 // FreeRTOS
3636#define MG_ARCH_THREADX 6 // Eclipse ThreadX (former MS Azure RTOS)
3737#define MG_ARCH_ZEPHYR 7 // Zephyr RTOS
38- #define MG_ARCH_NEWLIB 8 // Bare metal ARM
38+ #define MG_ARCH_ARMGCC 8 // Plain ARM GCC
3939#define MG_ARCH_CMSIS_RTOS1 9 // CMSIS-RTOS API v1 (Keil RTX)
4040#define MG_ARCH_TIRTOS 10 // Texas Semi TI-RTOS
4141#define MG_ARCH_PICOSDK 11 // Raspberry Pi Pico-SDK (RP2040, RP2350)
@@ -44,6 +44,8 @@ extern "C" {
4444#define MG_ARCH_RTTHREAD 14 // RT-Thread RTOS
4545#define MG_ARCH_ARMCGT 15 // Texas Semi ARM-CGT
4646
47+ #define MG_ARCH_NEWLIB MG_ARCH_ARMGCC // Alias, deprecate in 2025
48+
4749#if !defined(MG_ARCH)
4850#if defined(__unix__) || defined(__APPLE__)
4951#define MG_ARCH MG_ARCH_UNIX
@@ -97,6 +99,29 @@ extern "C" {
9799#endif
98100
99101
102+ #if MG_ARCH == MG_ARCH_ARMGCC
103+ #define _POSIX_TIMERS
104+
105+ #include < ctype.h>
106+ #include < errno.h>
107+ #include < stdarg.h>
108+ #include < stdbool.h>
109+ #include < stdio.h>
110+ #include < stdlib.h>
111+ #include < string.h>
112+ #include < sys/stat.h>
113+ #include < sys/time.h>
114+ #include < sys/types.h>
115+ #include < time.h>
116+ #include < unistd.h>
117+
118+ #define MG_PATH_MAX 100
119+ #define MG_ENABLE_SOCKET 0
120+ #define MG_ENABLE_DIRLIST 0
121+
122+ #endif
123+
124+
100125#if MG_ARCH == MG_ARCH_ESP32
101126
102127#include < ctype.h>
@@ -206,29 +231,6 @@ static inline int mg_mkdir(const char *path, mode_t mode) {
206231#endif // MG_ARCH == MG_ARCH_FREERTOS
207232
208233
209- #if MG_ARCH == MG_ARCH_NEWLIB
210- #define _POSIX_TIMERS
211-
212- #include < ctype.h>
213- #include < errno.h>
214- #include < stdarg.h>
215- #include < stdbool.h>
216- #include < stdio.h>
217- #include < stdlib.h>
218- #include < string.h>
219- #include < sys/stat.h>
220- #include < sys/time.h>
221- #include < sys/types.h>
222- #include < time.h>
223- #include < unistd.h>
224-
225- #define MG_PATH_MAX 100
226- #define MG_ENABLE_SOCKET 0
227- #define MG_ENABLE_DIRLIST 0
228-
229- #endif
230-
231-
232234#if MG_ARCH == MG_ARCH_PICOSDK
233235#if !defined(MG_ENABLE_LWIP) || !MG_ENABLE_LWIP
234236#include < errno.h>
@@ -622,8 +624,8 @@ typedef int socklen_t;
622624
623625#if MG_ARCH == MG_ARCH_ZEPHYR
624626
625- #include < zephyr/version.h>
626627#include < zephyr/kernel.h>
628+ #include < zephyr/version.h>
627629
628630#include < ctype.h>
629631#include < errno.h>
0 commit comments