Wykres commitów

14080 Commity (95c614e2b60b5c1c83c85aefe88a2aadbf43b9ed)

Autor SHA1 Wiadomość Data
Jim Mussared 492ba5eaf2 stm32: Move board variant config to mpconfigboard.mk.
Rather than having the autobuild know about the particular variants, have
the mpconfigboard.mk describe them and make autobuild discover them
automatically.

Adds a "query-variants" target to stm32/Makefile to allow the set of
possible variants to be queried.

Removes pybv3 from the autobuild as this isn't use by the downloads page.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26 09:38:38 +10:00
Andrew Leech 923375380b stm32/boards: Increase mboot region to 32k for WB55 boards.
If mboot is built with support for packing (signing/encryption) it needs up
to 32KiB.  So for simplicity increase the mboot region to 32KiB
unconditionally for WB55 boards (custom WB55 board configurations can still
provide their own linker scripts to override this).
2022-08-25 17:02:56 +10:00
Damiano Mazzella 1fbf0efaeb stm32/sdram: Enable MPU for unaligned access on H7 MCUs.
So that SDRAM can be used as the heap on ARDUINO_PORTENTA_H7, for example.

Fixes issue #9087.
2022-08-25 16:20:51 +10:00
robert-hh 8139cbcf6b esp32/machine_timer: Support all init arguments in Timer constructor.
Following the usual style of instantiation and init().
2022-08-24 17:31:39 +10:00
robert-hh 13dceaa4ea esp32/machine_uart: Change sendbreak time to be at least 15 bit times.
It used to be 10 bit times, which is too short.  The break state must be
longer than a regular character time, at least 13 bit times.  This is now
implemented by reducing the baudrate while sending the "0".  The break time
will now vary with data length and parity setting, but will at least be 15
bit times.

Tested with a GENERIC_SPIRAM, GENERIC_C3 and UM_TINYS2 board.
2022-08-23 17:22:15 +10:00
glenn20 e6e60f4330 esp8266/modnetwork: Add support for WLAN.config(protocol=XX) option.
Following esp32.  This is preferred to using the phy_mode() function.
2022-08-23 16:33:19 +10:00
glenn20 0507f239e8 esp32/modnetwork: Add network.MODE_LR constant.
Adds the MODE_LR constant to the network module to support Espressif's
long-range communication protocol.
2022-08-23 16:33:03 +10:00
glenn20 76f2e3e62b esp32/network_wlan: Add support to set/get the wifi protocol.
Add 'protocol' option to WLAN.config() to support setting/getting the wifi
protocol modes: MODE_11G|MODE_11G|MODE_11N.
2022-08-23 16:32:30 +10:00
glenn20 98d1c50159 esp32/network_wlan: Use esp_wifi_set/get_channel to config wifi channel.
Set the channel with esp_wifi_set_channel(), which adds support for setting
the channel of the STA interface

Get the channel with esp_wifi_get_channel() which returns the actual wifi
channel of the radio, rather than the configured channel.
2022-08-23 16:28:49 +10:00
robert-hh 47c45d0e7f rp2/machine_wdt: Check for the maximum timeout value of watchdog.
The value will be checked for timeout <= 8388.  Notes were added to the
documentation.
2022-08-23 16:26:29 +10:00
robert-hh 8308f9c977 extmod/network_wiznet5k: Use the configured DNS address if available.
Instead of the default 8.8.8.8.  The change was suggested by @omogenot.
2022-08-23 15:00:00 +10:00
robert-hh 71dcb21e24 drivers/wiznet5k: Remove old Wiznet driver.
It has been replaced by the submodule lib/wiznet5k.
2022-08-23 15:00:00 +10:00
robert-hh f6ec01d1da tools/ci.sh: Split the stm32 builds for wiznet5k and cc3k.
- Add lib/wiznet5k into the 'make submodules' step.
- Split the stm32 builds for wiznet5k and cc3k.
- Run 'make .... clean' after making the wiznet5k build.
2022-08-23 15:00:00 +10:00
robert-hh 54eaa8c8a6 stm32/mphalport: Add mp_hal_get_spi_obj() helper function.
The function spi_from_mp_obj() is kept since it is used by the cc3k driver.
2022-08-23 14:59:48 +10:00
robert-hh c3305c49e4 stm32: Add definitions required for lwIP version of Wiznet NIC. 2022-08-23 14:58:13 +10:00
robert-hh 717924001d stm32: Switch Wiznet to use lib/wiznet5k and extmod/network_wiznet5k.
Instead of the old Wiznet driver in drivers/wiznet5k.
2022-08-23 14:57:54 +10:00
Chris Waggoner b1efc1340a mpy-cross,unix: Include alloca.h for NetBSD. 2022-08-23 13:39:18 +10:00
Laurens Valk d8ad87843a py/builtinimport: Allow overriding of mp_builtin___import__.
This allows ports to override mp_builtin___import__.

This can be useful in MicroPython applications where
MICROPY_ENABLE_EXTERNAL_IMPORT has to be disabled due to its impact on
build size (2% to 2.5% of the minimal port). By overriding the otherwise
very minimal mp_builtin___import__, ports can still allow limited forms
of application-specific imports.

Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-08-23 13:34:06 +10:00
Damien George 3d65101a8a py: Clean up formatting of union definitions.
Signed-off-by: Damien George <damien@micropython.org>
2022-08-23 13:09:57 +10:00
Damien George 7c8ec85fa3 shared/runtime/sys_stdio_mphal: Make func static and remove some TODOs.
stdio_obj_print is private to this file so can be made static.  The __del__
method does nothing so can be removed (it's only called by the GC if it
exists, so if it doesn't exist it won't be called).  And FileIO doesn't
support a constructor in MicroPython at this stage.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-23 13:02:40 +10:00
Nicholas H.Tollervey af54d2ce9f
javascript: Rename this port to 'webassembly'. 2022-08-22 12:03:39 +01:00
Jim Mussared c616721b1a extmod/modframebuf: Improve poly-fill boundary pixels.
Rather than drawing the entire boundary to catch missing pixels, just
detect the cases where boundary pixels are skipped during node calculation
and pre-emptively draw them then.

This adds 72 bytes on PYBV11, but makes filled poly() 20% faster.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19 23:31:28 +10:00
Mat Booth 04a655c744 extmod/modframebuf: Add polygon drawing methods.
Add method for drawing polygons.

For non-filled polygons, uses the existing line-drawing code to render
arbitrary polygons using the given coords list, at the given x,y position,
in the given colour.

For filled polygons, arbitrary closed polygons are rendered using a fast
point-in-polygon algorithm to determine where the edges of the polygon lie
on each pixel row.

Tests and documentation updates are also included.

Signed-off-by: Mat Booth <mat.booth@gmail.com>
2022-08-19 23:31:28 +10:00
Peter Hinch 42ec9703a0 extmod/modframebuf: Add ellipse drawing method. 2022-08-19 23:31:28 +10:00
Jim Mussared 127b340438 extmod/modframebuf: Add fill argument to rect().
We plan to add `ellipse` and `poly` methods, but rather than having to
implement a `fill_xyz` version of each, we can make them take an optional
fill argument. This commit add this to `rect` as a starting point.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19 23:31:28 +10:00
Jim Mussared af1f167820 py/dynruntime: Add mp_obj_is_true.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19 23:31:11 +10:00
Jim Mussared 470a44bd3a extmod/modframebuf: Optimise argument handling.
Several methods extract mp_int_t from adjacent arguments. This reduces
code size for the repeated calls to mp_obj_get_int.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19 15:21:31 +10:00
Jim Mussared 59e3348c10 tools/mpremote: Add "edit" command.
This allows a remote file to be edited locally by copying it over, running
the local editor, then copying it back.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18 22:29:13 +10:00
Jim Mussared 263737ecfe tools/pyboard.py: Add "touch" filesystem command.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18 22:24:25 +10:00
Jim Mussared a311e9e3d4 tools/mpremote: Allow + terminator for fs commands.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18 22:22:36 +10:00
Damien George 8f4c108025 all: Remove MICROPY_PY_IO_FILEIO config option.
Since commit e65d1e69e8 there is no longer an
io.FileIO class, so this option is no longer needed.

This option also controlled whether or not files supported being opened in
binary mode (eg 'rb'), and could, if disabled, lead to confusion as to why
opening a file in binary mode silently did the wrong thing (it would just
open in text mode if MICROPY_PY_IO_FILEIO was disabled).

The various VFS implementations (POSIX, FAT, LFS) were the only places
where enabling this option made a difference, and in almost all cases where
one of these filesystems were enabled, MICROPY_PY_IO_FILEIO was also
enabled.  So it makes sense to just unconditionally enable this feature
(ability to open a file in binary mode) in all cases, and so just remove
this config option altogether.  That makes configuration simpler and means
binary file support always exists (and opening a file in binary mode is
arguably more fundamental than opening in text mode, so if anything should
be configurable then it should be the ability to open in text mode).

Signed-off-by: Damien George <damien@micropython.org>
2022-08-18 11:54:17 +10:00
Damien George 237a393bec extmod/vfs_posix_file: Remove unused MICROPY_VFS_POSIX_FILE.
This was made obsolete by 2b409ef8a4

Signed-off-by: Damien George <damien@micropython.org>
2022-08-18 11:48:45 +10:00
Damien George cbc9f944c4 tests,tools: Update path to unix micropython executable.
These were missed by 47c84286e8

Signed-off-by: Damien George <damien@micropython.org>
2022-08-18 11:47:58 +10:00
Efi Weiss 98bd7e33b3 unix/modusocket: Support proto and flags arguments to getaddrinfo.
Signed-off-by: Efi Weiss <efiwiss@gmail.com>
2022-08-17 12:02:42 +10:00
David Peake 454d969781 docs/esp32: Fix string quoting consistency in SDCard mount example.
It appears that strings in the documentation are typically single quoted.
2022-08-17 12:00:35 +10:00
Angus Gratton a16a330da5 nrf,stm32: Don't enable debug info by default if LTO is on.
It seems sometimes gcc with LTO will generate otherwise valid assembly
listings that cause 'as' to error out when generating DWARF debug info; see
https://sourceware.org/bugzilla/show_bug.cgi?id=29494

Therefore, don't enable -g by default if LTO is on.

Enabling LTO=1 DEBUG=1 is still possible but may result in random errors
at link time due to 'as' (the error in this case is "Error: unaligned
opcodes detected in executable segment", and the only other easy workaround
is CFLAGS+=-fno-jump-tables which may increase code size significantly).

Follows on from fdfe4eca74
2022-08-15 22:55:34 +10:00
Dan Ellis 6f4d424f46 py/formatfloat: Use pow(10, e) instead of pos/neg_pow lookup tables.
Rework the conversion of floats to decimal strings so it aligns precisely
with the conversion of strings to floats in parsenum.c.  This is to avoid
rendering 1eX as 9.99999eX-1 etc.  This is achieved by removing the power-
of-10 tables and using pow() to compute the exponent directly, and that's
done efficiently by first estimating the power-of-10 exponent from the
power-of-2 exponent in the floating-point representation.

Code size is reduced by roughly 100 to 200 bytes by this commit.

Signed-off-by: Dan Ellis <dan.ellis@gmail.com>
2022-08-12 23:53:34 +10:00
Dan Ellis 6cd2e41918 py/parsenum: Ensure that trailing zeros lead to identical results.
Prior to this commit, parsenum would calculate "1e-20" as 1.0*pow(10, -20),
and "1.000e-20" as 1000.0*pow(10, -23); in certain cases, this could make
seemingly-identical values compare as not equal.  This commit watches for
trailing zeros as a special case, and ignores them when appropriate, so
"1.000e-20" is also calculated as 1.0*pow(10, -20).

Fixes issue #5831.
2022-08-12 23:44:11 +10:00
MrJake222 69719927f1 extmod/modlwip: Add support for leaving multicast groups. 2022-08-12 23:09:13 +10:00
Damien George 01514e80c9 extmod/uasyncio: Rename internal _flag to state, to save a qstr.
Saves about 16 bytes of flash when uasyncio is frozen in.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-12 22:33:55 +10:00
Ned Konz 5543b2a9cc extmod/uasyncio: Add clear method to ThreadSafeFlag.
This is useful in situations where the ThreadSafeFlag is reused and needs
to be cleared of any previous, unwanted event.

For example, clear the flag at the start of an operation, trigger the
operation (eg an I2C write), then (a)wait for an external event to set the
flag (eg a pin IRQ).  Further events may trigger the flag again but these
are unwanted and should be cleared before the next cycle starts.
2022-08-12 17:06:28 +10:00
Damien George cf90e24335 py/mkrules: Use abspath to find directory for mpy-cross dependency.
Otherwise if the `mpy-cross/build/` directory doesn't exist then
`mpy-cross/build/..` won't work.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-12 16:38:24 +10:00
Damien George 945f377b43 py/objstr: Remove str function object declarations from header file.
Since f7f56d4285 consolidated all uses of
these to a single locals dict, they no longer need to be made public.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-12 16:38:22 +10:00
Damien George ec24cd1d25 mpy-cross,unix: Remove .gitignore file.
Now that all build artefacts are placed in a build/ directory the gitignore
is no longer needed.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-12 16:38:04 +10:00
Jim Mussared f694058f2b tests/extmod/ubinascii: Add tests for bytes.hex etc.
Also make the sep test not micropython-specific.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-12 12:44:30 +10:00
Jim Mussared 28aaab9590 py/objstr: Add hex/fromhex to bytes/memoryview/bytearray.
These were added in Python 3.5.

Enabled via MICROPY_PY_BUILTINS_BYTES_HEX, and enabled by default for all
ports that currently have ubinascii.

Rework ubinascii to use the implementation of these methods.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-12 12:44:30 +10:00
Damien George 6c67fbc280 zephyr/machine_uart: Use mp_obj_str_get_str to get device name.
This checks that the argument is actually a string.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-11 23:18:02 +10:00
Damien George 787bd99919 nrf/modules/ubluepy: Use mp_obj_str_get_data to extract str data.
Instead of GET_STR_DATA_LEN, which is intended to be a private macro.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-11 23:18:02 +10:00
Andrew Leech f7f56d4285 py/objstr: Consolidate methods for str/bytes/bytearray/array.
This commit adds the bytes methods to bytearray, matching CPython.  The
existing implementations of these methods for str/bytes are reused for
bytearray with minor updates to match CPython return types.

For details on the CPython behaviour see
https://docs.python.org/3/library/stdtypes.html#bytes-and-bytearray-operations

The work to merge locals tables for str/bytes/bytearray/array was done by
@jimmo.  Because of this merging of locals the change in code size for this
commit is mostly negative:

       bare-arm:    +0 +0.000%
    minimal x86:   +29 +0.018%
       unix x64:  -792 -0.128% standard[incl -448(data)]
    unix nanbox:  -436 -0.078% nanbox[incl -448(data)]
          stm32:   -40 -0.010% PYBV10
         cc3200:   -32 -0.017%
        esp8266:   -28 -0.004% GENERIC
          esp32:   -72 -0.005% GENERIC[incl -200(data)]
         mimxrt:   -40 -0.011% TEENSY40
     renesas-ra:   -40 -0.006% RA6M2_EK
            nrf:   -16 -0.009% pca10040
            rp2:   -64 -0.013% PICO
           samd:  +148 +0.105% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2022-08-11 23:18:02 +10:00
Damien George 82b3500724 py/qstr: Change qstr hash type from mp_uint_t to size_t.
The hash is either 8 or 16 bits (depending on MICROPY_QSTR_BYTES_IN_HASH)
so will fit in a size_t.

This saves 268 bytes on the unix nanbox build.  Non-nanbox configurations
are unchanged because mp_uint_t is the same size as size_t.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-11 23:18:02 +10:00