Commit Graph

1483 Commits

Author SHA1 Message Date
Damien George
98a3911c43 py/scheduler: Add "raise_exc" argument to mp_handle_pending.
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-07 16:08:20 +11:00
Maureen Helm
7a5752a748 zephyr: Enable littlefs.
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-07 11:24:06 +11:00
Maureen Helm
86a66960f9 zephyr: Implement block device protocol via zephyr flash map api.
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-07 11:24:06 +11:00
Maureen Helm
2d7ec8e704 zephyr: Enable fatfs.
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-07 11:24:06 +11:00
Maureen Helm
a0440b01ea zephyr: Enable virtual file system and uos module.
Enables the virtual file system and uos module in the zephyr port.
No concrete file system implementations are enabled yet.
2020-02-07 11:24:06 +11:00
Maureen Helm
cc19cf2549 zephyr: Implement block device protocol via zephyr disk access api.
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-07 11:24:06 +11:00
Damien George
d6a1e45caa stm32/usbd_conf: Allow boards to configure USB HS ULPI NXT/DIR pins. 2020-02-04 23:15:55 +11:00
Andrew Leech
ff9a61b5a8 stm32/sdram: Expose the result of sdram startup test in stm32_main.
This means boards can choose to only use it for gc heap if the test passes.
2020-02-04 18:18:41 +11:00
Jim Mussared
0645478475 esp32/Makefile: Reorder includes to build with latest toolchain.
Tested on:
- IDF3.3.1 (old toolchain)
- IDF4.0-beta1 (old toolchain)
- IDF4.0-beta1 (new toolchain from install.sh / export.sh)
2020-02-04 18:06:14 +11:00
David Lechner
f1b6e6bb15 unix/modos: Implement putenv and unsetenv to complement getenv.
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-04 17:54:31 +11:00
David Lechner
83439e38fc unix/main: Add command-line -h option for printing help text.
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-04 17:54:31 +11:00
David Lechner
5a63bc5a44 unix/main: Add #if guard around -v option usage and document -i/-m opts.
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-04 17:53:35 +11:00
David Lechner
122baa6787 unix/main: Add support for MICROPYINSPECT environment variable.
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-04 17:52:58 +11:00
Maureen Helm
bc3ce86a5a zephyr: Remove reference to syscall_macros_h_target.
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-04 17:10:24 +11:00
Maureen Helm
a7663b862e zephyr: Replace deprecated time conversion macro.
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-04 17:09:59 +11:00
Maureen Helm
c25e12d0dd zephyr: Update include paths for Zephyr v2.0.
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-04 17:09:19 +11:00
David Lechner
4ab8bee82f unix/main: Print usage and NLR errors to stderr instead of stdout.
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-01 22:44:08 +11:00
caochaowu
61f64c78a6 nrf/boards/common.ld: Add ENTRY(Reset_Handler) in linker script.
It's not strictly needed but can be helpful when using a debugger.
2020-02-01 00:09:44 +11:00
Damien George
e3ff52863b esp8266/modules/ntptime.py: Add comment about configuring NTP host.
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-31 23:54:11 +11:00
Damien George
af88e70414 stm32/powerctrl: Reenable PLL3 on H7 MCUs when waking from stop mode.
So that USB can work.
2020-01-31 23:25:18 +11:00
Damien George
2c8c2b935e stm32/powerctrl: Improve support for changing system freq on H7 MCUs.
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-31 23:25:18 +11:00
Damien George
03b73ce329 stm32/stm32_it: Don't call __HAL_USB_HS_EXTI_CLEAR_FLAG on H7 MCUs.
It doesn't exist on these MCUs.
2020-01-31 23:25:18 +11:00
Damien George
257b17ec10 stm32/sdio: Add support for H7 MCUs.
The cyw43 driver on stm32 will now work with H7 MCUs.
2020-01-31 23:25:18 +11:00
Damien George
31ba06ce84 stm32/boards/stm32f746_af.csv: Add ADC alt functions to correct pins. 2020-01-30 16:31:11 +11:00
Damien George
68db7e01d8 stm32/powerctrl: Enable overdrive on F7 when waking from stop mode.
Because if the SYSCLK is set to 180MHz or higher it will require this to be
on already.
2020-01-30 16:30:03 +11:00
Damien George
29b84ea798 stm32/powerctrl: Disable HSI if not needed to save a bit of power. 2020-01-30 16:29:45 +11:00
Damien George
96a4435be1 stm32/boards/STM32F769DISC: Add config to use external SPI as filesys.
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-30 14:40:38 +11:00
Damien George
7bb2bf965e stm32/Makefile: Allow a board's .mk file to add things to CFLAGS. 2020-01-30 14:39:46 +11:00
Andrew Leech
30501d3f54 drivers, stm32: Support SPI/QSPI flash chips over 16MB.
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-30 13:18:38 +11:00
David Lechner
b72cb0ca1b py/mpthread.h: Use strong type for mp_thread_set_state() argument.
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-29 17:10:32 +11:00
Damien George
a542c6d7e0 stm32/powerctrl: For F7, allow PLLM!=HSE when setting PLLSAI to 48MHz.
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-29 16:49:13 +11:00
David Lechner
d89ed3e62b unix/unix_mphal: Add compile check for incompatible GIL+ASYNC_KBD_INTR.
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-26 23:31:27 +11:00
David Lechner
bc3499f010 windows/windows_mphal: Release GIL during system calls.
This releases the GIL during syscalls that could block.
2020-01-26 23:27:40 +11:00
David Lechner
fee7e5617f unix: Release GIL during all system calls.
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-26 23:21:29 +11:00
Damien George
96716b46e1 unix/Makefile: Reserve CFLAGS_EXTRA/LDFLAGS_EXTRA for external use.
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-24 11:51:21 +11:00
Yonatan Goldschmidt
35e664d779 tests/unix: Add coverage tests for mp_obj_is_type() and variants. 2020-01-24 10:57:17 +11:00
Damien George
27f41e624c tests/unix: Add coverage test for mp_obj_new_exception_args.
Because it's no longer called anywhere in the code.
2020-01-23 13:37:25 +11:00
Damien George
dccace6f3f tests/unix: Add coverage tests for pairheap data structure. 2020-01-22 17:31:18 +11:00
Damien George
f70373c7b2 stm32/softtimer: Change linear linked list to a pairing heap. 2020-01-22 17:31:18 +11:00
stijn
599371b133 windows: Support word-based move/delete key sequences for REPL.
Translate common Ctrl-Left/Right/Delete/Backspace to the EMACS-style
sequences (i.e. Alt key based) for forward-word, backward-word, forwad-kill
and backward-kill.  Requires MICROPY_REPL_EMACS_WORDS_MOVE to be defined so
the readline implementation interprets these.
2020-01-22 16:54:19 +11:00
adzierzanowski
a55c17dc69 esp32/modnetwork: Add max_clients kw-arg to WLAN.config for AP setting.
This allows the user to configure the maximum number of clients that are
connected to the access point.  Resolves #5125.
2020-01-22 16:43:25 +11:00
Jim Mussared
3032ae1155 esp32: Enable NimBLE support on all builds (IDF 3.3 and 4.0).
This commit updates the IDFv3 version to v3.3.1, and enables the
"ubluetooth" module by default on IDFv3 builds.
2020-01-15 00:24:43 +11:00
JensDiemer
c14ff6194c esp8266/modules: Fix AttributeError in _boot.py if flash not formatted.
Prior to this commit, if the flash filesystem was not formatted then it
would error: "AttributeError: 'FlashBdev' object has no attribute 'mount'".
That is due to it not being able to detect the filesystem on the block
device and just trying to mount the block device directly.

This commit fixes the issue by just catching all exceptions.  Also it's not
needed to try the mount if `flashbdev.bdev` is None.
2020-01-14 23:53:49 +11:00
Memiks
4ab4bf3ec6 ports: Modify mp_hal_pin_write macro so it can be used as a function.
Even though it doesn't return anything it could still be used like a
function.  Addresses issue #5501.
2020-01-14 23:48:42 +11:00
Damien George
3448e69c2d tests/unix: Add coverage test for new mp_obj_int_get_uint_checked func. 2020-01-14 23:45:56 +11:00
Thorsten von Eicken
6632dd3981 esp32/modmachine: Add implementation of machine.soft_reset(). 2020-01-12 13:38:45 +11:00
Yonatan Goldschmidt
853aaa06f2 lib/mp-readline: Add word-based move/delete EMACS key sequences.
This commit adds backward-word, backward-kill-word, forward-word,
forward-kill-word sequences for the REPL, with bindings to Alt+F, Alt+B,
Alt+D and Alt+Backspace respectively.  It is disabled by default and can be
enabled via MICROPY_REPL_EMACS_WORDS_MOVE.

Further enabling MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE adds extra bindings
for these new sequences: Ctrl+Right, Ctrl+Left and Ctrl+W.

The features are enabled on unix micropython-coverage and micropython-dev.
2020-01-12 13:09:27 +11:00
Jim Mussared
977b532c8f unix: Rename unix binaries to micropython-variant (not _variant).
For consistency with mpy-cross, and other unix tools in general.
2020-01-12 10:37:40 +11:00
Jim Mussared
2357338e93 unix: Add placeholder DEV variant with settrace enabled.
This will eventually become the "full featured" unix binary with more
features enabled, specifically useful for development and testing.
2020-01-12 10:37:23 +11:00
Jim Mussared
bd2fff6687 unix: Add build variants, analogous to boards on bare-metal.
Invoking "make" will still build the standard "micropython" executable, but
other variants are now build using, eg, "make VARIANT=minimal".  This
follows how bare-metal ports specify a particular board, and allows running
any make target (eg clean, test) with any variant.

Convenience targets (eg "make coverage") are provided to retain the old
behaviour, at least for now.

See issue #3043.
2020-01-12 10:34:23 +11:00
Damien George
bfbd94401d py: Make mp_obj_get_type() return a const ptr to mp_obj_type_t.
Most types are in rodata/ROM, and mp_obj_base_t.type is a constant pointer,
so enforce this const-ness throughout the code base.  If a type ever needs
to be modified (eg a user type) then a simple cast can be used.
2020-01-09 11:25:26 +11:00
Damien George
e3187b052f stm32/boards/PYBD: Change RTC asynch prediv from 1 to 4.
This change has the following effects:
- Reduces the resolution of the RTC sub-second counter from 30.52us to
  122.07us.
- Allows RTC.calibration() to now support positive values (as well as
  negative values).
- Reduces VBAT current consumption in standby mode by a small amount.

For general purpose use 122us resolution of the sub-second counter is
good enough, and the benefits of full range calibration and minor reduction
in VBAT consumption are worth the change.
2020-01-07 23:59:29 +11:00
Damien George
99b8c1a937 esp32/Makefile: Assign result of $call to dummy var for older make.
Make version 4.1 and lower does not allow $call as the main expression on a
line, so assign the result of the $call to a dummy variable.

Fixes issue #5426.
2020-01-06 23:03:22 +11:00
Nicko van Someren
4c93955b7b py/objslice: Add support for indices() method on slice objects.
Instances of the slice class are passed to __getitem__() on objects when
the user indexes them with a slice.  In practice the majority of the time
(other than passing it on untouched) is to work out what the slice means in
the context of an array dimension of a particular length.  Since Python 2.3
there has been a method on the slice class, indices(), that takes a
dimension length and returns the real start, stop and step, accounting for
missing or negative values in the slice spec.  This commit implements such
a indices() method on the slice class.

It is configurable at compile-time via MICROPY_PY_BUILTINS_SLICE_INDICES,
disabled by default, enabled on unix, stm32 and esp32 ports.

This commit also adds new tests for slice indices and for slicing unicode
strings.
2019-12-28 23:55:15 +11:00
Tim Gates
007a704d82 nrf/examples: Fix typo in mountsd.py, wireing -> wiring. 2019-12-28 12:07:30 +11:00
Damien George
269c9a08b6 unix/modos: Add uos.rename and uos.rmdir.
The existing uos.remove cannot be used to remove directories, instead
uos.rmdir is needed.  And also provide uos.rename to get a good set of
filesystem functionality without requiring additional Python-level os
functions (eg using ffi).
2019-12-28 11:54:49 +11:00
Andrew Leech
1b844e908c unix/modtime: Add utime.mktime function, to complement utime.localtime.
This also adds it to the windows port.
2019-12-28 11:11:54 +11:00
Yonatan Goldschmidt
b2e4a57289 nrf/main: Remove unnecessary repl_info(0) call.
It's statically initialized to 0.
2019-12-28 00:08:31 +11:00
Yonatan Goldschmidt
61d2b40ad5 lib/utils/pyexec: Introduce MICROPY_REPL_INFO, wrap debug prints in it.
For the 3 ports that already make use of this feature (stm32, nrf and
teensy) this doesn't make any difference, it just allows to disable it from
now on.

For other ports that use pyexec, this decreases code size because the debug
printing code is dead (it can't be enabled) but the compiler can't deduce
that, so code is still emitted.
2019-12-28 00:05:39 +11:00
David Lechner
e79424d672 ports: Allow overriding CROSS_COMPILE in a custom makefile.
Many ports already allow overriding CROSS_COMPILE.  This modifies the
remaining ports to allow it as well.
2019-12-27 23:53:16 +11:00
Damien George
93509ac8c7 stm32: Add configuration to build in nanbox mode.
Most stm32 boards can now be built in nan-boxing mode via:

    $ make NANBOX=1

Note that if float is enabled then it will be forced to double-precision.
Also, native emitters will be disabled.
2019-12-27 22:54:53 +11:00
Damien George
d980d51807 stm32: Fix to build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
d97b40bdaa py: Introduce MP_ROM_FALSE/MP_ROM_TRUE for ROM to refer to bool objects.
This helps to prevent mistakes, and allows easily changing the ROM value of
False/True if needed.
2019-12-27 22:54:20 +11:00
Damien George
09376f0e47 py: Introduce MP_ROM_NONE macro for ROM to refer to None object.
This helps to prevent mistakes, and allows easily changing the ROM value of
None if needed.
2019-12-27 22:51:17 +11:00
Jim Mussared
90f286465b stm32/mbedtls: Resize mbedtls output buffer from 16 down to 4 kiB.
To reduce the size of the SSL context on the heap.  See issue #5303.
2019-12-21 00:02:24 +11:00
Damien George
7ac326c424 stm32/boards/PYBD: Include webrepl helper scripts in frozen manifest. 2019-12-20 13:20:20 +11:00
Jim Mussared
7ce1e0b1dc extmod/webrepl: Move webrepl scripts to common place and use manifest.
Move webrepl support code from ports/esp8266/modules into extmod/webrepl
(to be alongside extmod/modwebrepl.c), and use frozen manifests to include
it in the build on esp8266 and esp32.

A small modification is made to webrepl.py to make it work on non-ESP
ports, i.e. don't call dupterm_notify if not available.
2019-12-20 12:59:13 +11:00
Matt Trentini
0e0e6132fd esp32/esp32_rmt: Add initial support for RMT peripheral.
This is an ESP32-specific peripheral so lives in the esp32 module.
2019-12-20 12:24:51 +11:00
David Lechner
882533ad92 qemu-arm/Makefile: Allow overriding CROSS_COMPILE from another makefile. 2019-12-19 17:59:32 +11:00
iabdalkader
3078a4b2e2 stm32/timer: Add missing TIM 1/15/16/17 IRQ handlers for H7 MCUs. 2019-12-19 17:19:53 +11:00
roland van straten
43b576d88d stm32/boards/NUCLEO_H743ZI: Add extra pins and peripheral definitions.
- Corrected pin assignments and checked with CubeMX.
- Added additional I2C and UARTs.
- Added Ethernet interface definitions with lwIP and SSL support (but
  Ethernet is currently unsupported on H7 MCUs so not fully enabled).
2019-12-19 16:54:33 +11:00
roland van straten
26a78edb49 stm32/boards/NUCLEO_F767ZI: Update pins, peripherals and total flash.
- Removed remarks on DFU/OCD in mpconfigboard.h because deploy-stlink works
  fine too.
- Added more UARTs, I2C, corrected SPI, CAN, etc; verified against CubeMX.
- Adapted pins.csv to remove errors, add omissions, etc. according to
  NUCLEO-144 User Manual.
- Changed linker file stm32f767.ld to reflect correct size of the Flash.
- Tested with LAN and SD card.
2019-12-19 11:43:19 +11:00
roland van straten
8af139e8a4 stm32/boards/NUCLEO_F767ZI: Add pins and config for using an SD card.
The Nucleo board does not have an SD card slot but does have the requisite
pins next to each other and labelled, so provide the configuration for
convenience.
2019-12-19 11:28:47 +11:00
Seon Rozenblum
0d82f5d8c8 esp32/boards/TINYPICO: Add tinypico.py, dotstar.py with custom manifest. 2019-12-19 10:05:01 +11:00
Damien George
1e2f751591 qemu-arm: Let tinytest.o be built by standard build rules.
This makes sure tinytest.o is rebuilt if any of its dependencies change.
2019-12-17 13:32:07 +11:00
Damien George
fb01415599 stm32/boards/PYBD_SF2: Configure LEDs as inverted, for LED.intensity(). 2019-12-13 17:28:24 +11:00
Damien George
71c6bfd08a stm32/modusocket: Handle case of NULL NIC in socket ioctl. 2019-12-13 14:45:21 +11:00
Damien George
c2eaf56634 stm32/Makefile: Enable max buffer size on W5200 NIC when used with lwIP.
Because in network_wiznet5k the TX/RX buffers are set to 16k each when in
MACRAW mode, which is used with lwIP.
2019-12-13 12:36:12 +11:00
Damien George
b47e155bd0 py/persistentcode: Add ability to relocate loaded native code.
Implements text, rodata and bss generalised relocations, as well as generic
qstr-object linking.  This allows importing dynamic native modules on all
supported architectures in a unified way.
2019-12-12 20:15:28 +11:00
Jim Mussared
b76f0a73bc stm32/main: Fix SKIPSD file detection so SD card is mounted by default.
The condition for skipping was accidentally inverted in
7723dac337

Fixes issue #5400.
2019-12-09 17:01:30 +11:00
Daniel Mizyrycki
2df6a0436d nrf/boards/particle_xenon: Enable USB CDC on Particle Xenon board. 2019-12-09 14:10:24 +11:00
Damiano Mazzella
cc634b9e92 stm32/boards/xxx_WB55: Enable littlefs2 on WB55 boards. 2019-12-09 14:07:29 +11:00
Andrej Krejcir
210d053286 nrf/main: Execute boot.py/main.py frozen modules without a file system.
When the file system is not enabled, the boot.py and main.py modules will
still be executed, if they are frozen.
2019-12-05 23:11:12 +11:00
Chris Mason
d61e7a6d8a stm32/uart: Add support for UART4/5 on L0 MCUs. 2019-12-05 15:31:41 +11:00
Andrew Leech
9ca8a503ed esp32/boards: Enable ULP in base sdk configuration.
Fixes issue #5159.
2019-12-05 15:28:56 +11:00
Damien George
40cc7ec677 stm32/mpconfigport.h: Use IRQ_PRI_PENDSV to protect bluetooth ringbuf.
The default protection for the BLE ringbuf is to use
MICROPY_BEGIN_ATOMIC_SECTION, which disables all interrupts. On stm32 it
only needs to disable the lowest priority IRQ, pendsv, because that's the
IRQ level at which the BLE stack is driven.
2019-12-04 13:39:22 +11:00
Damien George
ba5e4841ec stm32/main: Fix auto creation of pyb.Flash on boot with kw-only args. 2019-11-27 22:47:05 +11:00
Damien George
11c22430d4 stm32/boards/NUCLEO_L073RZ: Skip board-pin names for CPU only pins.
This board doesn't have much flash and removing these unneeded names saves
about 900 bytes of code size.
2019-11-27 21:59:47 +11:00
Damien George
77b8f86a5e stm32/qstrdefsport.h: Remove unused qstrs and make USB ones conditional.
qstrs in this file are always included in all builds, even if not used
anywhere.  So remove those that are never needed, and make USB names
conditional on having USB enabled.
2019-11-27 21:59:47 +11:00
Damien George
797c2e8fc2 stm32/storage: Make start/len args of pyb.Flash keyword only.
To allow the future possibility of initial positional args, like flash id.
2019-11-26 21:35:00 +11:00
Damien George
d8057c325a stm32/storage: Change storage_read/write_blocks to return int type.
And return -MP_EIO if calling storage_read_block/storage_write_block fails.
This lines up with the return type and value (negative for error) of the
calls to MICROPY_HW_BDEV_READBLOCKS (and WRITEBLOCKS, and BDEV2 versions).
2019-11-26 00:08:57 +11:00
Damien George
120368ba1a stm32/boards: Enable LFS2 on PYBv1.x and PYBD boards. 2019-11-26 00:08:57 +11:00
Damien George
715e4fc25f stm32/moduos: Add VfsLfs1 and VfsLfs2 to uos module, if enabled. 2019-11-26 00:07:09 +11:00
Damien George
7897f5d9be stm32/main: Auto detect block device used for main filesystem. 2019-11-26 00:07:09 +11:00
Damien George
c169094f61 stm32/storage: Make pyb.Flash configurable, and support ext block proto.
The pyb.Flash() class can now be used to construct objects which reference
sections of the flash storage, starting at a certain offset and going for a
certain length.  Such objects also support the extended block protocol.
The signature for the constructor is: pyb.Flash(start=-1, len=-1).
2019-11-26 00:07:09 +11:00
Damien George
7723dac337 stm32: Generalise flash mounting code so it supports arbitrary FS.
This commit refactors and generalises the boot-mount routine on stm32 so
that it can mount filesystems of arbitrary type.  That is, it no longer
assumes that the filesystem is FAT.  It does this by using mp_vfs_mount()
which does auto-detection of the filesystem type.
2019-11-25 18:10:58 +11:00
Jim Mussared
fbb7646e3b stm32/nimble_hci_uart.c: Prevent scheduler running during CYW-BT wakeup.
Using mp_hal_delay_ms allows the scheduler to run, which might result in
another transmit operation happening, which would bypass the sleep (and
fail).  Use mp_hal_delay_us instead.
2019-11-25 17:32:10 +11:00
Josh Lloyd
1530fda9cf esp32/machine_rtc: Reduce memory footprint of user mem functionality. 2019-11-21 16:55:12 +11:00
Josh Lloyd
ed2314f35a esp32/machine_rtc: Make RTC.memory size and availability configurable.
The compile-time configuration value MICROPY_HW_RTC_USER_MEM_MAX can now be
used to define the amount of memory set aside for RTC.memory().  If this
value is configured to zero then the RTC.memory functionality is not
included in the build.
2019-11-21 16:55:12 +11:00
Laurens Valk
2679c9e116 unix/modtermios: Fix output speed setter in tcsetattr.
The input speed was being set twice and the output speed was not set.
2019-11-21 12:10:32 +11:00