aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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.
2020-01-30py/objtype: Make mp_obj_type_t.flags constants public, moved to obj.h.Damien George
2020-01-30stm32/boards/STM32F769DISC: Add config to use external SPI as filesys.Damien George
This board now has the following 3 build configurations: - mboot + external QSPI in XIP mode + internal filesystem - mboot + external QSPI with filesystem (the default) - no mboot + external QSPI with filesystem
2020-01-30stm32/Makefile: Allow a board's .mk file to add things to CFLAGS.Damien George
2020-01-30drivers, stm32: Support SPI/QSPI flash chips over 16MB.Andrew Leech
With a SPI flash that has more than 16MB, 32-bit addressing is required rather than the standard 24-bit. This commit adds support for 32-bit addressing so that the SPI flash commands (read/write/erase) are selected automatically depending on the size of the address being used at each operation.
2020-01-29py/mpthread.h: Use strong type for mp_thread_set_state() argument.David Lechner
This modifies the signature of mp_thread_set_state() to use mp_state_thread_t* instead of void*. This matches the return type of mp_thread_get_state(), which returns the same value. `struct _mp_state_thread_t;` had to be moved before `#include <mpthreadport.h>` since the stm32 port uses it in its mpthreadport.h file.
2020-01-29stm32/powerctrl: For F7, allow PLLM!=HSE when setting PLLSAI to 48MHz.Damien George
PLLM is shared among all PLL blocks on F7 MCUs, and this calculation to configure PLLSAI to have 48MHz on the P output previously assumed that PLLM is equal to HSE (eg PLLM=25 for HSE=25MHz). This commit relaxes this assumption to allow other values of PLLM.
2020-01-27py/nativeglue: Fix typo about where the native fun table enum is.Jim Mussared
2020-01-27py/emitnative: Stop after finding an unwind target.Jim Mussared
The loop searches backwards for a target, but doesn't stop after finding the first result, meaning that it'll always end up at the outermost exception handler.
2020-01-27py/emitnative: Use NULL for pending exception (not None).Jim Mussared
This previously made the native emitter incompatible with the bytecode emitter, and mp_resume (and subsequently mp_obj_generator_resume) expects the bytecode emitter behavior (i.e. throw==NULL).
2020-01-27tests: Add tests for generator throw and yield-from with exc handlers.Jim Mussared
This commit adds a generator test for throwing into a nested exception, and one when using yield-from with a pending exception cleanup. Both these tests currently fail on the native emitter, and are simplified versions of native test failures from uasyncio in #5332.
2020-01-26unix/unix_mphal: Add compile check for incompatible GIL+ASYNC_KBD_INTR.David Lechner
It is not safe to enable MICROPY_ASYNC_KBD_INTR and MICROPY_PY_THREAD_GIL at the same time. This will trigger a compiler error to ensure that it is not possible to make this mistake.
2020-01-26windows/windows_mphal: Release GIL during system calls.David Lechner
This releases the GIL during syscalls that could block.
2020-01-26py: Release GIL during syscalls in reader and writer code.David Lechner
This releases the GIL during POSIX system calls that could block.
2020-01-26extmod/vfs_posix: Release GIL during system calls.David Lechner
This releases the GIL during syscalls that could block.
2020-01-26unix: Release GIL during all system calls.David Lechner
Addition of GIL EXIT/ENTER pairs are: - modos: release the GIL during system calls. CPython does this as well. - moduselect: release the GIL during the poll() syscall. This call can be blocking, so it is important to allow other threads to run at this time. - modusocket: release the GIL during system calls. Many of these calls can be blocking, so it is important to allow other threads to run. - unix_mphal: release the GIL during the read and write syscalls in mp_hal_stdin_rx_chr and mp_hal_stdout_tx_strn. If we don't do this threads are blocked when the REPL or the builtin input function are used. - file, main, mpconfigport.h: release GIL during syscalls in built-in functions that could block.
2020-01-24unix/Makefile: Reserve CFLAGS_EXTRA/LDFLAGS_EXTRA for external use.Damien George
When CFLAGS_EXTRA/LDFLAGS_EXTRA (or anything) is set on the command line of a make invocation then it will completely override any setting or appending of these variables in the makefile(s). This means builds like the coverage variant will have their mpconfigvariant.mk settings overridden. Fix this by using CFLAGS/LDFLAGS exclusively in the makefile(s), reserving the CFLAGS_EXTRA/LDFLAGS_EXTRA variables for external command-line use only.
2020-01-24tests: Add boolean-as-integer formatting tests for fixed regression.Yonatan Goldschmidt
As suggested by @dpgeorge in #5538.