Skip to content

Commit 51a1a6d

Browse files
committed
use __ZEPHYR__
1 parent 3b271ca commit 51a1a6d

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

build/devices/zephyr/config/CMakeLists.txt.prefix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ list(APPEND mOBJECTS $ENV{MODDABLE}/xs/sources/xsdtoa.c)
6565
list(APPEND mOBJECTS $ENV{MODDABLE}/xs/sources/xsmc.c)
6666
list(APPEND mOBJECTS $ENV{MODDABLE}/xs/sources/xsre.c)
6767

68-
list(APPEND mFLAGS "-D_ZEPHYR=1")
6968
list(APPEND mFLAGS "-DmxUseDefaultSharedChunks=1")
7069
list(APPEND mFLAGS "-DkPocoRotation=0")
7170
list(APPEND mFLAGS "-DkPocoFrameBuffer=1")

modules/base/instrumentation/modInstrumentation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define kModInstrumentationHasSPIFlashErases 1
3131
#endif
3232

33-
#if nrf52 || PICO_BUILD || defined(__ets__) || ESP32 || _ZEPHYR
33+
#if nrf52 || PICO_BUILD || defined(__ets__) || ESP32 || __ZEPHYR__
3434
#define kModInstrumentationHasTurns 1
3535
#endif
3636

modules/io/common/builtinCommon.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
SOC_GPIO_VALID_GPIO_MASK >> 32
3737
#endif
3838
};
39-
#elif defined(__ets__) && !defined(_ZEPHYR)
39+
#elif defined(__ets__) && !defined(__ZEPHYR__)
4040
static uint32_t gDigitalAvailable[kPinBanks] = {
4141
(1 << 0) |
4242
(1 << 1) |
@@ -68,7 +68,7 @@
6868
0x00000000 //@@
6969
#endif
7070
};
71-
#elif _ZEPHYR
71+
#elif __ZEPHYR__
7272
static uint8_t builtinInitialized = 0;
7373
static uint32_t gDigitalAvailable[kPinBanks];
7474
#endif
@@ -215,7 +215,7 @@ void builtinInitIO()
215215
builtinInitialized = 1;
216216
}
217217
}
218-
#elif defined(_ZEPHYR)
218+
#elif defined(__ZEPHYR__)
219219
void builtinInitIO()
220220
{
221221
if (!builtinInitialized) {

modules/io/common/builtinCommon.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
xsUnknownError("no network"); \
4242
}
4343
#endif
44-
#elif defined(__ets__) && !defined(_ZEPHYR)
44+
#elif defined(__ets__) && !defined(__ZEPHYR__)
4545
#include "Arduino.h" // mostly to get xs_rsil
4646

4747
#define kPinBanks (1)
@@ -61,7 +61,7 @@
6161
extern critical_section_t gCommonCriticalMux;
6262
#define builtinCriticalSectionBegin() critical_section_enter_blocking(&gCommonCriticalMux)
6363
#define builtinCriticalSectionEnd() critical_section_exit(&gCommonCriticalMux)
64-
#elif defined(_ZEPHYR)
64+
#elif defined(__ZEPHYR__)
6565
#include "mc.devicetree.h"
6666

6767
#define kPinBanks kModZephyrGPIOBankCount
@@ -127,7 +127,7 @@ xsSlot *builtinGetCallback(xsMachine *the, xsIdentifier id);
127127
#define builtinGetPin(the, slot) builtinGetUnsignedInteger(the, slot)
128128
#endif
129129

130-
#if defined(PICO_BUILD) || defined(_ZEPHYR)
130+
#if defined(PICO_BUILD) || defined(__ZEPHYR__)
131131
void builtinInitIO(void);
132132
#endif
133133

modules/io/system/system.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "builtinCommon.h"
2626

27-
#if defined(__ets__) && !ESP32 && !defined(_ZEPHYR)
27+
#if defined(__ets__) && !ESP32 && !defined(__ZEPHYR__)
2828
extern void system_deep_sleep_instant(uint32_t time_in_us);
2929

3030
static void deepSleepDeliver(void *notThe, void *refcon, uint8_t *message, uint16_t messageLength)
@@ -35,7 +35,7 @@ static void deepSleepDeliver(void *notThe, void *refcon, uint8_t *message, uint1
3535

3636
void xs_system_deepSleep(xsMachine *the)
3737
{
38-
#if defined(__ets__) && !ESP32 && !defined(_ZEPHYR)
38+
#if defined(__ets__) && !ESP32 && !defined(__ZEPHYR__)
3939
uint32_t us = 0;
4040

4141
if (xsmcArgc) {
@@ -53,7 +53,7 @@ void xs_system_restart(xsMachine *the)
5353
{
5454
#if ESP32
5555
esp_restart();
56-
#elif defined(__ets__) && !defined(_ZEPHYR)
56+
#elif defined(__ets__) && !defined(__ZEPHYR__)
5757
system_restart();
5858
#elif defined(PICO_BUILD)
5959
pico_reset();
@@ -66,7 +66,7 @@ void xs_system_restart(xsMachine *the)
6666
/*
6767
adapted from modResolve.c
6868
*/
69-
#if ESP32 || (defined(__ets__) && !defined(_ZEPHYR)) || CYW43_LWIP
69+
#if ESP32 || (defined(__ets__) && !defined(__ZEPHYR__)) || CYW43_LWIP
7070
#include "lwip/tcp.h"
7171

7272
typedef struct xsNetResolveRecord xsNetResolveRecord;

tools/test262/_262.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
#define fxUnlockMutex(MUTEX) LeaveCriticalSection(MUTEX)
9292
#define fxSleepCondition(CONDITION,MUTEX) SleepConditionVariableCS(CONDITION,MUTEX,INFINITE)
9393
#define fxWakeCondition(CONDITION) WakeConditionVariable(CONDITION)
94-
#elif _ZEPHYR
94+
#elif __ZEPHYR__
9595

9696
typedef uint32_t txCondition;
9797
typedef void *txMutex;
@@ -394,7 +394,7 @@ void _262_agent_broadcast(txMachine* the)
394394
gxAgentCluster.dataValue = xsToInteger(xsArg(1));
395395
#if mxWindows
396396
WakeAllConditionVariable(&(gxAgentCluster.dataCondition));
397-
#elif PICO_BUILD || _ZEPHYR
397+
#elif PICO_BUILD || __ZEPHYR__
398398
#else
399399
pthread_cond_broadcast(&(gxAgentCluster.dataCondition));
400400
#endif
@@ -481,7 +481,7 @@ void _262_agent_sleep(txMachine* the)
481481
xsIntegerValue delay = xsToInteger(xsArg(0));
482482
#ifdef mxUseFreeRTOSTasks
483483
vTaskDelay(pdMS_TO_TICKS(delay));
484-
#elif PICO_BUILD || _ZEPHYR
484+
#elif PICO_BUILD || __ZEPHYR__
485485
modDelayMilliseconds(delay);
486486
#elif mxWindows
487487
Sleep(delay);
@@ -514,7 +514,7 @@ void _262_agent_start(txMachine* the)
514514
xTaskCreate(_262_agent_start_aux, "agent", kStack, agent, 8, &(agent->thread));
515515
#elif mxWindows
516516
agent->thread = (HANDLE)_beginthreadex(NULL, 0, _262_agent_start_aux, agent, 0, NULL);
517-
#elif PICO_BUILD || _ZEPHYR
517+
#elif PICO_BUILD || __ZEPHYR__
518518
_262_agent_start_aux(agent);
519519
#else
520520
pthread_create(&(agent->thread), NULL, &_262_agent_start_aux, agent);
@@ -601,7 +601,7 @@ void _262_agent_stop(txMachine* the)
601601
#if mxWindows
602602
WaitForSingleObject(agent->thread, INFINITE);
603603
CloseHandle(agent->thread);
604-
#elif PICO_BUILD || _ZEPHYR
604+
#elif PICO_BUILD || __ZEPHYR__
605605
#else
606606
pthread_join(agent->thread, NULL);
607607
#endif
@@ -663,7 +663,7 @@ void _262_evalScript(txMachine* the)
663663
mxPullSlot(mxResult);
664664
}
665665

666-
#if _ZEPHYR
666+
#if __ZEPHYR__
667667

668668
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf)
669669
{

xs/sources/xsCommon.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ const txS1 gxCodeSizes[XS_CODE_COUNT] ICACHE_FLASH_ATTR = {
547547

548548
#if mxUseDefaultCStackLimit
549549

550-
#if defined(__ets__) && !defined(_ZEPHYR)
550+
#if defined(__ets__) && !defined(__ZEPHYR__)
551551
#if ESP32
552552
#include "freertos/task.h"
553553
#else
@@ -613,10 +613,10 @@ char* fxCStackLimit()
613613
}
614614
pthread_attr_destroy(&attrs);
615615
return result;
616-
#elif defined(__ets__) && !ESP32 && !defined(_ZEPHYR)
616+
#elif defined(__ets__) && !ESP32 && !defined(__ZEPHYR__)
617617
extern cont_t g_cont;
618618
return 192 + (char *)g_cont.stack;
619-
#elif defined(__ets__) && ESP32 && !defined(_ZEPHYR)
619+
#elif defined(__ets__) && ESP32 && !defined(__ZEPHYR__)
620620
TaskStatus_t info;
621621
vTaskGetInfo(NULL, &info, pdFALSE, eReady);
622622
return 512 + (char *)info.pxStackBase;

0 commit comments

Comments
 (0)