Commit Graph

7454 Commits

Author SHA1 Message Date
Scott Shawcroft 6e30b8ea92 atmel-samd: Move neopixel out of internal flash. 2016-11-18 16:17:56 -08:00
Scott Shawcroft 84edec4fad py: Fix typo in comment. 2016-11-18 16:17:56 -08:00
Damien George c28fed6b64 examples/accellog.py: Change 1: to /sd/, and update comment about FS. 2016-11-18 17:00:54 +11:00
Paul Sokolovsky 00d6f99cf1 examples/hwapi: Add hwconfig for console tracing of LED operations. 2016-11-18 07:20:26 +03:00
Radomir Dopieralski e81a5353cb extmod/machine_i2c: Release SDA on bus error 2016-11-17 12:43:13 +11:00
Radomir Dopieralski 9a82b67f39 extmod/machine_i2c: Raise an error when clock stretching times out 2016-11-17 12:43:13 +11:00
Radomir Dopieralski 702928915c extmod/machine_i2c: Make the clock stretching timeout configurable 2016-11-17 12:43:12 +11:00
Paul Sokolovsky b188d6e9db examples/hwapi: Add example for machine.time_pulse_us(). 2016-11-17 01:10:00 +03:00
Krzysztof Blazewicz 5e9057210a stmhal: Update HALCOMMITS due to change to hal. 2016-11-16 14:05:37 +01:00
Damien George e01e214259 stmhal/make-stmconst.py: Restore Python 2 compatibility. 2016-11-16 23:53:55 +11:00
Damien George 87f18c08c9 stmhal: Update HALCOMMITS due to change to hal. 2016-11-16 23:43:02 +11:00
Damien George c5621529c9 stmhal/make-stmconst.py: Add support for files with invalid utf8 bytes. 2016-11-16 23:29:02 +11:00
Krzysztof Blazewicz 4d9dce7759 stmhal/mphalport.h: use single GPIOx->BSRR register 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 13400e1375 stmhal/hal: do not include <stdio.h> in HAL headers
stdio.h was included in all HAL files only to provide
definition of NULL symbol

"stdio.h" includes "types.h" which contains some conflicting definitions
with "drivers/cc3000/inc/socket.h"
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 8fa0733647 stmhal/i2c: provide custom IRQ handlers
Use custom handlers providing minimal required functionality
because those provided by ST increase code size by almost 2 KiB.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 7604de3fc2 stmhal/can: clear FIFO flags in IRQ handler
HAL Driver before v1.4.2 had a bug which caused clearing all pending
flags in MSR, TSR, RF0R and RF1R instead of only the requested one.

This is why micropython got away without explicitly clearing flags
in IRQ handler.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz dc1ac5dc3a stmhal/dma: mark DMA sate as READY even if HAL_DMA_Init is skipped
Current version of HAL drivers checks if `hdma->State == HAL_DMA_STATE_READY`
before executing some functions.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 63ca7a211a stmhal/dma: precalculate register base and bitshift on handle init
Current version of HAL drivers optimize IRQ handler by using precalculated
DMA register address and stream bitshift instead of calculating it on every interrupt.

Since we skip call to `HAL_DMA_Init` on reused DMA, fields StreamBaseAddress and StreamIndex
of DMA handle are not initialized and thus leads to SegFault in `DMA_IRQHandler`.

HAL_DMA_Init is a big routine and we do not need to call it on each use of DMA
(ex.: series of I2C operations) and DMA_CalcBaseAndBitshift is really small and
releasing it increases code size by only 8 bytes.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 0280b2c1b1 stmhal/i2c: handle I2C IRQs
This is required by HAL Driver for error handling since v1.5.0
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz fa833f96df stmhal/make-stmconst.py: fix regex's to work with current CMSIS
CMSIS v2.5.0 removed all uint32_t casts and uses only Misra Cast (U)
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 7928b3e347 stmhal/boards: configure all F4 boards to work with new HAL
changes include:
* use single GPIO.BSRR instead of BSRRH and BSRRL
* change HSE_STARTUP_TIMEOUT to 100 ms
* define LSE_STARTUP_TIMEOUT to 5 s
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 6a8f6c119c stmhal/hal/sd: reapply HAL commit 09de030 for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz e2b4822189 stmhal/hal/rcc: reapply HAL commit c568a2b for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 4f7c5fa647 stmhal/hal: reapply HAL commit 9db719b for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz c79ff9930a stmhal/hal/sd: reapply HAL commit 1d7fb82 for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz a9fb88e1dc stmhal/hal/i2c: reapply HAL commit ea040a4 for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz e8b435d1f8 stmhal: apply STM32CubeF4 v1.13.1 patch - upgrade HAL driver to v1.5.2 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz c1fa33b493 stmhal: upgrade to STM32CubeF4 v1.13.0 - HAL v1.5.1 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 4f5c4fdd98 stmhal: upgrade to STM32CubeF4 v1.13.0 - CMSIS/Device 2.5.1 2016-11-16 12:43:27 +01:00
Damien George 32e98257e2 windows: Enable READER_POSIX to get access to lexer_new_from_file. 2016-11-16 20:27:12 +11:00
Damien George 85ae17c993 mpy-cross: Get compiling after recent persistent code refactors. 2016-11-16 20:25:36 +11:00
Damien George 5bdf1650de py/lexer: Make lexer use an mp_reader as its source. 2016-11-16 18:35:01 +11:00
Damien George 66d955c218 py/lexer: Rewrite mp_lexer_new_from_fd in terms of mp_reader. 2016-11-16 18:13:51 +11:00
Damien George e5ef15a9d7 py/lexer: Provide generic mp_lexer_new_from_file based on mp_reader.
If a port defines MICROPY_READER_POSIX or MICROPY_READER_FATFS then
lexer.c now provides an implementation of mp_lexer_new_from_file using
the mp_reader_new_file function.
2016-11-16 18:13:51 +11:00
Damien George 511c083811 py/lexer: Rewrite mp_lexer_new_from_str_len in terms of mp_reader_mem. 2016-11-16 18:13:50 +11:00
Damien George 6b239c271c py: Factor out persistent-code reader into separate files.
Implementations of persistent-code reader are provided for POSIX systems
and systems using FatFS.  Macros to use these are MICROPY_READER_POSIX and
MICROPY_READER_FATFS respectively.  If an alternative implementation is
needed then a port can define the function mp_reader_new_file.
2016-11-16 18:13:50 +11:00
Damien George 6810f2c134 py: Factor persistent code load/save funcs into persistentcode.[ch]. 2016-11-16 16:14:14 +11:00
Paul Sokolovsky 64db4080ce docs/library/index: Elaborate on u-modules.
Also, remove an "only" directive in u-modules description.
2016-11-16 01:18:19 +03:00
Damien George 30bca45e1a tests/basics: Add test for logical constant folding. 2016-11-15 16:48:49 +11:00
Damien George 9b525134d1 py/parse: Add code to fold logical constants in or/and/not operations.
Adds about 200 bytes to the code size when constant folding is enabled.
2016-11-15 16:48:49 +11:00
Damien George ed9c93f0f1 py/parse: Make mp_parse_node_new_leaf an inline function.
It is split into 2 functions, one to make small ints and the other to make
a non-small-int leaf node.  This reduces code size by 32 bytes on
bare-arm, 64 bytes on unix (x64-64) and 144 bytes on stmhal.
2016-11-15 16:48:48 +11:00
Damien George b0cbfb0492 py/parse: Move function to check for const parse node to parse.[ch]. 2016-11-15 16:48:48 +11:00
Damien George 3f8bb80eb2 cc3200/mods/pybspi: Remove SPI.MASTER constant, it's no longer needed. 2016-11-15 16:35:54 +11:00
Paul Sokolovsky 7602dc5f32 cc3200/pybspi: Remove static mode=SPI.MASTER parameter for latest HW API.
Per the latest HW API, "SPI" class implements only master side of the
protocol, so mode=SPI.MASTER (which was static for WiPy anyway) is not
required (or allowed). This change is required to correspond to updated
documentation of machine.SPI class which no longer lists "mode".
2016-11-15 16:31:57 +11:00
Damien George 659b06b250 py/*.mk: Replace uses of 'sed' with $(SED). 2016-11-15 16:09:43 +11:00
Dave Hylands 0400fa45ba py/mkrules.mk: Rework find command so it works on OSX.
The Mac version of find doesn't support -printf, so this changes
things to use sed to strip off the leading path element instead.
2016-11-15 16:07:48 +11:00
Paul Sokolovsky a0b2c6ad32 py/runtime: mp_resume: Fix exception handling for nanbox port. 2016-11-15 01:41:22 +03:00
Paul Sokolovsky 79d996a57b py/runtime: mp_resume: Handle exceptions in Python __next__().
This includes StopIteration and thus are important to make Python-coded
iterables work with yield from/await.

Exceptions in Python send() are still not handled and left for future
consideration and optimization.
2016-11-15 01:10:34 +03:00
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 a392b3aa75 docs: Remove references to readall() and update stream read() docs. 2016-11-14 23:31:40 +11:00