blob: 40b3f11b4a4333df3b0ed4362d092f8c900684d5 [file] [log] [blame]
Damien Georgebc08c882016-12-06 12:20:10 +11001// Options to control how MicroPython is built for this port,
2// overriding defaults in py/mpconfig.h.
3
Jim Mussared8db517f2019-08-09 18:07:50 +10004// Board-specific definitions
5#include "mpconfigboard.h"
6
Damien Georgebc08c882016-12-06 12:20:10 +11007#include <stdint.h>
8#include <alloca.h>
Damien Georgee4650122023-05-09 09:52:54 +10009#include "esp_random.h"
robertb4062892020-08-22 20:56:26 +020010#include "esp_system.h"
MikeTeachman6d5296e2021-11-09 20:41:34 -080011#include "freertos/FreeRTOS.h"
MikeTeachman0b145fd2024-02-20 21:37:30 -080012#include "driver/i2s_std.h"
Damien Georgee4650122023-05-09 09:52:54 +100013#include "esp_wifi_types.h"
Jim Mussared96008ff2019-09-13 23:04:13 +100014
Damien Georgec8cd5a92022-02-18 15:50:01 +110015#ifndef MICROPY_CONFIG_ROM_LEVEL
16#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
17#endif
18
Damien Georgebc08c882016-12-06 12:20:10 +110019// object representation and NLR handling
20#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_A)
Alessandro Gatti6007f3e2024-07-02 22:49:47 +020021#if !CONFIG_IDF_TARGET_ESP32C3
Damien Georgebc08c882016-12-06 12:20:10 +110022#define MICROPY_NLR_SETJMP (1)
Damien George68235142021-07-18 12:11:21 +100023#endif
Damien Georgebc08c882016-12-06 12:20:10 +110024
25// memory allocation policies
26#define MICROPY_ALLOC_PATH_MAX (128)
27
Damien Georgef6d63082023-12-18 13:38:16 +110028// Initial Python heap size. This starts small but adds new heap areas on demand due to
29// the settings MICROPY_GC_SPLIT_HEAP and MICROPY_GC_SPLIT_HEAP_AUTO. The value is
30// different for different MCUs and is chosen so they can grow the heap once (double it)
31// and still have enough internal RAM to start WiFi and make a HTTPS request.
32#ifndef MICROPY_GC_INITIAL_HEAP_SIZE
33#if CONFIG_IDF_TARGET_ESP32
34#define MICROPY_GC_INITIAL_HEAP_SIZE (56 * 1024)
35#elif CONFIG_IDF_TARGET_ESP32S2 && !CONFIG_SPIRAM
36#define MICROPY_GC_INITIAL_HEAP_SIZE (36 * 1024)
37#else
38#define MICROPY_GC_INITIAL_HEAP_SIZE (64 * 1024)
39#endif
40#endif
41
Damien Georgebc08c882016-12-06 12:20:10 +110042// emitters
43#define MICROPY_PERSISTENT_CODE_LOAD (1)
Damien George68235142021-07-18 12:11:21 +100044#if !CONFIG_IDF_TARGET_ESP32C3
Damien George917f0272019-09-10 13:47:44 +100045#define MICROPY_EMIT_XTENSAWIN (1)
Alessandro Gatti6007f3e2024-07-02 22:49:47 +020046#else
47#define MICROPY_EMIT_RV32 (1)
Damien George68235142021-07-18 12:11:21 +100048#endif
Damien Georgebc08c882016-12-06 12:20:10 +110049
Damien Georgef63b4f82022-06-09 12:36:45 +100050// workaround for xtensa-esp32-elf-gcc esp-2020r3, which can generate wrong code for loops
51// see https://github.com/espressif/esp-idf/issues/9130
52// this was fixed in newer versions of the compiler by:
53// "gas: use literals/const16 for xtensa loop relaxation"
54// https://github.com/jcmvbkbc/binutils-gdb-xtensa/commit/403b0b61f6d4358aee8493cb1d11814e368942c9
55#define MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND (1)
56
Damien Georgebc08c882016-12-06 12:20:10 +110057// optimisations
Damien Georged0758d82023-12-11 12:01:40 +110058#ifndef MICROPY_OPT_COMPUTED_GOTO
Damien Georgebc08c882016-12-06 12:20:10 +110059#define MICROPY_OPT_COMPUTED_GOTO (1)
Damien Georged0758d82023-12-11 12:01:40 +110060#endif
Damien Georgebc08c882016-12-06 12:20:10 +110061
62// Python internal features
63#define MICROPY_READER_VFS (1)
64#define MICROPY_ENABLE_GC (1)
Angus Grattone3955f42024-08-06 16:13:33 +100065#if CONFIG_IDF_TARGET_ARCH_RISCV // RISC-V SoCs use more stack than Xtensa
66#define MICROPY_STACK_CHECK_MARGIN (2048) // This may be unnecessarily conservative
67#else
68#define MICROPY_STACK_CHECK_MARGIN (1024)
69#endif
Damien Georgebc08c882016-12-06 12:20:10 +110070#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
Damien Georgebc08c882016-12-06 12:20:10 +110071#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
Damien Georgebc08c882016-12-06 12:20:10 +110072#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
73#define MICROPY_WARNINGS (1)
74#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
Damien Georgebc08c882016-12-06 12:20:10 +110075#define MICROPY_STREAMS_POSIX_API (1)
Thorsten von Eicken902da052020-11-11 17:46:18 -080076#define MICROPY_USE_INTERNAL_ERRNO (0) // errno.h from xtensa-esp32-elf/sys-include/sys
Damien Georgebc08c882016-12-06 12:20:10 +110077#define MICROPY_USE_INTERNAL_PRINTF (0) // ESP32 SDK requires its own printf
Damien Georgebc08c882016-12-06 12:20:10 +110078#define MICROPY_SCHEDULER_DEPTH (8)
79#define MICROPY_VFS (1)
Damien Georgebc08c882016-12-06 12:20:10 +110080
81// control over Python builtins
Damien Georgebc08c882016-12-06 12:20:10 +110082#define MICROPY_PY_STR_BYTES_CMP_WARN (1)
Jim Mussaredbfc8e882021-08-04 15:35:00 +100083#define MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS (1)
Damien Georgebc08c882016-12-06 12:20:10 +110084#define MICROPY_PY_BUILTINS_HELP_TEXT esp32_help_text
Damien Georgebc08c882016-12-06 12:20:10 +110085#define MICROPY_PY_IO_BUFFEREDWRITER (1)
Jim Mussaredf5f9edf2022-08-18 15:01:26 +100086#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)
87#define MICROPY_PY_TIME_TIME_TIME_NS (1)
88#define MICROPY_PY_TIME_INCLUDEFILE "ports/esp32/modtime.c"
Damien Georgebc08c882016-12-06 12:20:10 +110089#define MICROPY_PY_THREAD (1)
90#define MICROPY_PY_THREAD_GIL (1)
91#define MICROPY_PY_THREAD_GIL_VM_DIVISOR (32)
92
Angus Gratton05dcb8b2023-08-02 16:51:07 +100093#define MICROPY_GC_SPLIT_HEAP (1)
94#define MICROPY_GC_SPLIT_HEAP_AUTO (1)
95
Damien Georgebc08c882016-12-06 12:20:10 +110096// extended modules
Glenn Moloney9f835df2023-10-10 13:06:59 +110097#ifndef MICROPY_PY_ESPNOW
98#define MICROPY_PY_ESPNOW (1)
Glenn Moloney7fa322a2020-09-24 15:37:04 +100099#endif
Damien Georgeda2b5fa2021-02-14 01:36:30 +1100100#ifndef MICROPY_PY_BLUETOOTH
101#define MICROPY_PY_BLUETOOTH (1)
Damien George5dbb8222021-03-17 12:35:59 +1100102#define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS (1)
103#define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS_WITH_INTERLOCK (1)
Damien Georgecd66aa02024-02-15 23:03:29 +1100104#define MICROPY_PY_BLUETOOTH_SYNC_EVENT_STACK_SIZE (CONFIG_BT_NIMBLE_TASK_STACK_SIZE - 2048)
Damien Georgeda2b5fa2021-02-14 01:36:30 +1100105#define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1)
Damien George5dbb8222021-03-17 12:35:59 +1100106#define MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING (1)
Damien Georgeda2b5fa2021-02-14 01:36:30 +1100107#define MICROPY_BLUETOOTH_NIMBLE (1)
108#define MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY (1)
109#endif
IhorNehrutsa55528962023-12-19 16:28:06 +0200110#define MICROPY_PY_HASHLIB_MD5 (1)
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000111#define MICROPY_PY_HASHLIB_SHA1 (1)
112#define MICROPY_PY_HASHLIB_SHA256 (1)
113#define MICROPY_PY_CRYPTOLIB (1)
114#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (esp_random())
Jim Mussared45ac6512022-08-18 16:24:27 +1000115#define MICROPY_PY_OS_INCLUDEFILE "ports/esp32/modos.c"
Damien George98b05e32018-04-27 23:51:00 +1000116#define MICROPY_PY_OS_DUPTERM (1)
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000117#define MICROPY_PY_OS_DUPTERM_NOTIFY (1)
118#define MICROPY_PY_OS_SYNC (1)
119#define MICROPY_PY_OS_UNAME (1)
120#define MICROPY_PY_OS_URANDOM (1)
Damien Georgebc08c882016-12-06 12:20:10 +1100121#define MICROPY_PY_MACHINE (1)
Damien George7d39db22023-11-22 13:00:02 +1100122#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/esp32/modmachine.c"
Damien Georgebfc3dde2024-03-14 11:09:14 +1100123#define MICROPY_PY_MACHINE_RESET (1)
Damien Georgee1ec6af2023-11-24 18:25:30 +1100124#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
Damien Georgef523b862023-11-27 11:43:15 +1100125#define MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ (1)
Damien George95d8b5f2023-10-11 13:48:49 +1100126#define MICROPY_PY_MACHINE_ADC (1)
127#define MICROPY_PY_MACHINE_ADC_INCLUDEFILE "ports/esp32/machine_adc.c"
128#define MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH (1)
Damien George95d8b5f2023-10-11 13:48:49 +1100129#define MICROPY_PY_MACHINE_ADC_INIT (1)
130#define MICROPY_PY_MACHINE_ADC_READ (1)
131#define MICROPY_PY_MACHINE_ADC_READ_UV (1)
Damien George03eae482023-10-25 19:13:11 +1100132#define MICROPY_PY_MACHINE_ADC_BLOCK (1)
133#define MICROPY_PY_MACHINE_ADC_BLOCK_INCLUDEFILE "ports/esp32/machine_adc_block.c"
Damien Georgebc08c882016-12-06 12:20:10 +1100134#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
Jim Mussared71f4faa2021-08-11 14:26:23 +1000135#define MICROPY_PY_MACHINE_BITSTREAM (1)
Damien George7d39db22023-11-22 13:00:02 +1100136#define MICROPY_PY_MACHINE_DHT_READINTO (1)
Damien Georgebc08c882016-12-06 12:20:10 +1100137#define MICROPY_PY_MACHINE_PULSE (1)
Damien Georgeaf64c2d2021-06-24 12:37:50 +1000138#define MICROPY_PY_MACHINE_PWM (1)
Damien Georgeaf64c2d2021-06-24 12:37:50 +1000139#define MICROPY_PY_MACHINE_PWM_DUTY (1)
140#define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/esp32/machine_pwm.c"
Damien Georgebc08c882016-12-06 12:20:10 +1100141#define MICROPY_PY_MACHINE_I2C (1)
Damien George6bda80d2022-06-01 11:58:30 +1000142#define MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 (1)
Damien George122d9012021-09-02 12:37:00 +1000143#define MICROPY_PY_MACHINE_SOFTI2C (1)
Damien Georgebc08c882016-12-06 12:20:10 +1100144#define MICROPY_PY_MACHINE_SPI (1)
Damien Georgeafe06342021-09-02 12:39:28 +1000145#define MICROPY_PY_MACHINE_SOFTSPI (1)
Damien George1f9243f2021-07-18 12:11:10 +1000146#ifndef MICROPY_PY_MACHINE_DAC
IhorNehrutsa495be712023-11-12 20:46:26 +0200147#define MICROPY_PY_MACHINE_DAC (SOC_DAC_SUPPORTED)
Damien George1f9243f2021-07-18 12:11:10 +1000148#endif
Damien George0fc0cca2021-07-18 12:11:15 +1000149#ifndef MICROPY_PY_MACHINE_I2S
Ihor Nehrutsa3069fee2023-11-13 14:07:59 +0200150#define MICROPY_PY_MACHINE_I2S (SOC_I2S_SUPPORTED)
Damien George0fc0cca2021-07-18 12:11:15 +1000151#endif
Damien Georgef2f3ef12023-10-09 12:12:18 +1100152#define MICROPY_PY_MACHINE_I2S_INCLUDEFILE "ports/esp32/machine_i2s.c"
153#define MICROPY_PY_MACHINE_I2S_FINALISER (1)
MikeTeachman0b145fd2024-02-20 21:37:30 -0800154#define MICROPY_PY_MACHINE_I2S_CONSTANT_RX (I2S_DIR_RX)
155#define MICROPY_PY_MACHINE_I2S_CONSTANT_TX (I2S_DIR_TX)
Damien George5b4a2ba2023-10-10 23:46:07 +1100156#define MICROPY_PY_MACHINE_UART (1)
157#define MICROPY_PY_MACHINE_UART_INCLUDEFILE "ports/esp32/machine_uart.c"
158#define MICROPY_PY_MACHINE_UART_SENDBREAK (1)
Damien George60929ec2023-10-10 18:19:03 +1100159#define MICROPY_PY_MACHINE_WDT (1)
160#define MICROPY_PY_MACHINE_WDT_INCLUDEFILE "ports/esp32/machine_wdt.c"
Jim Mussaredeb51ca42023-02-01 14:20:45 +1100161#define MICROPY_PY_NETWORK (1)
162#ifndef MICROPY_PY_NETWORK_HOSTNAME_DEFAULT
163#if CONFIG_IDF_TARGET_ESP32
164#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32"
165#elif CONFIG_IDF_TARGET_ESP32S2
166#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32s2"
167#elif CONFIG_IDF_TARGET_ESP32S3
168#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32s3"
169#elif CONFIG_IDF_TARGET_ESP32C3
170#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32c3"
171#endif
172#endif
173#define MICROPY_PY_NETWORK_INCLUDEFILE "ports/esp32/modnetwork.h"
174#define MICROPY_PY_NETWORK_MODULE_GLOBALS_INCLUDEFILE "ports/esp32/modnetwork_globals.h"
Damien Georgeea186de2021-09-22 00:35:46 +1000175#ifndef MICROPY_PY_NETWORK_WLAN
176#define MICROPY_PY_NETWORK_WLAN (1)
177#endif
Damien George66a86a02021-02-18 21:24:34 +1100178#ifndef MICROPY_HW_ENABLE_SDCARD
Nicko van Someren8e3af7d2019-05-04 19:00:35 -0600179#define MICROPY_HW_ENABLE_SDCARD (1)
Damien George66a86a02021-02-18 21:24:34 +1100180#endif
Damien George58ebeca2018-03-09 17:25:58 +1100181#define MICROPY_HW_SOFTSPI_MIN_DELAY (0)
Damien Georgee4650122023-05-09 09:52:54 +1000182#define MICROPY_HW_SOFTSPI_MAX_BAUDRATE (esp_rom_get_cpu_ticks_per_us() * 1000000 / 200) // roughly
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000183#define MICROPY_PY_SSL (1)
Damien Georgebc08c882016-12-06 12:20:10 +1100184#define MICROPY_SSL_MBEDTLS (1)
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000185#define MICROPY_PY_WEBSOCKET (1)
Damien Georgec1d43522018-04-27 23:57:57 +1000186#define MICROPY_PY_WEBREPL (1)
Damien Georged41f6dd2021-09-02 12:39:50 +1000187#define MICROPY_PY_ONEWIRE (1)
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000188#define MICROPY_PY_SOCKET_EVENTS (MICROPY_PY_WEBREPL)
Jim Mussared6a9bd1c2019-10-01 23:47:37 +1000189#define MICROPY_PY_BLUETOOTH_RANDOM_ADDR (1)
Damien Georgebc08c882016-12-06 12:20:10 +1100190
191// fatfs configuration
192#define MICROPY_FATFS_ENABLE_LFN (1)
193#define MICROPY_FATFS_RPATH (2)
194#define MICROPY_FATFS_MAX_SS (4096)
Damien Georgeb5f33ac2019-02-25 23:46:17 +1100195#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
Damien Georgebc08c882016-12-06 12:20:10 +1100196
dotnfcd7f63f92023-09-12 17:15:27 +0800197// task size
198#ifndef MICROPY_TASK_STACK_SIZE
199#define MICROPY_TASK_STACK_SIZE (16 * 1024)
200#endif
201
Damien Georgebc08c882016-12-06 12:20:10 +1100202#define MP_STATE_PORT MP_STATE_VM
203
Damien Georgebc08c882016-12-06 12:20:10 +1100204// type definitions for the specific machine
205
Damien George69661f32020-02-27 15:36:53 +1100206#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
Damien George69661f32020-02-27 15:36:53 +1100207void *esp_native_code_commit(void *, size_t, void *);
Damien Georgeb47e1552019-10-06 23:29:40 +1100208#define MP_PLAT_COMMIT_EXEC(buf, len, reloc) esp_native_code_commit(buf, len, reloc)
Damien Georgebc08c882016-12-06 12:20:10 +1100209#define MP_SSIZE_MAX (0x7fffffff)
210
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000211#if MICROPY_PY_SOCKET_EVENTS
212#define MICROPY_PY_SOCKET_EVENTS_HANDLER extern void socket_events_handler(void); socket_events_handler();
Damien George999c8b92018-04-27 23:53:45 +1000213#else
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000214#define MICROPY_PY_SOCKET_EVENTS_HANDLER
Damien George999c8b92018-04-27 23:53:45 +1000215#endif
216
Damien Georgebc08c882016-12-06 12:20:10 +1100217#if MICROPY_PY_THREAD
218#define MICROPY_EVENT_POLL_HOOK \
219 do { \
Damien George98a39112020-02-06 01:05:47 +1100220 extern void mp_handle_pending(bool); \
221 mp_handle_pending(true); \
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000222 MICROPY_PY_SOCKET_EVENTS_HANDLER \
Damien Georgebc08c882016-12-06 12:20:10 +1100223 MP_THREAD_GIL_EXIT(); \
Daniƫl van de Giessen665f0e22022-02-23 17:28:32 +0100224 ulTaskNotifyTake(pdFALSE, 1); \
Damien Georgebc08c882016-12-06 12:20:10 +1100225 MP_THREAD_GIL_ENTER(); \
226 } while (0);
227#else
228#define MICROPY_EVENT_POLL_HOOK \
229 do { \
Damien George98a39112020-02-06 01:05:47 +1100230 extern void mp_handle_pending(bool); \
231 mp_handle_pending(true); \
Jim Mussaredf5f9edf2022-08-18 15:01:26 +1000232 MICROPY_PY_SOCKET_EVENTS_HANDLER \
Damien George69661f32020-02-27 15:36:53 +1100233 asm ("waiti 0"); \
Damien Georgebc08c882016-12-06 12:20:10 +1100234 } while (0);
235#endif
236
Damien Georgef4641b22020-02-07 12:11:22 +1100237// Functions that should go in IRAM
Damien Georgeb4b77c12023-12-11 12:01:09 +1100238// For ESP32 with SPIRAM workaround, firmware is larger and uses more static IRAM,
239// so in that configuration don't put too many functions in IRAM.
240#if !(CONFIG_IDF_TARGET_ESP32 && CONFIG_SPIRAM && CONFIG_SPIRAM_CACHE_WORKAROUND)
Damien George549448e2021-09-24 12:50:59 +1000241#define MICROPY_WRAP_MP_BINARY_OP(f) IRAM_ATTR f
Damien Georgeb4b77c12023-12-11 12:01:09 +1100242#endif
Damien George549448e2021-09-24 12:50:59 +1000243#define MICROPY_WRAP_MP_EXECUTE_BYTECODE(f) IRAM_ATTR f
244#define MICROPY_WRAP_MP_LOAD_GLOBAL(f) IRAM_ATTR f
245#define MICROPY_WRAP_MP_LOAD_NAME(f) IRAM_ATTR f
246#define MICROPY_WRAP_MP_MAP_LOOKUP(f) IRAM_ATTR f
247#define MICROPY_WRAP_MP_OBJ_GET_TYPE(f) IRAM_ATTR f
Damien George7cbf8262021-04-28 10:52:19 +1000248#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) IRAM_ATTR f
Damien Georgee9e9c762021-04-28 10:57:34 +1000249#define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) IRAM_ATTR f
Damien Georgef4641b22020-02-07 12:11:22 +1100250
Damien Georgebc08c882016-12-06 12:20:10 +1100251#define UINT_FMT "%u"
252#define INT_FMT "%d"
253
254typedef int32_t mp_int_t; // must be pointer size
255typedef uint32_t mp_uint_t; // must be pointer size
256typedef long mp_off_t;
257// ssize_t, off_t as required by POSIX-signatured functions in stream.h
258#include <sys/types.h>
259
260// board specifics
Damien Georgebc08c882016-12-06 12:20:10 +1100261#define MICROPY_PY_SYS_PLATFORM "esp32"
Damien George2ccf0302019-07-10 15:38:48 +1000262
Seon Rozenblum19048332021-11-12 11:23:49 +1100263// ESP32-S3 extended IO for 47 & 48
264#ifndef MICROPY_HW_ESP32S3_EXTENDED_IO
265#define MICROPY_HW_ESP32S3_EXTENDED_IO (1)
266#endif
267
Damien George2ccf0302019-07-10 15:38:48 +1000268#ifndef MICROPY_HW_ENABLE_MDNS_QUERIES
Carlosgg1f355762023-06-25 22:48:39 +0100269#define MICROPY_HW_ENABLE_MDNS_QUERIES (1)
Damien George2ccf0302019-07-10 15:38:48 +1000270#endif
271
272#ifndef MICROPY_HW_ENABLE_MDNS_RESPONDER
Carlosgg1f355762023-06-25 22:48:39 +0100273#define MICROPY_HW_ENABLE_MDNS_RESPONDER (1)
Damien George2ccf0302019-07-10 15:38:48 +1000274#endif
Damien Georgef046b502021-09-22 00:00:26 +1000275
Trent Piephoaf67be72024-03-02 01:25:10 -0800276#ifndef MICROPY_BOARD_ENTER_BOOTLOADER
277// RTC has a register to trigger bootloader on these targets
278#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3
279#define MICROPY_ESP32_USE_BOOTLOADER_RTC (1)
280#define MICROPY_BOARD_ENTER_BOOTLOADER(nargs, args) machine_bootloader_rtc()
281#endif
282#endif
283
Trent Piepho9fc45062024-03-02 01:10:20 -0800284#ifdef MICROPY_BOARD_ENTER_BOOTLOADER
285#define MICROPY_PY_MACHINE_BOOTLOADER (1)
286#else
287#define MICROPY_PY_MACHINE_BOOTLOADER (0)
Luca Burelli904ccfa2023-07-04 11:54:53 +0200288#endif
289
Angus Gratton6fead312024-07-25 12:11:32 +1000290// Workaround for upstream bug https://github.com/espressif/esp-idf/issues/14273
291// Can be removed if a fix is available in supported ESP-IDF versions.
292#define MICROPY_PY_MATH_GAMMA_FIX_NEGINF (1)
293
Damien Georgef046b502021-09-22 00:00:26 +1000294#ifndef MICROPY_BOARD_STARTUP
295#define MICROPY_BOARD_STARTUP boardctrl_startup
296#endif
297
298void boardctrl_startup(void);
Damien Tournoude982c1d2023-01-12 21:04:07 -0800299
300#ifndef MICROPY_PY_NETWORK_LAN
Damien Georgee4650122023-05-09 09:52:54 +1000301#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 Tournoude982c1d2023-01-12 21:04:07 -0800302#define MICROPY_PY_NETWORK_LAN (1)
303#else
304#define MICROPY_PY_NETWORK_LAN (0)
305#endif
306#endif
307
308#if MICROPY_PY_NETWORK_LAN && CONFIG_ETH_USE_SPI_ETHERNET
309#ifndef MICROPY_PY_NETWORK_LAN_SPI_CLOCK_SPEED_MZ
310#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2
311#define MICROPY_PY_NETWORK_LAN_SPI_CLOCK_SPEED_MZ (12)
312#else
313#define MICROPY_PY_NETWORK_LAN_SPI_CLOCK_SPEED_MZ (36)
314#endif
315#endif
316#endif