aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-02-20unix/mphalport.h: Fix build when MICROPY_USE_READLINE=0.Damien George
If the built-in input() is enabled (which it is by default) then it needs some form of readline, so supply it with one when MICROPY_USE_READLINE=0. Fixes issue #5658.
2020-02-20esp32: Move to IDF 4.0 release version.Jim Mussared
2020-02-20unix/mpthreadport: Fix Mac build by using SIGUSR1 if SIGRTMIN not avail.David Lechner
Some platforms, like Apple, don't define SIGRTMIN, so fall back to SIGUSR1 in such a case. Fixes #5659.
2020-02-18py/objexcept: Rename mp_obj_new_exception_msg_varg2 to ..._vlist.Damien George
Follow up to recent commit ad7213d3c31bccb26a3f54f7492ccf4b0cc920f3, the name "varg2" is misleading, vlist describes better that the argument is a va_list. This name also matches CircuitPython, which already has such helper functions.
2020-02-18extmod/modbluetooth_nimble: Fix wrong offset used for descriptor flags.Jim Mussared
2020-02-18extmod/modbluetooth.h: Fix typo in comment about registering services.Jim Mussared
2020-02-18stm32/sdram: Fix compile issue from unused sdram startup test flag.Andrew Leech
2020-02-18extmod/modbluetooth: Implement config getter for BLE rxbuf size.Thomas Friebel
Knowing the buffer size can be important, to ensure that valid data will be received.
2020-02-18unix/mpthreadport: Use SIGRTMIN+5 instead of SIGUSR1 for thread-GC.David Lechner
This changes the signal used to trigger garbage collection from SIGUSR1 to SIGRTMIN + 5. SIGUSR1 is quite common compared to SIGRTMIN (measured by google search results) and is more likely to conflict with libraries that may use the same signal. POSIX specifies that there are at least 8 real-time signal so 5 was chosen as a "random" number to further avoid potential conflict with libraries that may use SIGRTMIN or SIGRTMAX. Also, if we ever have a `usignal` module, it would be nice to leave SIGUSR1 and SIGUSR2 free for user programs.
2020-02-18py: Factor out definition of mp_float_union_t to one location.Damien George
2020-02-18nrf: Use MICROPY_HW_ENABLE_RNG instead of MICROPY_PY_RANDOM_HW_RNG.Damien George
The "random" module no longer uses the hardware RNG (the extmod version of this module has a pseudo-random number generator), so the config option MICROPY_PY_RANDOM_HW_RNG is no longer meaningful. This commit replaces it with MICROPY_HW_ENABLE_RNG, which controls whether the hardware RNG is included in the build.
2020-02-18nrf: Remove custom "random" module and use extmod version instead.Damien George
Hardware RNG code is moved to drivers/rng.[ch].
2020-02-16nrf/drivers/bluetooth: Fix variable initialisation error with older gcc.cccc
Without this change, arm-none-eabi-gcc version 4.9.3 (at least) would give a "missing braces around initializer" error.
2020-02-16unix/Makefile: Allow to install all variants of the executable.David Lechner
The install target is current broken when PROG is used to override the default executable name. This fixes it by removing the redundant TARGET variable and uses PROG directly instead. The install and uninstall targets are also moved to the common unix Makefile so that all variants can be installed in the same way.
2020-02-16unix/variants/standard: Fix role of PREFIX when used to install.David Lechner
Currently it is not possible to override PREFIX when installing micropython using the makefile. It is common practice to be able to run something like this: $ make install PREFIX=/usr DESTDIR=/tmp/staging This fixes such usage.
2020-02-16drivers/nrf24l01: Change pipe addrs in test to match Arduino addrs.Peter Hinch
These addresses were initially chosen to match the nRF24 Arduino library examples but they are byte-reversed. So change them to be on-air compatible with the Arduino library. Also, the data sheet for the nRF24 says that RX data pipes 1-5 must share the same top 32-bits, and must differ only in the LSbyte. The addresses used here (while correct because they are on TX pipe and RX pipe 0) are misleading in this sense, because it looks like they were chosen to share the top 32-bits per the datasheet.
2020-02-16unix/Makefile: Remove old variant targets that are no longer needed.Damien George
To eliminate confusion about what targets to use when building.
2020-02-16docs/develop: Detail how to add symbols to mp_fun_table for native mods.Thorsten von Eicken
2020-02-13py/obj.h: Remove TODO idea comment about truncated mp_map_t.David Lechner
It was suggested to move this to a GitHub issue rather than keep it in the code, which isn't really sustainable for all ideas.
2020-02-13py: Add mp_raise_msg_varg helper and use it where appropriate.Damien George
This commit adds mp_raise_msg_varg(type, fmt, ...) as a helper for nlr_raise(mp_obj_new_exception_msg_varg(type, fmt, ...)). It makes the C-level API for raising exceptions more consistent, and reduces code size on most ports: bare-arm: +28 +0.042% minimal x86: +100 +0.067% unix x64: -56 -0.011% unix nanbox: -300 -0.068% stm32: -204 -0.054% PYBV10 cc3200: +0 +0.000% esp8266: -64 -0.010% GENERIC esp32: -104 -0.007% GENERIC nrf: -136 -0.094% pca10040 samd: +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2020-02-13py: Add mp_raise_type helper macro and use it where appropriate.Damien George
This provides a more consistent C-level API to raise exceptions, ie moving away from nlr_raise towards mp_raise_XXX. It also reduces code size by a small amount on some ports.
2020-02-11py/objmodule.h: Remove obsolete mp_builtin_module_weak_links_map decl.Damien George
It was made obsolete in d2384efa809953152c57cbda4c339dfbaa64cf29
2020-02-11esp32/modsocket: Convert EADDRINUSE error code from lwip return value.Damien George
2020-02-11windows: Improve default search path.stijn
The default value for MICROPYPATH used in unix/main.c is "~/.micropython/lib:/usr/lib/micropython" which has 2 problems when used in the Windows port: - it has a ':' as path separator but the port uses ';' so the entire string is effectively discarded since it gets interpreted as a single path which doesn't exist - /usr/lib/micropython is not a valid path in a standard Windows environment Override the value with a suitable default.
2020-02-11unix/main: Use OS-dependent path separator when searching path.stijn
2020-02-11nrf/drivers: Use mp_raise_msg where appropriate, and shorten exc msgs.Damien George
If the exception doesn't need printf-style formatting then calling mp_raise_msg is more efficient. Also shorten exception messages to match style in core and other ports.
2020-02-11tests/basics: Add test for equality between tuple and namedtuple.Damien George
2020-02-11tests/basics: Add tests for equality between bool and int/float/complex.Damien George
False/True should be implicitly converted to 0/1 when compared with numeric types.
2020-02-11py: Expand type equality flags to 3 separate ones, fix bool/namedtuple.Damien George
Both bool and namedtuple will check against other types for equality; int, float and complex for bool, and tuple for namedtuple. So to make them work after the recent commit 3aab54bf434e7f025a91ea05052f1bac439fad8c they would need MP_TYPE_FLAG_NEEDS_FULL_EQ_TEST set. But that makes all bool and namedtuple equality checks less efficient because mp_obj_equal_not_equal() could no longer short-cut x==x, and would need to try __ne__. To improve this, this commit splits the MP_TYPE_FLAG_NEEDS_FULL_EQ_TEST flags into 3 separate flags to give types more fine-grained control over how their equality behaves. These new flags are then used to fix bool and namedtuple equality. Fixes issue #5615 and #5620.
2020-02-11tests/run-tests: Auto-skip extmod/ticks_diff, extmod/time_ms_us tests.Yonatan Goldschmidt
2020-02-10docs/library: Fix framebuf monochrome 1-bit modes, swapping HLSB/HMSB.Peter Hinch
This fix can be demonstrated by the following: b = bytearray(32) f = framebuf.FrameBuffer(b, 32, 8, framebuf.MONO_HLSB) f.pixel(0, 0, 1) print('MONO_HLSB', hex(b[0])) b = bytearray(32) f = framebuf.FrameBuffer(b, 32, 8, framebuf.MONO_HMSB) f.pixel(0, 0, 1) print('MONO_HMSB', hex(b[0])) Outcome: MONO_HLSB 0x80 MONO_HMSB 0x1
2020-02-07stm32/usbd_cdc_interface: Remove "interrupt_char != -1" check.Damien George
It's not needed. The C integer implicit promotion rules mean that the uint8_t of the incoming character is promoted to a (signed) int, matching the type of interrupt_char. Thus the uint8_t incoming character can never be equal to -1 (the value of interrupt_char that indicate that interruption is disabled).
2020-02-07unix, windows: Use mp_keyboard_interrupt instead of custom code.Damien George
The mp_keyboard_interrupt() function does exactly what is needed here, and using it gets ctrl-C working when MICROPY_ENABLE_SCHEDULER is enabled on these ports (and MICROPY_ASYNC_KBD_INTR is disabled).
2020-02-07py/scheduler: Move clearing of kbd traceback to mp_keyboard_interrupt.Damien George
This is a more logical place to clear the KeyboardInterrupt traceback, right before it is set as a pending exception. The clearing is also optimised from a function call to a simple store of NULL.
2020-02-07esp32/uart: Use core-provided mp_keyboard_interrupt, placed in IRAM.Damien George
2020-02-07esp8266: Put mp_keyboard_interrupt in IRAM.Damien George
It was originally in IRAM due to the linker script specification, but since the function moved from lib/utils/interrupt_char.c to py/scheduler.c it needs to be put back in IRAM.
2020-02-07py/scheduler: Allow a port to specify attrs for mp_keyboard_interrupt.Damien George
Functions like mp_keyboard_interrupt() may need to be called from an IRQ handler and may need to be in a special memory section, so provide a generic wrapping macro for a port to do this. The macro name is chosen to be MICROPY_WRAP_<function name in uppercase> so that (in the future with more wrappers) each function could potentially be handled separately.
2020-02-07tests/unix: Add coverage tests for kbd-intr and scheduler.Damien George
2020-02-07py/scheduler: Move mp_keyboard_interrupt from lib/utils to py core.Damien George
This function is tightly coupled to the state and behaviour of the scheduler, and is a core part of the runtime: to schedule a pending exception. So move it there.
2020-02-07lib/utils/pyexec: Handle pending exceptions after disabling kbd intrs.Damien George
Pending exceptions would otherwise be handled later on where there may not be an NLR handler in place. A similar fix is also made to the unix port's REPL handler. Fixes issues #4921 and #5488.
2020-02-07py/scheduler: Add "raise_exc" argument to mp_handle_pending.Damien George
Previous behaviour is when this argument is set to "true", in which case the function will raise any pending exception. Setting it to "false" will cancel any pending exception.
2020-02-07zephyr: Enable littlefs.Maureen Helm
Enables the littlefs (v1 and v2) filesystems in the zephyr port. Example usage with the internal flash on the reel_board or the rv32m1_vega_ri5cy board: import os from zephyr import FlashArea bdev = FlashArea(FlashArea.STORAGE, 4096) os.VfsLfs2.mkfs(bdev) os.mount(bdev, '/flash') with open('/flash/hello.txt','w') as f: f.write('Hello world') print(open('/flash/hello.txt').read()) Things get a little trickier with the frdm_k64f due to the micropython application spilling into the default flash storage partition defined for this board. The zephyr build system doesn't enforce the flash partitioning when mcuboot is not enabled (which it is not for micropython). For now we can demonstrate that the littlefs filesystem works on frdm_k64f by constructing the FlashArea block device on the mcuboot scratch partition instead of the storage partition. Do this by replacing the FlashArea.STORAGE constant above with the value 4.
2020-02-07zephyr: Implement block device protocol via zephyr flash map api.Maureen Helm
Introduces a new zephyr.FlashArea class that uses the zephyr flash map api to implement the uos.AbstractBlockDev protocol. The flash driver is enabled on the frdm_k64f board, reel_board, and rv32m1_vega_ri5cy board. The standard and extended block device protocols are both supported, therefore this class can be used with file systems like littlefs which require the extended interface.
2020-02-07zephyr: Enable fatfs.Maureen Helm
Enables the fatfs filesystem in the zephyr port. Example usage with an SD card on the mimxrt1050_evk board: import zephyr, os bdev = zephyr.DiskAccess('SDHC') os.VfsFat.mkfs(bdev) os.mount(bdev, '/sd') with open('/sd/hello.txt','w') as f: f.write('Hello world') print(open('/sd/hello.txt').read())
2020-02-07zephyr: Enable virtual file system and uos module.Maureen Helm
Enables the virtual file system and uos module in the zephyr port. No concrete file system implementations are enabled yet.
2020-02-07zephyr: Implement block device protocol via zephyr disk access api.Maureen Helm
Introduces a new zephyr.DiskAccess class that uses the zephyr disk access api to implement the uos.AbstractBlockDev protocol. This can be used with any type of zephyr disk access driver, which currently includes SDHC, RAM, and FLASH implementations. The SDHC driver is enabled on the mimxrt1050_evk board. Only the standard block device protocol (without the offset parameter) can be supported with the zephyr disk access api, therefore this class cannot be used with file systems like littlefs which require the extended interface. In the future it may be possible to implement the extended interface in a new class using the zephyr flash api.
2020-02-06tests/basics: Move test for "return" outside function to own file.Petr Viktorin
Because its behaviour is conditional on MICROPY_CPYTHON_COMPAT.
2020-02-06py/compile: Allow 'return' outside function in minimal builds.Petr Viktorin
A 'return' statement on module/class level is not correct Python, but nothing terribly bad happens when it's allowed. So remove the check unless MICROPY_CPYTHON_COMPAT is on. This is similar to MicroPython's treatment of 'import *' in functions (except 'return' has unsurprising behavior if it's allowed).
2020-02-04stm32/usbd_conf: Allow boards to configure USB HS ULPI NXT/DIR pins.Damien George
2020-02-04tests: Move CPy diff test to real test now that subclass equality works.Damien George
Testing for equality of subclassed strings now works, thanks to commit 3aab54bf434e7f025a91ea05052f1bac439fad8c