aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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
2020-02-04stm32/sdram: Expose the result of sdram startup test in stm32_main.Andrew Leech
This means boards can choose to only use it for gc heap if the test passes.
2020-02-04lib/utils: Change default value of pyexec_mode_kind to 0 to put in bss.odewdney
By simply reordering the enums for pyexec_mode_kind_t it eliminates a data variable which costs ROM to initialise it. And the minimal build now has nothing in the data section. It seems the compiler is smart enough so that the generated code for if-logic which tests these enum values is unchanged.
2020-02-04esp32/Makefile: Reorder includes to build with latest toolchain.Jim Mussared
Tested on: - IDF3.3.1 (old toolchain) - IDF4.0-beta1 (old toolchain) - IDF4.0-beta1 (new toolchain from install.sh / export.sh)
2020-02-04tests/cpydiff: Add os module environ differences.David Lechner
2020-02-04tests/cmdline: Add test for MICROPYINSPECT environment variable.David Lechner
When this variable is set to non-empty string it triggers the REPL after a command/module/file finishes running. The Python file without the file extension is because the cmdline: parser in run-test splits on spaces, so we can't use the -c option since `import os` can't be written without a space.
2020-02-04unix/modos: Implement putenv and unsetenv to complement getenv.David Lechner
CPython also has os.environ, which should be used instead of os.getenv() due to caching in the os.environ mapping. But for MicroPython it makes sense to only implement the basic underlying methods, ie getenv/putenv/ unsetenv.
2020-02-04unix/main: Add command-line -h option for printing help text.David Lechner
This adds a -h option to print the usage help text and adds a new, shorter error message that is printed when invalid arguments are given. This behaviour follows CPython (and other tools) more closely.
2020-02-04unix/main: Add #if guard around -v option usage and document -i/-m opts.David Lechner
This commit modifies the usage() function to only print the -v option help text when MICROPY_DEBUG_PRINTERS is enabled. The -v option requires this build option to be enabled for it to have any effect. The usage text is also modified to show the -i and -m options, and also show that running a command, module or file are mutually exclusive.
2020-02-04docs/unix: Add a new new quickref page for the UNIX port.David Lechner
This adds a new quickstart page for the UNIX port that documents the command line options and environment variables.
2020-02-04tests/cmdline/repl_inspect: Add new test for -i option.David Lechner
This adds a new test to verify that the inspect (-i) command line option works.
2020-02-04unix/main: Add support for MICROPYINSPECT environment variable.David Lechner
This adds support for a MICROPYINSPECT environment variable that works exactly like PYTHONINSPECT; per CPython docs: If this is set to a non-empty string it is equivalent to specifying the -i option. This variable can also be modified by Python code using os.environ to force inspect mode on program termination.
2020-02-04zephyr: Remove reference to syscall_macros_h_target.Maureen Helm
Zephyr removed the build target syscall_macros_h_target in commit f4adf107f31674eb20881531900ff092cc40c07f. Removes reference from MicroPython to fix build errors in the zephyr port. This change is not compatible with zephyr v2.1 or earlier. It will be compatible with Zephyr v2.2 when released.
2020-02-04zephyr: Replace deprecated time conversion macro.Maureen Helm
The SYS_CLOCK_HW_CYCLES_TO_NS macro was deprecated in zephyr commit 8892406c1de21bd5de5877f39099e3663a5f3af1. This commit updates MicroPython to use the new k_cyc_to_ns_floor64 api and fix build warnings in the zephyr port. This change is compatible with Zephyr v2.1 and later.
2020-02-04zephyr: Update include paths for Zephyr v2.0.Maureen Helm
Zephyr restructured its includes in v2.0 and removed compatibility shims after two releases in commit 1342dadc365ee22199e51779185899ddf7478686. Updates include paths in MicroPython accordingly to fix build errors in the zephyr port. These changes are compatible with Zephyr v2.0 and later.
2020-02-03docs/esp8266: In TCP tutorial, add HTTP response code and content-type.Jesse Andrews
Show how to send an HTTP response code and content-type. Without the response code Safari/iOS will fail. Without the content-type Lynx/Links will fail.
2020-02-01unix/main: Print usage and NLR errors to stderr instead of stdout.David Lechner
When stdout is redirected it is useful to have errors printed to stderr instead of being redirected. mp_stderr_print() can't be used in these two instances since the MicroPython runtime is not running so we use fprintf(stderr) instead.
2020-02-01nrf/boards/common.ld: Add ENTRY(Reset_Handler) in linker script.caochaowu
It's not strictly needed but can be helpful when using a debugger.
2020-02-01tools/pyboard.py: Change shebang to use python3.Michael Buesch
This script still works with Python 2 but Python 3 is recommended.
2020-02-01tools/pyboard.py: Use slice del instead of list.clear() for Py2 compat.Michael Buesch
Python 2 does not have list.clear().
2020-02-01tools/pyboard.py: Add option --no-follow to detach after sending script.Michael Buesch
This option makes pyboard.py exit as soon as the script/command is successfully sent to the device, ie it does not wait for any output. This can help to avoid hangs if the board is being rebooted with --comman (for example). Example usage: $ python3 ./tools/pyboard.py --device /dev/ttyUSB0 --no-follow \ --command 'import machine; machine.reset()'
2020-01-31py/modthread: Fix spelling error in comment.David Lechner
2020-01-31esp8266/modules/ntptime.py: Add comment about configuring NTP host.Damien George
The ability to change the host is a frequently requested feature, so explicitly document how it can be achieved using the existing code. See issues #2121, #4385, #4622, #5122, #5536.
2020-01-31stm32/powerctrl: Reenable PLL3 on H7 MCUs when waking from stop mode.Damien George
So that USB can work.
2020-01-31stm32/powerctrl: Improve support for changing system freq on H7 MCUs.Damien George
This commit improves pllvalues.py to generate PLL values for H7 MCUs that are valid (VCO in and out are in range) and extend for the entire range of SYSCLK values up to 400MHz (up to 480MHz is currently unsupported).
2020-01-31stm32/stm32_it: Don't call __HAL_USB_HS_EXTI_CLEAR_FLAG on H7 MCUs.Damien George
It doesn't exist on these MCUs.
2020-01-31stm32/sdio: Add support for H7 MCUs.Damien George
The cyw43 driver on stm32 will now work with H7 MCUs.
2020-01-31drivers/cyw43: Return early from cyw43_wifi_set_up if wifi_on fails.Damien George
2020-01-31drivers/cyw43: Include stdio.h in files that use printf.Damien George
2020-01-30stm32/boards/stm32f746_af.csv: Add ADC alt functions to correct pins.Damien George
2020-01-30stm32/powerctrl: Enable overdrive on F7 when waking from stop mode.Damien George
Because if the SYSCLK is set to 180MHz or higher it will require this to be on already.
2020-01-30stm32/powerctrl: Disable HSI if not needed to save a bit of power.Damien George
2020-01-30tests/basics: Expand test cases for equality of subclasses.Nicko van Someren
2020-01-30py: Support non-boolean results for equality and inequality tests.Nicko van Someren
This commit implements a more complete replication of CPython's behaviour for equality and inequality testing of objects. This addresses the issues discussed in #5382 and a few other inconsistencies. Improvements over the old code include: - Support for returning non-boolean results from comparisons (as used by numpy and others). - Support for non-reflexive equality tests. - Preferential use of __ne__ methods and MP_BINARY_OP_NOT_EQUAL binary operators for inequality tests, when available. - Fallback to op2 == op1 or op2 != op1 when op1 does not implement the (in)equality operators. The scheme here makes use of a new flag, MP_TYPE_FLAG_NEEDS_FULL_EQ_TEST, in the flags word of mp_obj_type_t to indicate if various shortcuts can or cannot be used when performing equality and inequality tests. Currently four built-in classes have the flag set: float and complex are non-reflexive (since nan != nan) while bytearray and frozenszet instances can equal other builtin class instances (bytes and set respectively). The flag is also set for any new class defined by the user. This commit also includes a more comprehensive set of tests for the behaviour of (in)equality operators implemented in special methods.