Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 1 | // Options to control how MicroPython is built for this port, |
| 2 | // overriding defaults in py/mpconfig.h. |
| 3 | |
Jim Mussared | 8db517f | 2019-08-09 18:07:50 +1000 | [diff] [blame] | 4 | // Board-specific definitions |
| 5 | #include "mpconfigboard.h" |
| 6 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 7 | #include <stdint.h> |
| 8 | #include <alloca.h> |
Damien George | e465012 | 2023-05-09 09:52:54 +1000 | [diff] [blame] | 9 | #include "esp_random.h" |
robert | b406289 | 2020-08-22 20:56:26 +0200 | [diff] [blame] | 10 | #include "esp_system.h" |
MikeTeachman | 6d5296e | 2021-11-09 20:41:34 -0800 | [diff] [blame] | 11 | #include "freertos/FreeRTOS.h" |
| 12 | #include "driver/i2s.h" |
Damien George | e465012 | 2023-05-09 09:52:54 +1000 | [diff] [blame] | 13 | #include "esp_wifi_types.h" |
Jim Mussared | 96008ff | 2019-09-13 23:04:13 +1000 | [diff] [blame] | 14 | |
Damien George | c8cd5a9 | 2022-02-18 15:50:01 +1100 | [diff] [blame] | 15 | #ifndef MICROPY_CONFIG_ROM_LEVEL |
| 16 | #define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES) |
| 17 | #endif |
| 18 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 19 | // object representation and NLR handling |
| 20 | #define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_A) |
| 21 | #define MICROPY_NLR_SETJMP (1) |
Damien George | 6823514 | 2021-07-18 12:11:21 +1000 | [diff] [blame] | 22 | #if CONFIG_IDF_TARGET_ESP32C3 |
| 23 | #define MICROPY_GCREGS_SETJMP (1) |
| 24 | #endif |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 25 | |
| 26 | // memory allocation policies |
| 27 | #define MICROPY_ALLOC_PATH_MAX (128) |
| 28 | |
| 29 | // emitters |
| 30 | #define MICROPY_PERSISTENT_CODE_LOAD (1) |
Damien George | 6823514 | 2021-07-18 12:11:21 +1000 | [diff] [blame] | 31 | #if !CONFIG_IDF_TARGET_ESP32C3 |
Damien George | 917f027 | 2019-09-10 13:47:44 +1000 | [diff] [blame] | 32 | #define MICROPY_EMIT_XTENSAWIN (1) |
Damien George | 6823514 | 2021-07-18 12:11:21 +1000 | [diff] [blame] | 33 | #endif |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 34 | |
Damien George | f63b4f8 | 2022-06-09 12:36:45 +1000 | [diff] [blame] | 35 | // workaround for xtensa-esp32-elf-gcc esp-2020r3, which can generate wrong code for loops |
| 36 | // see https://github.com/espressif/esp-idf/issues/9130 |
| 37 | // this was fixed in newer versions of the compiler by: |
| 38 | // "gas: use literals/const16 for xtensa loop relaxation" |
| 39 | // https://github.com/jcmvbkbc/binutils-gdb-xtensa/commit/403b0b61f6d4358aee8493cb1d11814e368942c9 |
| 40 | #define MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND (1) |
| 41 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 42 | // optimisations |
| 43 | #define MICROPY_OPT_COMPUTED_GOTO (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 44 | |
| 45 | // Python internal features |
| 46 | #define MICROPY_READER_VFS (1) |
| 47 | #define MICROPY_ENABLE_GC (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 48 | #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 49 | #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 50 | #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) |
| 51 | #define MICROPY_WARNINGS (1) |
| 52 | #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 53 | #define MICROPY_STREAMS_POSIX_API (1) |
Thorsten von Eicken | 902da05 | 2020-11-11 17:46:18 -0800 | [diff] [blame] | 54 | #define MICROPY_USE_INTERNAL_ERRNO (0) // errno.h from xtensa-esp32-elf/sys-include/sys |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 55 | #define MICROPY_USE_INTERNAL_PRINTF (0) // ESP32 SDK requires its own printf |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 56 | #define MICROPY_SCHEDULER_DEPTH (8) |
| 57 | #define MICROPY_VFS (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 58 | |
| 59 | // control over Python builtins |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 60 | #define MICROPY_PY_STR_BYTES_CMP_WARN (1) |
Jim Mussared | bfc8e88 | 2021-08-04 15:35:00 +1000 | [diff] [blame] | 61 | #define MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 62 | #define MICROPY_PY_BUILTINS_HELP_TEXT esp32_help_text |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 63 | #define MICROPY_PY_IO_BUFFEREDWRITER (1) |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 64 | #define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1) |
| 65 | #define MICROPY_PY_TIME_TIME_TIME_NS (1) |
| 66 | #define MICROPY_PY_TIME_INCLUDEFILE "ports/esp32/modtime.c" |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 67 | #define MICROPY_PY_THREAD (1) |
| 68 | #define MICROPY_PY_THREAD_GIL (1) |
| 69 | #define MICROPY_PY_THREAD_GIL_VM_DIVISOR (32) |
| 70 | |
Angus Gratton | 05dcb8b | 2023-08-02 16:51:07 +1000 | [diff] [blame] | 71 | #define MICROPY_GC_SPLIT_HEAP (1) |
| 72 | #define MICROPY_GC_SPLIT_HEAP_AUTO (1) |
| 73 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 74 | // extended modules |
Glenn Moloney | 9f835df | 2023-10-10 13:06:59 +1100 | [diff] [blame] | 75 | #ifndef MICROPY_PY_ESPNOW |
| 76 | #define MICROPY_PY_ESPNOW (1) |
Glenn Moloney | 7fa322a | 2020-09-24 15:37:04 +1000 | [diff] [blame] | 77 | #endif |
Damien George | da2b5fa | 2021-02-14 01:36:30 +1100 | [diff] [blame] | 78 | #ifndef MICROPY_PY_BLUETOOTH |
| 79 | #define MICROPY_PY_BLUETOOTH (1) |
Damien George | 5dbb822 | 2021-03-17 12:35:59 +1100 | [diff] [blame] | 80 | #define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS (1) |
| 81 | #define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS_WITH_INTERLOCK (1) |
| 82 | #define MICROPY_PY_BLUETOOTH_SYNC_EVENT_STACK_SIZE (CONFIG_BT_NIMBLE_TASK_STACK_SIZE) |
Damien George | da2b5fa | 2021-02-14 01:36:30 +1100 | [diff] [blame] | 83 | #define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1) |
Damien George | 5dbb822 | 2021-03-17 12:35:59 +1100 | [diff] [blame] | 84 | #define MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING (1) |
Damien George | da2b5fa | 2021-02-14 01:36:30 +1100 | [diff] [blame] | 85 | #define MICROPY_BLUETOOTH_NIMBLE (1) |
| 86 | #define MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY (1) |
| 87 | #endif |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 88 | #define MICROPY_PY_HASHLIB_SHA1 (1) |
| 89 | #define MICROPY_PY_HASHLIB_SHA256 (1) |
| 90 | #define MICROPY_PY_CRYPTOLIB (1) |
| 91 | #define MICROPY_PY_RANDOM_SEED_INIT_FUNC (esp_random()) |
Jim Mussared | 45ac651 | 2022-08-18 16:24:27 +1000 | [diff] [blame] | 92 | #define MICROPY_PY_OS_INCLUDEFILE "ports/esp32/modos.c" |
Damien George | 98b05e3 | 2018-04-27 23:51:00 +1000 | [diff] [blame] | 93 | #define MICROPY_PY_OS_DUPTERM (1) |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 94 | #define MICROPY_PY_OS_DUPTERM_NOTIFY (1) |
| 95 | #define MICROPY_PY_OS_SYNC (1) |
| 96 | #define MICROPY_PY_OS_UNAME (1) |
| 97 | #define MICROPY_PY_OS_URANDOM (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 98 | #define MICROPY_PY_MACHINE (1) |
Damien George | 95d8b5f | 2023-10-11 13:48:49 +1100 | [diff] [blame^] | 99 | #define MICROPY_PY_MACHINE_ADC (1) |
| 100 | #define MICROPY_PY_MACHINE_ADC_INCLUDEFILE "ports/esp32/machine_adc.c" |
| 101 | #define MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH (1) |
| 102 | #define MICROPY_PY_MACHINE_ADC_BLOCK (1) |
| 103 | #define MICROPY_PY_MACHINE_ADC_INIT (1) |
| 104 | #define MICROPY_PY_MACHINE_ADC_READ (1) |
| 105 | #define MICROPY_PY_MACHINE_ADC_READ_UV (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 106 | #define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new |
Jim Mussared | 71f4faa | 2021-08-11 14:26:23 +1000 | [diff] [blame] | 107 | #define MICROPY_PY_MACHINE_BITSTREAM (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 108 | #define MICROPY_PY_MACHINE_PULSE (1) |
Damien George | af64c2d | 2021-06-24 12:37:50 +1000 | [diff] [blame] | 109 | #define MICROPY_PY_MACHINE_PWM (1) |
Damien George | af64c2d | 2021-06-24 12:37:50 +1000 | [diff] [blame] | 110 | #define MICROPY_PY_MACHINE_PWM_DUTY (1) |
| 111 | #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/esp32/machine_pwm.c" |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 112 | #define MICROPY_PY_MACHINE_I2C (1) |
Damien George | 6bda80d | 2022-06-01 11:58:30 +1000 | [diff] [blame] | 113 | #define MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 (1) |
Damien George | 122d901 | 2021-09-02 12:37:00 +1000 | [diff] [blame] | 114 | #define MICROPY_PY_MACHINE_SOFTI2C (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 115 | #define MICROPY_PY_MACHINE_SPI (1) |
| 116 | #define MICROPY_PY_MACHINE_SPI_MSB (0) |
| 117 | #define MICROPY_PY_MACHINE_SPI_LSB (1) |
Damien George | afe0634 | 2021-09-02 12:39:28 +1000 | [diff] [blame] | 118 | #define MICROPY_PY_MACHINE_SOFTSPI (1) |
Damien George | 1f9243f | 2021-07-18 12:11:10 +1000 | [diff] [blame] | 119 | #ifndef MICROPY_PY_MACHINE_DAC |
| 120 | #define MICROPY_PY_MACHINE_DAC (1) |
| 121 | #endif |
Damien George | 0fc0cca | 2021-07-18 12:11:15 +1000 | [diff] [blame] | 122 | #ifndef MICROPY_PY_MACHINE_I2S |
| 123 | #define MICROPY_PY_MACHINE_I2S (1) |
| 124 | #endif |
Damien George | f2f3ef1 | 2023-10-09 12:12:18 +1100 | [diff] [blame] | 125 | #define MICROPY_PY_MACHINE_I2S_INCLUDEFILE "ports/esp32/machine_i2s.c" |
| 126 | #define MICROPY_PY_MACHINE_I2S_FINALISER (1) |
| 127 | #define MICROPY_PY_MACHINE_I2S_CONSTANT_RX (I2S_MODE_MASTER | I2S_MODE_RX) |
| 128 | #define MICROPY_PY_MACHINE_I2S_CONSTANT_TX (I2S_MODE_MASTER | I2S_MODE_TX) |
Damien George | 60929ec | 2023-10-10 18:19:03 +1100 | [diff] [blame] | 129 | #define MICROPY_PY_MACHINE_WDT (1) |
| 130 | #define MICROPY_PY_MACHINE_WDT_INCLUDEFILE "ports/esp32/machine_wdt.c" |
Jim Mussared | eb51ca4 | 2023-02-01 14:20:45 +1100 | [diff] [blame] | 131 | #define MICROPY_PY_NETWORK (1) |
| 132 | #ifndef MICROPY_PY_NETWORK_HOSTNAME_DEFAULT |
| 133 | #if CONFIG_IDF_TARGET_ESP32 |
| 134 | #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32" |
| 135 | #elif CONFIG_IDF_TARGET_ESP32S2 |
| 136 | #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32s2" |
| 137 | #elif CONFIG_IDF_TARGET_ESP32S3 |
| 138 | #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32s3" |
| 139 | #elif CONFIG_IDF_TARGET_ESP32C3 |
| 140 | #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32c3" |
| 141 | #endif |
| 142 | #endif |
| 143 | #define MICROPY_PY_NETWORK_INCLUDEFILE "ports/esp32/modnetwork.h" |
| 144 | #define MICROPY_PY_NETWORK_MODULE_GLOBALS_INCLUDEFILE "ports/esp32/modnetwork_globals.h" |
Damien George | ea186de | 2021-09-22 00:35:46 +1000 | [diff] [blame] | 145 | #ifndef MICROPY_PY_NETWORK_WLAN |
| 146 | #define MICROPY_PY_NETWORK_WLAN (1) |
| 147 | #endif |
Damien George | 66a86a0 | 2021-02-18 21:24:34 +1100 | [diff] [blame] | 148 | #ifndef MICROPY_HW_ENABLE_SDCARD |
Nicko van Someren | 8e3af7d | 2019-05-04 19:00:35 -0600 | [diff] [blame] | 149 | #define MICROPY_HW_ENABLE_SDCARD (1) |
Damien George | 66a86a0 | 2021-02-18 21:24:34 +1100 | [diff] [blame] | 150 | #endif |
Damien George | 58ebeca | 2018-03-09 17:25:58 +1100 | [diff] [blame] | 151 | #define MICROPY_HW_SOFTSPI_MIN_DELAY (0) |
Damien George | e465012 | 2023-05-09 09:52:54 +1000 | [diff] [blame] | 152 | #define MICROPY_HW_SOFTSPI_MAX_BAUDRATE (esp_rom_get_cpu_ticks_per_us() * 1000000 / 200) // roughly |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 153 | #define MICROPY_PY_SSL (1) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 154 | #define MICROPY_SSL_MBEDTLS (1) |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 155 | #define MICROPY_PY_WEBSOCKET (1) |
Damien George | c1d4352 | 2018-04-27 23:57:57 +1000 | [diff] [blame] | 156 | #define MICROPY_PY_WEBREPL (1) |
Damien George | d41f6dd | 2021-09-02 12:39:50 +1000 | [diff] [blame] | 157 | #define MICROPY_PY_ONEWIRE (1) |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 158 | #define MICROPY_PY_SOCKET_EVENTS (MICROPY_PY_WEBREPL) |
Jim Mussared | 6a9bd1c | 2019-10-01 23:47:37 +1000 | [diff] [blame] | 159 | #define MICROPY_PY_BLUETOOTH_RANDOM_ADDR (1) |
Damien George | 3b6c911 | 2020-05-08 13:54:10 +1000 | [diff] [blame] | 160 | #define MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME ("ESP32") |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 161 | |
| 162 | // fatfs configuration |
| 163 | #define MICROPY_FATFS_ENABLE_LFN (1) |
| 164 | #define MICROPY_FATFS_RPATH (2) |
| 165 | #define MICROPY_FATFS_MAX_SS (4096) |
Damien George | b5f33ac | 2019-02-25 23:46:17 +1100 | [diff] [blame] | 166 | #define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */ |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 167 | |
dotnfc | d7f63f9 | 2023-09-12 17:15:27 +0800 | [diff] [blame] | 168 | // task size |
| 169 | #ifndef MICROPY_TASK_STACK_SIZE |
| 170 | #define MICROPY_TASK_STACK_SIZE (16 * 1024) |
| 171 | #endif |
| 172 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 173 | #define MP_STATE_PORT MP_STATE_VM |
| 174 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 175 | // type definitions for the specific machine |
| 176 | |
Damien George | 69661f3 | 2020-02-27 15:36:53 +1100 | [diff] [blame] | 177 | #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p))) |
Damien George | 69661f3 | 2020-02-27 15:36:53 +1100 | [diff] [blame] | 178 | void *esp_native_code_commit(void *, size_t, void *); |
Damien George | b47e155 | 2019-10-06 23:29:40 +1100 | [diff] [blame] | 179 | #define MP_PLAT_COMMIT_EXEC(buf, len, reloc) esp_native_code_commit(buf, len, reloc) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 180 | #define MP_SSIZE_MAX (0x7fffffff) |
| 181 | |
| 182 | // Note: these "critical nested" macros do not ensure cross-CPU exclusion, |
| 183 | // the only disable interrupts on the current CPU. To full manage exclusion |
| 184 | // one should use portENTER_CRITICAL/portEXIT_CRITICAL instead. |
| 185 | #include "freertos/FreeRTOS.h" |
Damien George | e465012 | 2023-05-09 09:52:54 +1000 | [diff] [blame] | 186 | #define MICROPY_BEGIN_ATOMIC_SECTION() portSET_INTERRUPT_MASK_FROM_ISR() |
| 187 | #define MICROPY_END_ATOMIC_SECTION(state) portCLEAR_INTERRUPT_MASK_FROM_ISR(state) |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 188 | |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 189 | #if MICROPY_PY_SOCKET_EVENTS |
| 190 | #define MICROPY_PY_SOCKET_EVENTS_HANDLER extern void socket_events_handler(void); socket_events_handler(); |
Damien George | 999c8b9 | 2018-04-27 23:53:45 +1000 | [diff] [blame] | 191 | #else |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 192 | #define MICROPY_PY_SOCKET_EVENTS_HANDLER |
Damien George | 999c8b9 | 2018-04-27 23:53:45 +1000 | [diff] [blame] | 193 | #endif |
| 194 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 195 | #if MICROPY_PY_THREAD |
| 196 | #define MICROPY_EVENT_POLL_HOOK \ |
| 197 | do { \ |
Damien George | 98a3911 | 2020-02-06 01:05:47 +1100 | [diff] [blame] | 198 | extern void mp_handle_pending(bool); \ |
| 199 | mp_handle_pending(true); \ |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 200 | MICROPY_PY_SOCKET_EVENTS_HANDLER \ |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 201 | MP_THREAD_GIL_EXIT(); \ |
Daniƫl van de Giessen | 665f0e2 | 2022-02-23 17:28:32 +0100 | [diff] [blame] | 202 | ulTaskNotifyTake(pdFALSE, 1); \ |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 203 | MP_THREAD_GIL_ENTER(); \ |
| 204 | } while (0); |
| 205 | #else |
| 206 | #define MICROPY_EVENT_POLL_HOOK \ |
| 207 | do { \ |
Damien George | 98a3911 | 2020-02-06 01:05:47 +1100 | [diff] [blame] | 208 | extern void mp_handle_pending(bool); \ |
| 209 | mp_handle_pending(true); \ |
Jim Mussared | f5f9edf | 2022-08-18 15:01:26 +1000 | [diff] [blame] | 210 | MICROPY_PY_SOCKET_EVENTS_HANDLER \ |
Damien George | 69661f3 | 2020-02-27 15:36:53 +1100 | [diff] [blame] | 211 | asm ("waiti 0"); \ |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 212 | } while (0); |
| 213 | #endif |
| 214 | |
Damien George | f4641b2 | 2020-02-07 12:11:22 +1100 | [diff] [blame] | 215 | // Functions that should go in IRAM |
Damien George | 549448e | 2021-09-24 12:50:59 +1000 | [diff] [blame] | 216 | #define MICROPY_WRAP_MP_BINARY_OP(f) IRAM_ATTR f |
| 217 | #define MICROPY_WRAP_MP_EXECUTE_BYTECODE(f) IRAM_ATTR f |
| 218 | #define MICROPY_WRAP_MP_LOAD_GLOBAL(f) IRAM_ATTR f |
| 219 | #define MICROPY_WRAP_MP_LOAD_NAME(f) IRAM_ATTR f |
| 220 | #define MICROPY_WRAP_MP_MAP_LOOKUP(f) IRAM_ATTR f |
| 221 | #define MICROPY_WRAP_MP_OBJ_GET_TYPE(f) IRAM_ATTR f |
Damien George | 7cbf826 | 2021-04-28 10:52:19 +1000 | [diff] [blame] | 222 | #define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) IRAM_ATTR f |
Damien George | e9e9c76 | 2021-04-28 10:57:34 +1000 | [diff] [blame] | 223 | #define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) IRAM_ATTR f |
Damien George | f4641b2 | 2020-02-07 12:11:22 +1100 | [diff] [blame] | 224 | |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 225 | #define UINT_FMT "%u" |
| 226 | #define INT_FMT "%d" |
| 227 | |
| 228 | typedef int32_t mp_int_t; // must be pointer size |
| 229 | typedef uint32_t mp_uint_t; // must be pointer size |
| 230 | typedef long mp_off_t; |
| 231 | // ssize_t, off_t as required by POSIX-signatured functions in stream.h |
| 232 | #include <sys/types.h> |
| 233 | |
| 234 | // board specifics |
Damien George | bc08c88 | 2016-12-06 12:20:10 +1100 | [diff] [blame] | 235 | #define MICROPY_PY_SYS_PLATFORM "esp32" |
Damien George | 2ccf030 | 2019-07-10 15:38:48 +1000 | [diff] [blame] | 236 | |
Seon Rozenblum | 1904833 | 2021-11-12 11:23:49 +1100 | [diff] [blame] | 237 | // ESP32-S3 extended IO for 47 & 48 |
| 238 | #ifndef MICROPY_HW_ESP32S3_EXTENDED_IO |
| 239 | #define MICROPY_HW_ESP32S3_EXTENDED_IO (1) |
| 240 | #endif |
| 241 | |
Damien George | 2ccf030 | 2019-07-10 15:38:48 +1000 | [diff] [blame] | 242 | #ifndef MICROPY_HW_ENABLE_MDNS_QUERIES |
Carlosgg | 1f35576 | 2023-06-25 22:48:39 +0100 | [diff] [blame] | 243 | #define MICROPY_HW_ENABLE_MDNS_QUERIES (1) |
Damien George | 2ccf030 | 2019-07-10 15:38:48 +1000 | [diff] [blame] | 244 | #endif |
| 245 | |
| 246 | #ifndef MICROPY_HW_ENABLE_MDNS_RESPONDER |
Carlosgg | 1f35576 | 2023-06-25 22:48:39 +0100 | [diff] [blame] | 247 | #define MICROPY_HW_ENABLE_MDNS_RESPONDER (1) |
Damien George | 2ccf030 | 2019-07-10 15:38:48 +1000 | [diff] [blame] | 248 | #endif |
Damien George | f046b50 | 2021-09-22 00:00:26 +1000 | [diff] [blame] | 249 | |
Luca Burelli | 904ccfa | 2023-07-04 11:54:53 +0200 | [diff] [blame] | 250 | #ifndef MICROPY_BOARD_ENTER_BOOTLOADER |
| 251 | #define MICROPY_BOARD_ENTER_BOOTLOADER(nargs, args) |
| 252 | #endif |
| 253 | |
Damien George | f046b50 | 2021-09-22 00:00:26 +1000 | [diff] [blame] | 254 | #ifndef MICROPY_BOARD_STARTUP |
| 255 | #define MICROPY_BOARD_STARTUP boardctrl_startup |
| 256 | #endif |
| 257 | |
| 258 | void boardctrl_startup(void); |
Damien Tournoud | e982c1d | 2023-01-12 21:04:07 -0800 | [diff] [blame] | 259 | |
| 260 | #ifndef MICROPY_PY_NETWORK_LAN |
Damien George | e465012 | 2023-05-09 09:52:54 +1000 | [diff] [blame] | 261 | #if CONFIG_IDF_TARGET_ESP32 || (CONFIG_ETH_USE_SPI_ETHERNET && (CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL || CONFIG_ETH_SPI_ETHERNET_DM9051 || CONFIG_ETH_SPI_ETHERNET_W5500)) |
Damien Tournoud | e982c1d | 2023-01-12 21:04:07 -0800 | [diff] [blame] | 262 | #define MICROPY_PY_NETWORK_LAN (1) |
| 263 | #else |
| 264 | #define MICROPY_PY_NETWORK_LAN (0) |
| 265 | #endif |
| 266 | #endif |
| 267 | |
| 268 | #if MICROPY_PY_NETWORK_LAN && CONFIG_ETH_USE_SPI_ETHERNET |
| 269 | #ifndef MICROPY_PY_NETWORK_LAN_SPI_CLOCK_SPEED_MZ |
| 270 | #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2 |
| 271 | #define MICROPY_PY_NETWORK_LAN_SPI_CLOCK_SPEED_MZ (12) |
| 272 | #else |
| 273 | #define MICROPY_PY_NETWORK_LAN_SPI_CLOCK_SPEED_MZ (36) |
| 274 | #endif |
| 275 | #endif |
| 276 | #endif |