Commit Graph

48 Commits

Author SHA1 Message Date
Scott Shawcroft bd36873362 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
2016-11-14 11:10:07 -08:00
Damien George 7bb0f7b0f6 drivers: Add "from micropython import const" when const is used.
Following best-practice use of the const feature, to make it compatible
with Python.
2016-11-03 12:41:11 +11:00
Damien George 571e6f26db py: Specialise builtin funcs to use separate type for fixed arg count.
Builtin functions with a fixed number of arguments (0, 1, 2 or 3) are
quite common.  Before this patch the wrapper for such a function cost
3 machine words.  After this patch it only takes 2, which can reduce the
code size by quite a bit (and pays off even more, the more functions are
added).  It also makes function dispatch slightly more efficient in CPU
usage, and furthermore reduces stack usage for these cases.  On x86 and
Thumb archs the dispatch functions are now tail-call optimised by the
compiler.

The bare-arm port has its code size increase by 76 bytes, but stmhal drops
by 904 bytes.  Stack usage by these builtin functions is decreased by 48
bytes on Thumb2 archs.
2016-10-21 16:26:01 +11:00
Damien George 4ebdb1f2b2 py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.
In order to have more fine-grained control over how builtin functions are
constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific,
with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW.  These names now
match the MP_DEFINE_CONST_FUN_OBJ macros.
2016-10-21 16:26:01 +11:00
Tony DiCola a23cc5aa14 drivers: Remove SSD1306 driver, it lives in separate micropython-adafruit-ssd1306 repo now. 2016-10-20 23:13:22 +00:00
Damien George e3d29996b3 driver/dht: Use mp_raise_OSError helper function. 2016-10-07 13:53:34 +11:00
Radomir Dopieralski ce1c786297 drivers/sdcard: Port the SDCard driver to new machine API.
With backwards compatibility for pyboard.
2016-09-01 17:44:07 +10:00
Damien George dfe056df6f drivers/wiznet5k: Fix indentation so it's not misleading.
Otherwise gcc 6.1.1 raises a misleading-indentation error.
2016-07-11 21:11:25 +01:00
Radomir Dopieralski ab8a5d5199 drivers/display/ssd1306: Add width arg and support 64px wide displays.
In particular, the WeMOS D1 Mini board comes with a shield that has a
64x48 OLED display. This patch makes it display properly, with the upper
left pixel being at (0, 0) and not (32, 0).

I tried to do this with the configuration commands, but there doesn't
seem to be a command that would set the column offset (there is one for
the line offset, though).
2016-06-26 13:09:31 +01:00
Radomir Dopieralski 43c8f545d2 drivers/display/ssd1306: update SSD1306_SPI to work with new API
Makes it work on the ESP8266.
2016-06-03 11:13:17 +01:00
Damien George 4940bee62a extmod: Add machine time_pulse_us function (at C and Python level).
The C implementation is taken from the DHT driver.
2016-05-31 13:58:48 +01:00
Damien George 48a7ef0576 drivers: Add C-level function to read DHT11 and DHT22 devices.
Uses mp_hal_pin API.
2016-05-26 17:10:06 +01:00
Damien George ce2d34d74f drivers/cc3000: Rename timeval to cc3000_timeval, to avoid clash.
The timeval struct can be defined by system C headers.
2016-05-10 23:46:00 +01:00
Damien George 73bc0c24ab drivers: Add SSD1306 OLED driver, with I2C and SPI interfaces. 2016-04-12 14:06:54 +01:00
Peter Hinch 2bd758fe96 drivers/sdcard: Add support for multi-block read/write; add SD test. 2016-02-02 11:16:15 +00:00
Damien George 24652228af drivers/sdcard: Allow up to 5 retries to initialise SD card.
Apparently some cards need more than 2 retries.  See issue #1482.
2015-10-10 00:07:40 +01:00
Damien George b0c08c8c17 drivers/nrf24l01: Fix SPI phase setting to match specs of nRF chip.
Addresses issue #1466.
2015-09-18 13:00:12 +00:00
Damien George a95b06fc6b drivers/onewire: Fix ds18x20.read_temp so it works when no rom given. 2015-07-30 23:10:39 +01:00
Damien George 2764a8ee8d stmhal: Remove std.h. It's not needed anymore. 2015-04-18 14:28:39 +01:00
danicampora 2b8a718d73 drivers: Update CC3100 driver library to SDK release version 1.1.0. 2015-03-16 00:42:08 +01:00
Damien George 9be0d599cd drivers: Add onewire driver and ds18x20 temperature sensor driver. 2015-03-03 01:29:52 +00:00
danicampora 5687ce7e35 drivers/cc3100: Remove simplelink trace messages completely.
Those trace messages have never proven to be useful and they make
the code 9K bigger.
2015-02-22 17:50:51 +01:00
Damien George 3611c1de14 drivers/cc3100: Remove dependence on debug.h. 2015-02-21 22:04:07 +00:00
danicampora 1cf82a9800 drivers/cc3100: Make wlan.c closer to TI original file. 2015-02-21 22:24:41 +01:00
Damien George 5ca1f5f9d9 cc3200: Get compiling with CC3100 driver from drivers/ directory. 2015-02-21 19:55:57 +00:00
Damien George 49c2ad4fb4 cc3200: Move CC3100 driver from cc3200/simplelink to drivers/cc3100.
This commit will not build, it exists just to track changes.
2015-02-21 19:52:07 +00:00
Damien George c223df5113 drivers/cc3000: Fix call to extint_register. 2015-01-07 23:54:19 +00:00
Damien George 2cf6dfa280 stmhal: Prefix includes with py/; remove need for -I../py. 2015-01-01 21:06:20 +00:00
Damien George 1570eaf0e3 drivers: Add SD card driver, controlled via SPI bus. 2014-12-27 20:23:14 +00:00
adminpete e6e8ad8ab2 drivers, nrf24: Nonblocking send now uses send_start and send_done. 2014-12-09 02:30:22 +00:00
adminpete 706955976c drivers, nrf24: Nonblocking send now done by generator. 2014-12-09 02:29:56 +00:00
Peter Hinch 5deceb842d drivers, nrf24: Add nonblocking send option etc. 2014-12-09 02:29:35 +00:00
Damien George d8f239263d drivers, wiznet5k: Add socket_reset; fix orderly shutdown in recv. 2014-12-04 18:57:18 +00:00
Damien George df242facdc drivers, cc3000: Cleaning up, make local functions static. 2014-11-21 19:46:24 +00:00
Damien George 877dba3e1a drivers: Add NRF24L01 driver (written in pure Python).
Comes with test script.  Copy both files to pyboard and run
"import nrf24l01test".
2014-10-02 19:36:56 +01:00
Damien George 8762418d0c drivers, cc3000: Wrap exported functions in a macro for renaming. 2014-09-30 23:25:42 +01:00
Damien George 9d2bf9c405 drivers, wiznet5k: Wrap exported functions in a macro for renaming.
3rd party drivers should not export generic names like "close".
2014-09-30 22:51:47 +01:00
Damien George bfa7b480a7 stmhal: For spi_init, add argument to select if NSS pin is enabled.
Most of the time you don't use the NSS pin of the SPI bus, and so it
shouldn't be enabled by default (this gave some bugs in the past).
2014-09-30 22:36:47 +01:00
Damien George f996d8854f drivers, cc3k: Move cc3000 driver from stmhal to drivers directory. 2014-09-26 00:56:45 +01:00
Damien George bcf041f1a3 stmhal: Add wiznet5k module, to control WIZnet ethernet adaptor.
Allows to create socket objects that support TCP and UDP in server and
client mode.  Interface is very close to standard Python socket class,
except bind and accept do not work the same (due to hardware not
supporting them in the usual way).

Not compiled by default.  To compile this module, use:
make MICROPY_PY_WIZNET5K=1
2014-09-01 22:52:38 +01:00
Damien George cdd40f149a drivers, wiznet5k: Make DNS service use HAL sys tick. 2014-09-01 22:52:38 +01:00
Damien George 9091e84454 drivers, wiznet5k: Add HAL_Delay(1) to "infinite" loops. 2014-09-01 22:52:38 +01:00
Damien George 7da9145e47 drivers, wiznet5k: Properly fix ARP bug with W5200 chipset. 2014-09-01 22:52:37 +01:00
Damien George 0c0550bff0 drivers, wiznet5k: Add W5200 support. 2014-09-01 22:52:37 +01:00
Damien George 79d17e3e7d drivers, wiznet5k: Change SPI interface to read/write multiple bytes. 2014-09-01 22:52:37 +01:00
Damien George 812cf62f43 drivers, wiznet5k: Fix IP addr verification. 2014-09-01 22:52:37 +01:00
Damien George 71224cb8db drivers: Initial import of WIZnet5x000 driver. 2014-09-01 22:52:37 +01:00
Damien George e07737d202 Added 'drivers' directory, intended to hold code for specific hardware. 2014-09-01 22:52:37 +01:00