summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-02rp2/modmachine: Implement additional functions incl unique_id and idle.Damien George
Added functions in the machine module are: - unique_id (returns 8 bytes) - soft_reset - idle - lightsleep, deepsleep (not power saving at the moment) - disable_irq, enable_irq - time_pulse_us Signed-off-by: Damien George <damien@micropython.org>
2021-02-02windows/msvc: Use same default python command as core.stijn
2021-02-02tests/run-tests: Change default Python command used on Windows.stijn
Default to just calling python since that is most commonly available: the official installer or zipfiles from python.org, anaconda, nupkg all result in python being available but not python3. In other words: the default used so far is wrong. Note that os.name is 'posix' when running the python version which comes with Cygwin or MSys2 so they are not affected by this. However of all possible ways to get Python on Windows, only Cygwin provides no python command so update the default way for running tests in the README.
2021-02-02stm32/mboot: Change debug compiler optimisation from -O0 to -Og.Andrew Leech
With mboot encrpytion and fsload enabled, the DEBUG build -O0 compiler settings result in mboot no longer fitting in the 32k sector. This commit changes this to -Og which also brings it into line with the regular stm32 build.
2021-02-02stm32/usbd_cdc_interface: Don't wait in usbd_cdc_tx_always if suspended.Damien George
MCUs with device-only USB peripherals (eg L0, WB) do not implement (at least not in the ST HAL) the HAL_PCD_DisconnectCallback event. So if a USB cable is disconnected the USB driver does not deinitialise itself (usbd_cdc_deinit is not called) and the CDC driver can stay in the USBD_CDC_CONNECT_STATE_CONNECTED state. Then if the USB was attached to the REPL, output can become very slow waiting in usbd_cdc_tx_always for 500ms for each character. The disconnect event is not implemented on these MCUs but the suspend event is. And in the situation where the USB cable is disconnected the suspend event is raised because SOF packets are no longer received. The issue of very slow output on these MCUs is fixed in this commit (really worked around) by adding a check in usbd_cdc_tx_always to see if the USB device state is suspended, and, if so, breaking out of the 500ms wait loop. This should also help all MCUs for a real USB suspend. A proper fix for MCUs with device-only USB would be to implement or somehow synthesise the HAL_PCD_DisconnectCallback event. See issue #6672. Signed-off-by: Damien George <damien@micropython.org>
2021-02-02examples/rp2: Add pio_uart_rx.py example.Tim Radvan
This was adapted from the `pio/uart_rx` example from the `pico-examples` repository: https://github.com/raspberrypi/pico-examples/blob/master/pio/uart_rx/uart_rx.pio It demonstrates the `jmp_pin` feature in action. Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-02-02rp2/rp2_pio: Add JMP PIN support for PIO.Tim Radvan
PIO state machines can make a conditional jump on the state of a pin: the `JMP PIN` command. This requires the pin to be configured with `sm_config_set_jmp_pin`, but until now we didn't have a way of doing that in MicroPython. This commit adds a new `jmp_pin=None` argument to `StateMachine`. If it is not `None` then we try to interpret it as a Pin, and pass its value to `sm_config_set_jmp_pin`. Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-02-02lib/pico-sdk: Update to latest version v1.0.1.Damien George
In particular it fixes GPIO19 so that it can be used as an output. Signed-off-by: Damien George <damien@micropython.org>
2021-02-02rp2/memmap_mp.ld: Update for latest SDK.graham sanderson
2021-02-02rp2/machine_pin: Change N_GPIOS to NUM_BANK0_GPIOS for pico-sdk compat.Andrew Scheller
This fixes machine_pin.c to build against the new pico-sdk coming down the pipeline, whilst still working with the existing version.
2021-02-01zephyr/machine_uart: Fix arg of machine_uart_ioctl to make it uintptr_t.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-01tests/extmod/utime_time_ns.py: Relax bounds on time_ns measurement.Damien George
Some devices have lower precision than 1ms for time_ns() (eg PYBv1.x has 3.9ms resolution of the RTC) so make the test more lenient for them. Signed-off-by: Damien George <damien@micropython.org>
2021-02-01github/workflows/ports_unix.yml: Add job for a reproducible build.iTitou
With a check for reproducible build date. Invocation of the test suite is not needed because it's already run in another job. Signed-off-by: iTitou <moiandme@gmail.com>
2021-01-31py/makeversionhdr: Honor SOURCE_DATE_EPOCH if present.iTitou
This environment variable, if defined during the build process, indicates a fixed time that should be used in place of "now" when such a time is explicitely referenced. This allows for reproducible builds of micropython. See https://reproducible-builds.org/specs/source-date-epoch/ Signed-off-by: iTitou <moiandme@gmail.com>
2021-01-31LICENSE,docs: Update copyright year range to include 2021.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-30docs/develop/natmod: Fix a small typo, con->can.Samuelson
2021-01-30py/persistentcode: Introduce MICROPY_PERSISTENT_CODE_SAVE_FILE option.David CARLIER
This should be enabled when the mp_raw_code_save_file function is needed. It is enabled for mpy-cross, and a check for defined(__APPLE__) is added to cover Mac M1 systems.
2021-01-30py/gc: Fix debug printing of pointer.stijn
When DEBUG_printf is the standard printf, compilers require the value for %p to be an actual pointer instead of an integer.
2021-01-30tools: Remove obsolete upip bootstrap script.stijn
The upip module is frozen into ports supporting it, and it is included in the source tree, so there is no need to get it from PyPi. Moreover the PyPi package referred to is an out-of-date version of upip which is basically unrelated to our upip.py because the source is taken from a fork of micropython-lib instead of this repository.
2021-01-30docs/esp8266/quickref: Add warning block about NeoPixel timing.Christopher Tse
2021-01-30esp8266/modules/neopixel.py: Add timing param to NeoPixel constructor.Christopher Tse
This matches the esp32 port.
2021-01-30nrf/README: Add use of "make submodules" in alternative build paragraph.Chris Hemingway
Add "make submodules" to commands when building for the first time. Otherwise, on a first time build, the submodules have not been checked out and a lot of `fatal error: nrfx.h: No such file or directory` errors are printed.
2021-01-30tools/makemanifest.py: Add check that freeze path is a directory.Jim Mussared
Avoids accidentally writing freeze("path/to/file.py") and getting unexpected results.
2021-01-30docs,stm32: Fix minor typos in RTC docs, and->an.Andrew Scheller
2021-01-30github/workflows: Add workflow to verify commit message format.stijn
Using the new tools/verifygitlog.py script.
2021-01-30tools/verifygitlog.py: Add script for verifying commit message format.stijn
The main rules enforced are: - At most 72 characters in the subject line, with a ": " in it. - At most 75 characters per line in the body. - No "noreply" email addresses.
2021-01-30lib/utils/pyexec: Remove obsolete LCD initialization.stijn
This was added a long time ago in 75abee206d1a575aa98a486d043c94d64df432c1 when USB host support was added to the stm (now stm32) port, and when this pyexec code was actually part of the stm port. It's unlikely to work as intended anymore. If it is needed in the future then generic hook macros can be added in pyexec.
2021-01-30py/qstr.h: Remove QSTR_FROM_STR_STATIC macro.stijn
It practically does the same as qstr_from_str and was only used in one place, which should actually use the compile-time MP_QSTR_XXX form for consistency; qstr_from_str is for runtime strings only.
2021-01-30extmod/nimble: Improve the flow control for l2cap recv path.Jim Mussared
If the _IRQ_L2CAP_RECV handler does the actual consumption of the incoming data (i.e. via l2cap_recvinto), rather than setting a flag for non-scheduler-context to handle it later, then two things can happen: - It can starve the VM (i.e. the scheduled task never terminates). This is because calling l2cap_recvinto will empty the rx buffer, which will grant more credits to the channel (an HCI command), meaning more data can arrive. This means that the loop in hal_uart.c that keeps reading HCI data from the uart and executing NimBLE events as they are created will not terminate, preventing other VM code from running. - There's no flow control (i.e. data will arrive too quickly). The channel shouldn't be given credits until after we return from scheduler context. It's preferable that no work is done in scheduler/IRQ context. But to prevent this being a problem this commit changes l2cap_recvinto so that if it is called in IRQ context, and the Python handler empties the rx buffer, then don't grant credits until the Python handler is complete. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-01-30stm32/rfcore: Fix flow control for IPCC RX IRQ.Jim Mussared
Don't clear the IPCC channel flag until we've actually handled the incoming data, or else the wireless firmware may clobber the IPCC buffer if more data arrives. This requires masking the IRQ until the data is handled. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-01-30github/workflows: Add CI workflow for rp2 port.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-30rp2: Add new port to Raspberry Pi RP2 microcontroller.Damien George
This commit adds a new port "rp2" which targets the new Raspberry Pi RP2040 microcontroller. The build system uses pure cmake (with a small Makefile wrapper for convenience). The USB driver is TinyUSB, and there is a machine module with most of the standard classes implemented. Some examples are provided in the examples/rp2/ directory. Work done in collaboration with Graham Sanderson. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29lib/pico-sdk: Add new pico-sdk submodule, for the rp2 port.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29extmod/modonewire: Use pin_od_high/pin_od_low instead of pin_write.Damien George
The pin is configured in open-drain mode so these od_high/od_low methods should be used. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29py/emitnative: Support binary ops on ARMv6M without use of ite instr.graham sanderson
2021-01-29extmod/modframebuf: Change int to unsigned int in format methods args.Damien George
These args are already bounds checked and clipped, and using unsigned ints can be more efficient. It also eliminates possible issues and compiler warnings with shifting of signed integers. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29lib/timeutils: Provide simple impl of extra funcs when Epoch is 1970.Damien George
Dates/times must be post 2000/1/1 to work correctly with these simple implementations. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29py/emitinlinethumb: Exclude code using #if when ARMV7M disabled.Damien George
So there are no references to undeclared asm_thumb_mov_reg_i16(). Signed-off-by: Damien George <damien@micropython.org>
2021-01-29tests: Move native for test from pybnative to micropython.Damien George
And make it generic so it can be run on any target. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29py/emitnative: Ensure encoding to load prelude_offset doesn't change sz.Damien George
Based on change made by Graham Sanderson. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29py/asmthumb: Add support for ARMv6M in native emitter.graham sanderson
Adds a new compile-time option MICROPY_EMIT_THUMB_ARMV7M which is enabled by default (to get existing behaviour) and which should be disabled (set to 0) when building native emitter support (@micropython.native) on ARMv6M targets.
2021-01-29tools/mpy-tool.py: List frozen modules in MICROPY_FROZEN_LIST_ITEM.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29py/objfun: Support fun.__globals__ attribute.Damien George
This returns a reference to the globals dict associated with the function, ie the global scope that the function was defined in. This attribute is read-only but the dict itself is modifiable, per CPython behaviour. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29tools/ci.sh: For ci_code_size_setup, update apt to install gcc-multilib.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/main: Introduce MICROPY_HW_FLASH_MOUNT_AT_BOOT config option.Damien George
It's enabled by default to retain the existing behaviour. A board can disable this option if it manages mounting the filesystem itself, for example in frozen code. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot/fwupdate.py: Refactor update_mpy with support for STATUS.Damien George
Changes are: - refactor to use new _create_element function - support extended version of MOUNT element with block size - support STATUS element Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot: Introduce MBOOT_ERRNO_xxx constants and use them.Damien George
So that a failed update via fsload can be more easily diagnosed. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot: Add ELEM_TYPE_STATUS element so application can get status.Damien George
This new element takes the form: (ELEM_TYPE_STATUS, 4, <address>). If this element is present in the mboot command then mboot will store to the given address the result of the filesystem firmware update process. The address can for example be an RTC backup register. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot: Don't auto-detect littlefs block size.Damien George
Instead it is now passed in as an optional parameter to the ELEM_MOUNT element, with a compile-time configurable default. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/main: Check block 0 and 1 when auto-detecting littlefs.Damien George
The superblock for littlefs is in block 0 and 1, but block 0 may be erased or partially written, so block 1 must be checked if block 0 does not have a valid littlefs superblock in it. Prior to this commit, if block 0 did not contain a valid littlefs superblock (but block 1 did) then the auto-detection would fail, mounting a FAT filesystem would also fail, and the system would reformat the flash, even though it may have contained a valid littlefs filesystem. This is now fixed. Signed-off-by: Damien George <damien@micropython.org>