2022-06-04 12:27:12 +01:00
|
|
|
// Deinitions common to all SAMD21 boards
|
|
|
|
#include "samd21.h"
|
|
|
|
|
2023-06-14 15:56:58 +01:00
|
|
|
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES)
|
|
|
|
#if MICROPY_HW_CODESIZE == 248
|
|
|
|
#define SAMD21_EXTRA_FEATURES 1
|
|
|
|
#else
|
|
|
|
#define SAMD21_EXTRA_FEATURES 0
|
|
|
|
#endif
|
2022-06-04 12:27:12 +01:00
|
|
|
|
2022-06-15 14:16:07 +01:00
|
|
|
// MicroPython emitters
|
2023-06-14 15:56:58 +01:00
|
|
|
#define MICROPY_EMIT_THUMB (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_EMIT_INLINE_THUMB (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_EMIT_THUMB_ARMV7M (0)
|
2022-07-10 10:55:56 +01:00
|
|
|
#define MICROPY_MODULE_BUILTIN_INIT (1)
|
2022-06-09 12:46:54 +01:00
|
|
|
|
2022-06-21 16:32:48 +01:00
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
2022-09-08 16:55:08 +01:00
|
|
|
|
|
|
|
#ifndef MICROPY_PY_MATH
|
|
|
|
#define MICROPY_PY_MATH (1)
|
2023-06-14 15:56:58 +01:00
|
|
|
#define MP_NEED_LOG2 (1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MICROPY_PY_BUILTINS_COMPLEX
|
|
|
|
#define MICROPY_PY_BUILTINS_COMPLEX (0)
|
2022-09-08 16:55:08 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MICROPY_PY_CMATH
|
2022-06-21 16:32:48 +01:00
|
|
|
#define MICROPY_PY_CMATH (0)
|
2022-09-08 16:55:08 +01:00
|
|
|
#endif
|
2022-06-06 10:13:25 +01:00
|
|
|
|
2022-08-18 06:01:26 +01:00
|
|
|
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (trng_random_u32(300))
|
2023-02-14 09:02:22 +00:00
|
|
|
unsigned long trng_random_u32(int delay);
|
2023-01-24 19:36:19 +00:00
|
|
|
|
2022-09-08 16:55:08 +01:00
|
|
|
#ifndef MICROPY_HW_UART_TXBUF
|
2022-06-15 14:16:07 +01:00
|
|
|
#define MICROPY_HW_UART_TXBUF (1)
|
2022-09-08 16:55:08 +01:00
|
|
|
#endif
|
2023-06-14 15:56:58 +01:00
|
|
|
#ifndef MICROPY_HW_UART_RTSCTS
|
|
|
|
#define MICROPY_HW_UART_RTSCTS (SAMD21_EXTRA_FEATURES)
|
|
|
|
#endif
|
2022-06-15 14:16:07 +01:00
|
|
|
|
2023-06-14 15:56:58 +01:00
|
|
|
// selected extensions of the extra features set
|
2022-08-18 06:01:26 +01:00
|
|
|
#define MICROPY_PY_OS_URANDOM (1)
|
2023-06-14 15:56:58 +01:00
|
|
|
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_COMP_RETURN_IF_EXPR (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_OPT_MPZ_BITWISE (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_CENTER (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_PARTITION (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_BUILTINS_ROUND_INT (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_CAN_OVERRIDE_BUILTINS (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_SYS_STDIO_BUFFER (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_FRAMEBUF (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_ASYNCIO (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_SELECT (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_ERRNO (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_DEFLATE (SAMD21_EXTRA_FEATURES)
|
|
|
|
#define MICROPY_PY_ONEWIRE (SAMD21_EXTRA_FEATURES)
|
|
|
|
|
|
|
|
#ifndef MICROPY_PY_MACHINE_PIN_BOARD_CPU
|
|
|
|
#define MICROPY_PY_MACHINE_PIN_BOARD_CPU (1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define VFS_BLOCK_SIZE_BYTES (1536) // 24x 64B flash pages;
|
2022-09-15 14:58:54 +01:00
|
|
|
|
2022-06-15 14:16:07 +01:00
|
|
|
#define CPU_FREQ (48000000)
|
2022-06-30 15:50:15 +01:00
|
|
|
#define DFLL48M_FREQ (48000000)
|
2023-01-24 17:37:27 +00:00
|
|
|
#define MAX_CPU_FREQ (54000000)
|
|
|
|
#define FDPLL_REF_FREQ (32768)
|
2022-06-15 14:16:07 +01:00
|
|
|
|
|
|
|
#define IRQ_PRI_PENDSV ((1 << __NVIC_PRIO_BITS) - 1)
|
2022-06-06 10:13:25 +01:00
|
|
|
|
|
|
|
static inline uint32_t raise_irq_pri(uint32_t pri) {
|
|
|
|
(void)pri;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void restore_irq_pri(uint32_t basepri) {
|
|
|
|
(void)basepri;
|
|
|
|
}
|