Loading...
Searching...
No Matches
mpconfigport.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Kaspar Schleiser <kaspar@schleiser.de>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
19
20#include <stdlib.h>
21#include <stdint.h>
22
23#include "kernel_defines.h"
24#include "irq.h"
25#include "stdio_base.h"
26
27/* RIOT's compiler_hints.h (pulled in above) defines NORETURN, and MicroPython's
28 * mpconfig.h redefines it (as MP_NORETURN) further down. Both expand to
29 * __attribute__((noreturn)), but the differing macro text trips -Werror on
30 * redefinition, so drop RIOT's definition and let MicroPython provide its
31 * own. */
32#undef NORETURN
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#define MICROPY_COMP_CONST_FOLDING (1)
39#define MICROPY_COMP_CONST (1)
40#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
41#define MICROPY_CPYTHON_COMPAT (1)
42#define MICROPY_ENABLE_GC (1)
43#define MICROPY_ENABLE_SCHEDULER (1)
44#define MICROPY_SCHEDULER_STATIC_NODES (1)
45#define MICROPY_ENABLE_SOURCE_LINE (1)
46#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
47#define MICROPY_HELPER_REPL (1)
48#define MICROPY_KBD_EXCEPTION (0)
49#define MICROPY_PY_ARRAY (1)
50#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
51#define MICROPY_PY_ASYNC_AWAIT (0)
52#define MICROPY_PY_ATTRTUPLE (1)
53#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
54#define MICROPY_PY_BUILTINS_ENUMERATE (1)
55#define MICROPY_PY_BUILTINS_FILTER (1)
56#define MICROPY_PY_BUILTINS_HELP (1)
57#define MICROPY_PY_BUILTINS_HELP_MODULES (1)
58#define MICROPY_PY_BUILTINS_HELP_TEXT riot_help_text
59#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
60#define MICROPY_PY_BUILTINS_MIN_MAX (1)
61#define MICROPY_PY_BUILTINS_PROPERTY (1)
62#define MICROPY_PY_BUILTINS_RANGE_ATTRS (1)
63#define MICROPY_PY_BUILTINS_REVERSED (1)
64#define MICROPY_PY_BUILTINS_SET (1)
65#define MICROPY_PY_CMATH (1)
66#define MICROPY_PY_COLLECTIONS (1)
67#define MICROPY_REPL_AUTO_INDENT (1)
68#define MICROPY_REPL_STDIN_BUFFER_MAX (STDIO_RX_BUFSIZE)
69#define MICROPY_STACK_CHECK (1)
70#define MICROPY_USE_INTERNAL_PRINTF (0)
71#define MICROPY_PY_IO (0)
72#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
73#define MICROPY_PY_MACHINE (1)
74#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
75#define MICROPY_PY_STRUCT (1)
76#define MICROPY_PY_MACHINE_SPI_MAKE_NEW machine_hw_spi_make_new
77#ifdef CONFIG_NETWORKING
78# define MICROPY_PY_UERRNO (1)
79# define MICROPY_PY_USOCKET (1)
80#endif
81#define MICROPY_EPOCH_IS_1970 (1)
82#define MICROPY_PY_TIME (1)
83#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)
84#define MICROPY_PY_TIME_TIME_TIME_NS (1)
85#define MICROPY_PY_TIME_INCLUDEFILE "modtime_riot.c"
86#define MICROPY_PY_SYS_MODULES (1)
87/* MicroPython's long long big integer implementation only supports a 32 bit
88 * word size, and it gains just a single bit over the small integers of a 64
89 * bit target anyway, so use the arbitrary precision implementation there. */
90#if UINTPTR_MAX > UINT32_MAX
91# define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
92#else
93# define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
94#endif
95#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
96#define MICROPY_FLOAT_USE_NATIVE_FLT16 (0)
97#define MICROPY_PY_BUILTINS_COMPLEX (0)
98
99#define MICROPY_PY_SYS_PLATFORM "RIOT"
100
101#define MICROPY_HW_BOARD_NAME "riot-" RIOT_BOARD
102#define MICROPY_HW_MCU_NAME RIOT_CPU
103
104#define MICROPY_MODULE_FROZEN_STR (0)
105
106typedef intptr_t mp_int_t;
107typedef uintptr_t mp_uint_t;
108typedef long mp_off_t;
109
110#define MICROPY_BEGIN_ATOMIC_SECTION() irq_disable()
111#define MICROPY_END_ATOMIC_SECTION(state) irq_restore(state)
112
113void mp_riot_sched_hook(void);
114#define MICROPY_SCHED_HOOK_SCHEDULED mp_riot_sched_hook()
115
116#define MICROPY_PORT_ROOT_POINTERS const char *readline_hist[8];
117
118#define MP_STATE_PORT MP_STATE_VM
119
120#ifdef __cplusplus
121}
122#endif
IRQ driver interface.
Common macros and compiler attributes/pragmas configuration.