ESP8266 port uses SDK 2.0, has more heap, has support for 512k devices This release brings some code size reductions to the core as well as more tests and improved coverage which is now at 94.3%. The time.ticks_diff(a, b) function has changed: the order of the arguments has been swapped so that it behaves like "a - b", and it can now return a negative number if "a" came before "b" (modulo the period of the ticks functions). For the ESP8266 port the Espressif SDK has been updated to 2.0.0, the heap has been increased from 28k to 36k, and there is support for 512k devices via "make 512k". upip is included by default as frozen bytecode. The network module now allows access-point reconnection without WiFi credentials, and exposes configuration for the station DHCP hostname. The DS18B20 driver now handles negative temperatures, and NeoPixel and APA102 drivers handle 4 bytes-per-pixel LEDs. For the CC3200 port there is now support for loading of precompiled .mpy files and threading now works properly with interrupts. A detailed list of changes follows. py core: - py.mk: automatically add frozen.c to source list if FROZEN_DIR is defined - be more specific with MP_DECLARE_CONST_FUN_OBJ macros - specialise builtin funcs to use separate type for fixed arg count - {modbuiltins,obj}: use MP_PYTHON_PRINTER where possible - modbuiltins: add builtin "slice", pointing to existing slice type - add "delattr" builtin, conditional on MICROPY_CPYTHON_COMPAT - sequence: fix reverse slicing of lists - fix null pointer dereference in mpz.c, fix missing va_end in warning.c - remove asserts that are always true in emitbc.c - fix wrong assumption that m_renew will not move if shrinking - change config default so m_malloc0 uses memset if GC not enabled - add MICROPY_FLOAT_CONST macro for defining float constants - move frozen bytecode Makefile rules from ports to common mk files - strip leading dirs from frozen mpy files, so any path can be used extmod: - vfs_fat_file: check fatfs f_sync() and f_close() returns for errors - vfs_fat_file: make file.close() a no-op if file already closed - utime_mphal: ticks_diff(): switch arg order, return signed value - utime_mphal: add MP_THREAD_GIL_EXIT/ENTER warppers for sleep functions - utime_mphal: implement ticks_add(), add to all maintained ports - utime_mphal: allow ticks functions period be configurable by a port lib: - utils/pyhelp.c: use mp_printf() instead of printf() - utils/pyexec: add mp_hal_set_interrupt_char() prototype - libm: move Thumb-specific sqrtf function to separate file drivers: - add "from micropython import const" when const is used tools: - upgrade upip to 1.1.4: fix error on unix when installing to non-existing absolute path - pip-micropython: remove deprecated wrapper tool - check_code_size.sh: code size validation script for CI - replace upip tarball with just source file, to make its inclusion as frozen modules in multiple ports less magic tests: - extmod/vfs_fat: improve VFS test coverage - basics/builtin_slice: add test for "slice" builtin name - basics: add test for builtin "delattr" - extmod/vfs_fat_fsusermount: improve fsusermount test coverage - extmod/vfs_fat_oldproto: test old block device protocol - basics/gc1: garbage collector threshold() coverage - extmod/uhashlib_sha1: coverage for SHA1 algorithm - extmod/uhashlib_sha256: rename sha256.py test - btree1: fix out of memory error running on esp8266 - extmod/ticks_diff: test for new semantics of ticks_diff() - extmod/framebuf1: test framebuffer pixel clear, and text function minimal port: - Makefile: split rule for firmware.bin generation unix port: - Makefile: remove references to deprecated pip-micropython - modtime: use ticks_diff() implementation from extmod/utime_mphal.c - mphalport.h: add warning of mp_hal_delay_ms() implementation - modtime: switch ticks/sleep_ms/us() to utime_mphal - fix symbol references for x86 Mac - replace upip tarball with just source file windows port: - enable utime_mphal following unix, define mp_hal_ticks_* - fix utime_mphal compilation for msvc - implement mp_hal_ticks_cpu in terms of QueryPerformanceCounter qemu-arm port: - exclude ticks_diff test for qemu-arm port - exclude extmod/vfs_fat_fileio.py test - exclude new vfs_fat tests - enable software floating point support, and float tests stmhal port: - modutime: refactor to use extmod's version of ticks_cpu - refactor pin usage to use mp_hal_pin API - led: refactor LED to use mp_hal_pin_output() init function - Makefile: use standard rules for frozen module generation - modutime: consistently convert to MP_ROM_QSTR/MP_ROM_PTR - enable SD power save (disable CLK on idle) cc3200 port: - use mp_raise_XXX helper functions to reduce code size - mods/pybspi: allow "write" arg of read/readinto to be positional - enable loading of precompiled .mpy files - fix thread mutex's so threading works with interrupts teensy port: - update to provide new mp_hal_pin_XXX functions following stmhal esp8266 port: - Makefile: use latest esptool.py flash size auto-detection - esp_init_data: auto-initialize system params with vendor SDK 2.0.0 - esp8266.ld: move help.o to iROM - esp8266.ld: move modmachine.o to iROM - esp8266.ld: move main.o to iROM - add MP_FASTCODE modifier to put a function to iRAM - main: mark nlr_jump_fail() as MP_FASTCODE - modules/webrepl: enforce only one concurrent WebREPL connection - etshal.h: add few more ESP8266 vendor lib prototypes - modesp: add flash_user_start() function - add support for building firmware version for 512K modules - scripts: make neopixel/apa102 handle 4bpp LEDs with common code - modutime: consistently convert to MP_ROM_QSTR/MP_ROM_PTR - modnetwork: config(): fix copy-paste error in setting "mac" - scripts/port_diag: add descriptions for esf_buf types - modnetwork.c: allows AP reconnection without WiFi credentials - main: bump heap size to 36K - etshal.h: add prototypes for SPIRead/SPIWrite/SPIEraseSector - etshal.h: adjust size of MD5_CTX structure - modules: fix negative temperature in ds18x20 driver - rename "machine" module implementation to use contemporary naming - rework webrepl_setup to run over wired REPL - espneopixel.c: solve glitching LED issues with cpu at 80MHz - include upip as a standard frozen bytecode module - update docs for esptool 1.2.1/SDK 2.0 (--flash_size=detect) - modnetwork.c: expose configuration for station DHCP hostname zephyr port: - implement utime module - use board/SoC values for startup banner based on Zephyr config - initial implementation of machine.Pin - zephyr_getchar: update for recent Zephyr refactor of console hooks - support time -> utime module "weaklink" - README: update for the current featureset, add more info - mpconfigport.h: move less important params to the bottom - Makefile: allow to adjust heap size from make command line - Makefile: update comments to the current state of affairs - Makefile: allow to override Zephyr config from make command line - Makefile: add minimal port - Makefile: add -fomit-frame-pointer to reduce code size - mphalport.h: update for new "unified" kernal API (sleep functions) docs: - machine.SPI: bring up to date with Hardware API, make vendor-neutral - machine.SPI: improve descriptions of xfer methods - library/builtins: add docs for delattr and slice - library/network: reword intro paragraph - library/network: typo fixes, consistent acronym capitalization - library/index: update TOCs so builtins sorted before modules - utime: document ticks_cpu() in more detail - utime: describe new semantics of ticks_diff() (signed ring arithmetics) - utime: add docs for ticks_add(), improvements for other ticks_*() - esp8266: update for new WebREPL setup procedure - */quickref.rst: use new semantics of ticks_diff() - library/machine.Pin: update Pin docs to align with new HW API travis: - integrate tools/check_code_size.sh - minimal: Use CROSS=1, for binary size check examples: - http_server_simplistic: add "not suitable for real use" note - hwapi: example showing best practices for HW API usage in apps - hwapi: add hwconfig for DragonBoard 410c
154 lines
5.4 KiB
C
154 lines
5.4 KiB
C
#include <stdint.h>
|
|
|
|
#ifndef __INCLUDED_MPCONFIGPORT_H
|
|
#define __INCLUDED_MPCONFIGPORT_H
|
|
|
|
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
|
|
|
|
// options to control how Micro Python is built
|
|
|
|
#define MICROPY_QSTR_BYTES_IN_HASH (1)
|
|
#define MICROPY_ALLOC_PATH_MAX (256)
|
|
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
|
|
// TODO(tannewt): Reduce this number if we want the REPL to function under 512
|
|
// free bytes.
|
|
// #define MICROPY_ALLOC_PARSE_RULE_INIT (64)
|
|
#define MICROPY_EMIT_X64 (0)
|
|
#define MICROPY_EMIT_THUMB (0)
|
|
#define MICROPY_EMIT_INLINE_THUMB (0)
|
|
#define MICROPY_COMP_MODULE_CONST (1)
|
|
#define MICROPY_COMP_CONST (1)
|
|
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
|
|
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1)
|
|
#define MICROPY_MEM_STATS (0)
|
|
#define MICROPY_DEBUG_PRINTERS (0)
|
|
#define MICROPY_ENABLE_GC (1)
|
|
#define MICROPY_GC_ALLOC_THRESHOLD (0)
|
|
#define MICROPY_REPL_EVENT_DRIVEN (0)
|
|
#define MICROPY_HELPER_REPL (1)
|
|
#define MICROPY_HELPER_LEXER_UNIX (0)
|
|
#define MICROPY_ENABLE_SOURCE_LINE (1)
|
|
#define MICROPY_ENABLE_DOC_STRING (0)
|
|
//#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
|
|
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
|
|
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
|
|
#define MICROPY_PY_ASYNC_AWAIT (0)
|
|
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
|
|
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
|
|
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
|
|
#define MICROPY_PY_BUILTINS_FILTER (1)
|
|
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
|
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
|
#define MICROPY_PY_BUILTINS_SET (1)
|
|
#define MICROPY_PY_BUILTINS_SLICE (1)
|
|
#define MICROPY_PY_BUILTINS_PROPERTY (1)
|
|
#define MICROPY_PY_BUILTINS_MIN_MAX (1)
|
|
#define MICROPY_PY___FILE__ (1)
|
|
#define MICROPY_PY_GC (1)
|
|
#define MICROPY_PY_ARRAY (1)
|
|
#define MICROPY_PY_ATTRTUPLE (1)
|
|
#define MICROPY_PY_COLLECTIONS (1)
|
|
#define MICROPY_PY_FRAMEBUF (1)
|
|
#define MICROPY_PY_MATH (1)
|
|
#define MICROPY_PY_CMATH (1)
|
|
#define MICROPY_PY_IO (0)
|
|
#define MICROPY_PY_URANDOM (1)
|
|
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
|
|
#define MICROPY_PY_STRUCT (1)
|
|
#define MICROPY_PY_SYS (1)
|
|
#define MICROPY_CPYTHON_COMPAT (0)
|
|
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
|
|
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
|
|
|
|
// fatfs configuration used in ffconf.h
|
|
#define MICROPY_FATFS_ENABLE_LFN (1)
|
|
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
|
|
#define MICROPY_FATFS_USE_LABEL (1)
|
|
#define MICROPY_FATFS_RPATH (2)
|
|
#define MICROPY_FATFS_VOLUMES (4)
|
|
#define MICROPY_FATFS_MULTI_PARTITION (1)
|
|
#define MICROPY_FSUSERMOUNT (1)
|
|
// Only enable this if you really need it. It allocates a byte cache of this
|
|
// size.
|
|
// #define MICROPY_FATFS_MAX_SS (4096)
|
|
|
|
#define FLASH_BLOCK_SIZE (512)
|
|
|
|
#define MICROPY_VFS_FAT (1)
|
|
#define MICROPY_PY_MACHINE (1)
|
|
#define MICROPY_MODULE_WEAK_LINKS (1)
|
|
#define MICROPY_REPL_AUTO_INDENT (1)
|
|
#define MICROPY_HW_ENABLE_DAC (1)
|
|
#define MICROPY_ENABLE_FINALISER (1)
|
|
#define MICROPY_USE_INTERNAL_PRINTF (1)
|
|
#define MICROPY_PY_SYS_STDFILES (1)
|
|
#define MICROPY_PY_IO_FILEIO (1)
|
|
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
|
#define MICROPY_PERSISTENT_CODE_LOAD (1)
|
|
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
|
|
|
|
// type definitions for the specific machine
|
|
|
|
#define BYTES_PER_WORD (4)
|
|
|
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
|
|
|
|
// This port is intended to be 32-bit, but unfortunately, int32_t for
|
|
// different targets may be defined in different ways - either as int
|
|
// or as long. This requires different printf formatting specifiers
|
|
// to print such value. So, we avoid int32_t and use int directly.
|
|
#define UINT_FMT "%u"
|
|
#define INT_FMT "%d"
|
|
typedef int mp_int_t; // must be pointer size
|
|
typedef unsigned mp_uint_t; // must be pointer size
|
|
|
|
typedef long mp_off_t;
|
|
|
|
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
|
|
|
// extra built in names to add to the global namespace
|
|
#define MICROPY_PORT_BUILTINS \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
|
|
|
|
// extra built in modules to add to the list of known ones
|
|
extern const struct _mp_obj_module_t machine_module;
|
|
extern const struct _mp_obj_module_t uos_module;
|
|
extern const struct _mp_obj_module_t utime_module;
|
|
extern const struct _mp_obj_module_t neopixel_write_module;
|
|
|
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&machine_module }, \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write),(mp_obj_t)&neopixel_write_module } \
|
|
|
|
// board specific definitions
|
|
#include "mpconfigboard.h"
|
|
|
|
#ifndef MICROPY_PIN_DEFS_PORT_H
|
|
#define MICROPY_PIN_DEFS_PORT_H "pins.h"
|
|
#endif
|
|
|
|
// We need to provide a declaration/definition of alloca()
|
|
#include <alloca.h>
|
|
|
|
#ifdef __linux__
|
|
#define MICROPY_MIN_USE_STDOUT (1)
|
|
#endif
|
|
|
|
#ifdef __thumb__
|
|
#define MICROPY_MIN_USE_CORTEX_CPU (1)
|
|
#define MICROPY_MIN_USE_SAMD21_MCU (1)
|
|
#endif
|
|
|
|
#define MP_STATE_PORT MP_STATE_VM
|
|
|
|
#define MICROPY_PORT_ROOT_POINTERS \
|
|
const char *readline_hist[8]; \
|
|
vstr_t *repl_line; \
|
|
mp_obj_t mp_kbd_exception; \
|
|
mp_obj_t pin_class_mapper; \
|
|
mp_obj_t pin_class_map_dict; \
|
|
|
|
#endif // __INCLUDED_MPCONFIGPORT_H
|