You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
3.6 KiB
100 lines
3.6 KiB
#include <stdint.h>
|
|
|
|
// options to control how Micro Python is built
|
|
|
|
#define MICROPY_ALLOC_PATH_MAX (128)
|
|
#define MICROPY_EMIT_THUMB (1)
|
|
#define MICROPY_EMIT_INLINE_THUMB (1)
|
|
#define MICROPY_ENABLE_GC (1)
|
|
#define MICROPY_ENABLE_FINALISER (1)
|
|
#define MICROPY_HELPER_REPL (1)
|
|
#define MICROPY_PY_BUILTINS_FLOAT (1)
|
|
#define MICROPY_ENABLE_SOURCE_LINE (1)
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
|
#define MICROPY_OPT_COMPUTED_GOTO (1)
|
|
|
|
#define MICROPY_PY_IO (0)
|
|
#define MICROPY_PY_FROZENSET (1)
|
|
#define MICROPY_PY_SYS_EXIT (1)
|
|
#define MICROPY_PY_SYS_STDFILES (1)
|
|
#define MICROPY_PY_CMATH (1)
|
|
|
|
// extra built in names to add to the global namespace
|
|
extern const struct _mp_obj_fun_native_t mp_builtin_help_obj;
|
|
extern const struct _mp_obj_fun_native_t mp_builtin_input_obj;
|
|
extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
|
|
#define MICROPY_PORT_BUILTINS \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
|
|
|
|
// extra built in modules to add to the list of known ones
|
|
extern const struct _mp_obj_module_t os_module;
|
|
extern const struct _mp_obj_module_t pyb_module;
|
|
extern const struct _mp_obj_module_t time_module;
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
|
|
|
|
// extra constants
|
|
#define MICROPY_PORT_CONSTANTS \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
|
|
|
|
// type definitions for the specific machine
|
|
|
|
#define BYTES_PER_WORD (4)
|
|
|
|
#define UINT_FMT "%u"
|
|
#define INT_FMT "%d"
|
|
|
|
typedef int32_t mp_int_t; // must be pointer size
|
|
typedef unsigned int mp_uint_t; // must be pointer size
|
|
typedef void *machine_ptr_t; // must be of pointer size
|
|
typedef const void *machine_const_ptr_t; // must be of pointer size
|
|
|
|
// There is no classical C heap in bare-metal ports, only Python
|
|
// garbage-collected heap. For completeness, emulate C heap via
|
|
// GC heap. Note that MicroPython core never uses malloc() and friends,
|
|
// so these defines are mostly to help extension module writers.
|
|
#define malloc gc_alloc
|
|
#define free gc_free
|
|
#define realloc gc_realloc
|
|
|
|
// We need to provide a declaration/definition of alloca()
|
|
#include <alloca.h>
|
|
|
|
// The following would be from a board specific file, if one existed
|
|
|
|
#define MICROPY_HW_BOARD_NAME "Teensy-3.1"
|
|
#define MICROPY_HW_MCU_NAME "MK20DX256"
|
|
|
|
#define MICROPY_HW_HAS_SWITCH (0)
|
|
#define MICROPY_HW_HAS_SDCARD (0)
|
|
#define MICROPY_HW_HAS_MMA7660 (0)
|
|
#define MICROPY_HW_HAS_LIS3DSH (0)
|
|
#define MICROPY_HW_HAS_LCD (0)
|
|
#define MICROPY_HW_ENABLE_RNG (0)
|
|
#define MICROPY_HW_ENABLE_RTC (0)
|
|
#define MICROPY_HW_ENABLE_TIMER (0)
|
|
#define MICROPY_HW_ENABLE_SERVO (0)
|
|
#define MICROPY_HW_ENABLE_DAC (0)
|
|
#define MICROPY_HW_ENABLE_I2C1 (0)
|
|
#define MICROPY_HW_ENABLE_SPI1 (0)
|
|
#define MICROPY_HW_ENABLE_SPI3 (0)
|
|
#define MICROPY_HW_ENABLE_CC3K (0)
|
|
|
|
#define MICROPY_HW_LED1 (pin_C5)
|
|
#define MICROPY_HW_LED_OTYPE (GPIO_MODE_OUTPUT_PP)
|
|
#define MICROPY_HW_LED_ON(pin) (pin->gpio->PSOR = pin->pin_mask)
|
|
#define MICROPY_HW_LED_OFF(pin) (pin->gpio->PCOR = pin->pin_mask)
|
|
|
|
#if 0
|
|
// SD card detect switch
|
|
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8)
|
|
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
|
|
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
|
|
#endif
|
|
|
|
#define MICROPY_MATH_SQRT_ASM (1)
|
|
|
|
#define MICROPY_HAL_H "teensy_hal.h"
|
|
#define MICROPY_PIN_DEFS_PORT_H "pin_defs_teensy.h"
|
|
|