2023-05-01 13:11:19 +00:00
|
|
|
/* This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
* The MIT License (MIT)
|
|
|
|
* Copyright (c) 2022-2023 Damien P. George
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Include common MicroPython embed configuration.
|
|
|
|
#include <port/mpconfigport_common.h>
|
|
|
|
|
|
|
|
// Use the same starting configuration as on most bare-metal targets.
|
|
|
|
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
|
|
|
|
|
|
|
|
// MicroPython configuration.
|
|
|
|
#define MICROPY_ENABLE_COMPILER (1)
|
|
|
|
#define MICROPY_ENABLE_GC (1)
|
|
|
|
#define MICROPY_PY_GC (1)
|
|
|
|
|
|
|
|
#define MICROPY_PY_SYS_PLATFORM "embedded"
|
2023-05-03 20:51:59 +00:00
|
|
|
#define MICROPY_PY_OS_UNAME (1)
|
|
|
|
#define MICROPY_HW_BOARD_NAME "embedded"
|
|
|
|
#define MICROPY_HW_MCU_NAME "C"
|
2023-05-01 13:11:19 +00:00
|
|
|
|
2024-02-25 14:44:49 +00:00
|
|
|
// Enable the VFS subsystem, littlefs, importing from VFS, and the vfs module.
|
|
|
|
#define MICROPY_VFS (1)
|
|
|
|
#define MICROPY_VFS_LFS2 (1)
|
|
|
|
#define MICROPY_READER_VFS (1)
|
|
|
|
#define MICROPY_PY_VFS (1)
|
|
|
|
|
2023-05-03 20:56:59 +00:00
|
|
|
// Enable floating point numbers and the math module.
|
|
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
|
|
|
|
ports/embed: Implement additional time functions.
Optionally adds gmtime, localtime, mktime, time, time_ns to the time
module, implemented using mp_hal_time_ns(). This could also be used by
other ports.
I'm unsure where to put modtime_mphal.h, it could also be in extmod. The
important thing is that for MICROPY_PY_TIME_INCLUDEFILE to work it must be
at the same path in both the port build (original source tree) and the
application build (micropython_embed distribution), therefore not in
ports/embed/port.
It is named .h, mismatching the corresponding ports/*/modtime.c, because it
must not be compiled separately, which naming it .c would make harder for
users of the embed port - they would need to explicitly exclude it, whereas
this way they can continue to just compile all the .c files found in the
micropython_embed distribution except those in lib.
Signed-off-by: Christian Walther <cwalther@gmx.ch>
2023-05-05 17:37:49 +00:00
|
|
|
// Enable more functions in the time module. Requires additions to EMBED_EXTRA,
|
|
|
|
// see micropython_embed.mk.
|
|
|
|
#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)
|
|
|
|
#define MICROPY_PY_TIME_TIME_TIME_NS (1)
|
|
|
|
#define MICROPY_PY_TIME_INCLUDEFILE "shared/timeutils/modtime_mphal.h"
|
|
|
|
|
2023-05-01 13:11:19 +00:00
|
|
|
// Requires shared/readline/readline.h, don't bother as we have no input.
|
|
|
|
#define MICROPY_PY_BUILTINS_INPUT (0)
|
|
|
|
|
2023-05-01 14:35:26 +00:00
|
|
|
// Requires MICROPY_EVENT_POLL_HOOK, don't bother as we have no pollable objects.
|
|
|
|
#define MICROPY_PY_SELECT (0)
|
|
|
|
|
2023-05-05 21:17:32 +00:00
|
|
|
// On by default and works in this configuration, but disable it to avoid a
|
|
|
|
// linker error if you don't include extmod/moductypes.c in the build.
|
|
|
|
//#define MICROPY_PY_UCTYPES (0)
|
2023-05-01 13:11:19 +00:00
|
|
|
|
|
|
|
// Can be enabled once either shared/runtime/sys_stdio_mphal.c or
|
|
|
|
// extmod/vfs_posix_file.c is included in the build.
|
2024-03-30 22:26:51 +00:00
|
|
|
//#define MICROPY_PY_SYS_STDFILES (0)
|
2023-05-01 13:11:19 +00:00
|
|
|
|
|
|
|
// Can be enabled if you provide an implementation of
|
|
|
|
// mp_hal_set_interrupt_char() in mphal.c or include
|
|
|
|
// shared/runtime/interrupt_char.c in the build.
|
|
|
|
#define MICROPY_KBD_EXCEPTION (0)
|
2023-05-01 16:18:27 +00:00
|
|
|
|
|
|
|
// We have our own implementation of mp_hal_stdout_tx_strn_cooked().
|
|
|
|
#undef MP_PLAT_PRINT_STRN
|
2023-05-03 20:02:30 +00:00
|
|
|
|
|
|
|
// Enable freezing of Python modules. These would be set automatically for the
|
|
|
|
// port build based on the presence of FROZEN_MANIFEST by py/mkrules.mk, but
|
|
|
|
// must be set explicitly for the application build.
|
|
|
|
#define MICROPY_MODULE_FROZEN_MPY 1
|
|
|
|
#define MICROPY_MODULE_FROZEN_STR 1
|
|
|
|
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
|
|
|
|
// must match MPY_TOOL_FLAGS or defaults for mpy-tool.py arguments
|
|
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
|
|
|
#define MPZ_DIG_SIZE (16)
|