Skip to content

Commit bd36873

Browse files
committed
Merge tag 'v1.8.6'
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
2 parents 722777c + 5a1d63f commit bd36873

177 files changed

Lines changed: 3221 additions & 1058 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ dist: trusty
33
language: c
44
compiler:
55
- gcc
6+
cache:
7+
directories:
8+
- "${HOME}/persist"
69

710
before_script:
811
# Extra CPython versions
@@ -29,7 +32,12 @@ script:
2932
- make -C atmel-samd BOARD=feather_m0_adalogger
3033
- make -C atmel-samd BOARD=feather_m0_basic
3134
- make -C atmel-samd BOARD=metro_m0_flash
32-
- make -C minimal test
35+
- make -C minimal CROSS=1 build/firmware.bin
36+
- ls -l minimal/build/firmware.bin
37+
- tools/check_code_size.sh
38+
- mkdir -p ${HOME}/persist
39+
# Save new firmware for reference, but only if building a main branch, not a pull request
40+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp minimal/build/firmware.bin ${HOME}/persist/; fi'
3341
- make -C unix deplibs
3442
- make -C unix
3543
- make -C unix nanbox

ACKNOWLEDGEMENTS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ indicating that they also supported the first campaign.
14481448
* 902 B Stevens
14491449
903 Cptnslick, US
14501450
904 janlj@me.com
1451-
905 São Caetano do Sul, SP, Brazil
1451+
905 Fabricio Biazzotto
14521452
906 Lenz Hirsch
14531453
907 SerSher, RU
14541454
908 Florian, DE

atmel-samd/Makefile

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ BOSSAC := tools/bossac_osx
2727

2828
HAL_DIR=hal/$(MCU_SERIES)
2929

30-
# Frozen bytecode configuration. Any .py files placed in the modules subdirectory
31-
# will be frozen into .mpy files and embedded in the firmware (like the ESP8266
32-
# port).
33-
MPY_CROSS = ../mpy-cross/mpy-cross
34-
MPY_TOOL = ../tools/mpy-tool.py
35-
FROZEN_MPY_DIR = modules
36-
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
37-
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
38-
3930
INC += -I.
4031
INC += -I..
4132
INC += -I../lib/mp-readline
@@ -114,6 +105,19 @@ else
114105
CFLAGS += -Os -DNDEBUG
115106
endif
116107

108+
ifneq ($(FROZEN_DIR),)
109+
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
110+
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
111+
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
112+
endif
113+
114+
ifneq ($(FROZEN_MPY_DIR),)
115+
# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and
116+
# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch).
117+
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
118+
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
119+
endif
120+
117121
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
118122
LIBM_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-file-name=libm.a)
119123
LDFLAGS = -Lasf/thirdparty/CMSIS/Lib/GCC/ -L $(dir $(LIBGCC_FILE_NAME)) -L $(dir $(LIBM_FILE_NAME)) -nostdlib -T $(LD_FILE) -Map=$@.map --cref --gc-sections
@@ -200,30 +204,15 @@ SRC_BINDINGS = \
200204
SRC_BINDINGS_EXPANDED = $(addprefix shared-bindings/, $(SRC_BINDINGS)) \
201205
$(addprefix common-hal/, $(SRC_BINDINGS))
202206

203-
SRC_AUTOGEN = \
204-
$(BUILD)/frozen_mpy.c \
205-
206207
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
207208
OBJ += $(addprefix $(BUILD)/, $(SRC_ASF:.c=.o))
208-
OBJ += $(addprefix $(BUILD)/, $(SRC_AUTOGEN:.c=.o))
209209
OBJ += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
210210
OBJ += $(addprefix $(BUILD)/, $(SRC_BINDINGS_EXPANDED:.c=.o))
211211

212212
SRC_QSTR += $(SRC_C) $(SRC_BINDINGS_EXPANDED) $(STM_SRC_C)
213213

214214
all: $(BUILD)/firmware.bin
215215

216-
# to build .mpy files from .py files
217-
$(BUILD)/$(FROZEN_MPY_DIR)/%.mpy: $(FROZEN_MPY_DIR)/%.py
218-
@$(ECHO) "MPY $<"
219-
$(Q)$(MKDIR) -p $(dir $@)
220-
$(Q)$(MPY_CROSS) -o $@ -s $(^:$(FROZEN_MPY_DIR)/%=%) $^
221-
222-
# to build frozen_mpy.c from all .mpy files
223-
$(BUILD)/frozen_mpy.c: $(FROZEN_MPY_MPY_FILES) $(BUILD)/genhdr/qstrdefs.generated.h
224-
@$(ECHO) "Creating $@"
225-
$(Q)$(PYTHON) $(MPY_TOOL) -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=none $(FROZEN_MPY_MPY_FILES) > $@
226-
227216
$(BUILD)/firmware.elf: $(OBJ)
228217
$(ECHO) "LINK $@"
229218
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)

atmel-samd/modmachine_pin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extern const mp_obj_type_t pin_cpu_pins_obj_type;
101101
extern const mp_obj_dict_t pin_cpu_pins_locals_dict;
102102
extern const mp_obj_dict_t pin_board_pins_locals_dict;
103103

104-
MP_DECLARE_CONST_FUN_OBJ(pin_init_obj);
104+
MP_DECLARE_CONST_FUN_OBJ_KW(pin_init_obj);
105105

106106
void pin_init0(void);
107107
uint32_t pin_get_mode(const pin_obj_t *pin);

atmel-samd/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// options to control how Micro Python is built
99

1010
#define MICROPY_QSTR_BYTES_IN_HASH (1)
11-
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
1211
#define MICROPY_ALLOC_PATH_MAX (256)
1312
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
1413
// TODO(tannewt): Reduce this number if we want the REPL to function under 512
@@ -57,7 +56,6 @@
5756
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
5857
#define MICROPY_PY_STRUCT (1)
5958
#define MICROPY_PY_SYS (1)
60-
#define MICROPY_MODULE_FROZEN_MPY (1)
6159
#define MICROPY_CPYTHON_COMPAT (0)
6260
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
6361
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)

bare-arm/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ typedef long mp_off_t;
6161
#define MP_PLAT_PRINT_STRN(str, len) (void)0
6262

6363
// extra built in names to add to the global namespace
64-
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
6564
#define MICROPY_PORT_BUILTINS \
6665
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
6766

cc3200/util/random.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
void rng_init0 (void);
3131
uint32_t rng_get (void);
3232

33-
MP_DECLARE_CONST_FUN_OBJ(machine_rng_get_obj);
33+
MP_DECLARE_CONST_FUN_OBJ_0(machine_rng_get_obj);
3434

3535
#endif // __RANDOM_H

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
# The short X.Y version.
7070
version = '1.8'
7171
# The full version, including alpha/beta/rc tags.
72-
release = '1.8.5'
72+
release = '1.8.6'
7373

7474
# The language for content autogenerated by Sphinx. Refer to documentation
7575
# for a list of supported languages.

docs/esp8266/general.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ and developers, who can diagnose themselves any issues arising from
7171
modifying the standard process).
7272

7373
Once the filesystem is mounted, ``boot.py`` is executed from it. The standard
74-
version of this file is created during first-time module set up and by
75-
default starts up a WebREPL daemon to handle incoming connections. This
76-
file is customizable by end users (for example, you may want to disable
77-
WebREPL for extra security, or add other services which should be run on
74+
version of this file is created during first-time module set up and has
75+
commands to start a WebREPL daemon (disabled by default, configurable
76+
with ``webrepl_setup`` module), etc. This
77+
file is customizable by end users (for example, you may want to set some
78+
parameters or add other services which should be run on
7879
a module start-up). But keep in mind that incorrect modifications to boot.py
7980
may still lead to boot loops or lock ups, requiring to reflash a module
80-
from scratch.
81+
from scratch. (In particular, it's recommended that you use either
82+
``webrepl_setup`` module or manual editing to configure WebREPL, but not
83+
both).
8184

8285
As a final step of boot procedure, ``main.py`` is executed from filesystem,
8386
if exists. This file is a hook to start up a user application each time

docs/esp8266/quickref.rst

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Use the :mod:`time <utime>` module::
8383
time.sleep_ms(500) # sleep for 500 milliseconds
8484
time.sleep_us(10) # sleep for 10 microseconds
8585
start = time.ticks_ms() # get millisecond counter
86-
delta = time.ticks_diff(start, time.ticks_ms()) # compute time difference
86+
delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference
8787

8888
Timers
8989
------
@@ -336,29 +336,27 @@ WebREPL (web browser interactive prompt)
336336
WebREPL (REPL over WebSockets, accessible via a web browser) is an
337337
experimental feature available in ESP8266 port. Download web client
338338
from https://github.com/micropython/webrepl (hosted version available
339-
at http://micropython.org/webrepl), and start the daemon on a device
340-
using::
339+
at http://micropython.org/webrepl), and configure it by executing::
341340

342-
import webrepl
343-
webrepl.start()
341+
import webrepl_setup
344342

345-
(Release versions have it started on boot by default.)
343+
and following on-screen instructions. After reboot, it will be available
344+
for connection. If you disabled automatic start-up on boot, you may
345+
run configured daemon on demand using::
346346

347-
On a first connection, you will be prompted to set password for future
348-
sessions to use.
347+
import webrepl
348+
webrepl.start()
349349

350350
The supported way to use WebREPL is by connecting to ESP8266 access point,
351351
but the daemon is also started on STA interface if it is active, so if your
352352
router is set up and works correctly, you may also use WebREPL while connected
353353
to your normal Internet access point (use the ESP8266 AP connection method
354354
if you face any issues).
355355

356-
WebREPL is an experimental feature and a work in progress, and has known
357-
issues.
356+
Besides terminal/command prompt access, WebREPL also has provision for file
357+
transfer (both upload and download). Web client has buttons for the
358+
corresponding functions, or you can use command-line client ``webrepl_cli.py``
359+
from the repository above.
358360

359-
There's also provision to transfer (both upload and download)
360-
files over WebREPL connection, but it has even more experimental status
361-
than the WebREPL terminal mode. It is still a practical way to
362-
get script files onto ESP8266, so give it a try using ``webrepl_cli.py``
363-
from the repository above. See the MicroPython forum for other
364-
community-supported alternatives to transfer files to ESP8266.
361+
See the MicroPython forum for other community-supported alternatives
362+
to transfer files to ESP8266.

0 commit comments

Comments
 (0)