Wykres commitów

766 Commity (master)

Autor SHA1 Wiadomość Data
iabdalkader e8dd519e2d esp32/network_wlan: Add interface and security WLAN constants.
Following the same change to extmod network interfaces.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-28 13:01:55 +11:00
Daniël van de Giessen a0efe2d368 esp32/main: Check if main GC heap allocation failed.
If the heap allocation fails we will crash if we continue, so at least we
can show a clear error message so one can figure out memory allocation was
the problem (instead of just seeing some arbitrary null pointer error
later).

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-03-25 12:19:00 +11:00
Jim Mussared acbdbcd95e esp32: Workaround IDF issue placing ISR ringbuf functions in IRAM.
This workaround makes sure that all ringbuf functions that may be called
from an ISR are placed in IRAM.  See
https://github.com/espressif/esp-idf/issues/13378

Note that this means that all esp32-og builds get non-ISR ringbuf functions
placed in flash now, whereas previously it was just the spiram variant.
This might be a good thing (e.g. free up some IRAM for native/viper).

Fixes issue #14005.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2024-03-22 12:14:27 +11:00
Damien George bfc3dde2c9 extmod/modmachine: Add MICROPY_PY_MACHINE_RESET configuration option.
Disabled by default, but enabled on all boards that previously had
`MICROPY_PY_MACHINE_BARE_METAL_FUNCS` enabled.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-15 12:04:37 +11:00
Stanislav Ponomarev bedb649edf esp32/boards/ESP32_GENERIC_S3: Add 4MiB partitioning board variant.
Added a 4MiB flash partitioning variant for ESP32S3: adds support for 4MiB
discrete flash boards or ESP32-S3FH4R2 with embedded 4MiB flash based ones.

Tested on the waveshare ESP32-S3 Mini w/ESP32-S3FH4R2.

Signed-off-by: Stanislav Ponomarev <me@stasponomarev.com>
2024-03-09 10:37:46 +11:00
Daniël van de Giessen 20f85fb26e esp32/machine_uart: Always configure timeout_char setting in init().
If the `timeout_char` parameter is not given, we should still configure the
UART to ensure the UART is always initialized consistently.  So the default
of 0 gets applied correctly, or if, for example, the baudrate was changed
the char timeout isn't still based on the old baudrate causing weird
behaviour, etc.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-03-08 17:09:17 +11:00
robert-hh cdfc6c159f esp32/network_lan: Add a separate argument to set PHY power pin.
Prior to this commit, the pin defined for power would be used by the
esp_idf driver to reset the PHY.  That worked, but sometimes the MDIO
configuration started before the power was fully settled, leading to an
error.

With the change in this commit, the power for the PHY is independently
enabled in network_lan.c with a 100ms delay to allow the power to settle.
A separate define for a reset pin is provided, even if the PHY reset
pin is rarely connected.

Fixes issue #14013.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-03-08 16:55:08 +11:00
Trent Piepho af67be7adc esp32/modmachine: Support bootloader on ESP32-S2/S3/C2/C3.
On these targets it's possible to enter the bootloader by setting a bit in
an RTC register before resetting.

Structure it in a way that a board can still provide a custom bootloader
handler.  The handler here will be the default if none is provided, for any
board based on the supported targets.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-03-08 15:55:17 +11:00
Trent Piepho 9fc450689b esp32/mpconfigport: Don't hang when machine.bootloader isn't supported.
Currently only the Arduino Nano ESP32 defines a machine.bootloader handler
for ESP32.  All other boards will intentionally hang.

There is no error message, nor is a NotImplementedError raised.  There's no
indication if Micropython has crashed, or if the bootloader was entered but
USB is not working, which is a real problem the ESP32 bootloader has.  It's
not possible escape from this hang with ^C or any other means besides
physical access to the reset pin or the ability to cycle power.

Change this to only define an implementation of machine.bootloader() when
there is a handler for it.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-03-08 15:54:44 +11:00
Daniël van de Giessen 27279e69b4 esp32: Add IDF-version-specific sdkconfig.
The new IDF v5.2 deprecated the task cleanup callback we use, so support
for the new option has been implemented in the previous commit.  This also
requires a change in the sdkconfig, via a new variable
${SDKCONFIG_IDF_VERSION_SPECIFIC} which is used in all mpconfigboard.cmake
files to include an extra sdkconfig file based on the IDF version in use.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-03-08 14:05:39 +11:00
Daniël van de Giessen d6176c1f5e esp32: Add support for IDF version v5.2.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-03-08 14:05:38 +11:00
Daniël van de Giessen c92683d67c esp32: Add support for IDF version v5.0.5.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-03-08 14:05:15 +11:00
MikeTeachman 0b145fdc2d esp32/machine_i2s: Integrate new I2S IDF driver.
The legacy I2S "shim" is removed and replaced by the new I2S driver.  The
new driver fixes a bug where mono audio plays only in one channel.

Application code size is reduced by 2672 bytes with this change.  Tested on
ESP32, ESP32+spiram, ESP32-S3 using example code from
https://github.com/miketeachman/micropython-i2s-examples

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2024-03-08 13:31:02 +11:00
Sebastian Romero 27c0992343 esp32/boards: Add missing named digital pins for Arduino Nano ESP32.
Signed-off-by: Sebastian Romero <s.romero@arduino.cc>
2024-03-08 13:10:30 +11:00
Phil Howard dda9b9c6da all: Prune trailing whitespace.
Prune trailing whitespace across the whole project (almost), done
automatically with:

    grep -IUrl --color "[[:blank:]]$" --exclude-dir=.git --exclude=*.exp |\
        xargs sed -i 's/[[:space:]]*$//'

Exceptions:
- Skip third-party code in lib/ and drivers/cc3100/
- Skip generated code in bluetooth_init_cc2564C_1.5.c
- Preserve command output whitespace in docs, eg:
  docs/esp8266/tutorial/repl.rst

Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-03-07 16:25:17 +11:00
Angus Gratton decf8e6a8b all: Remove the "STATIC" macro and just use "static" instead.
The STATIC macro was introduced a very long time ago in commit
d5df6cd44a.  The original reason for this was
to have the option to define it to nothing so that all static functions
become global functions and therefore visible to certain debug tools, so
one could do function size comparison and other things.

This STATIC feature is rarely (if ever) used.  And with the use of LTO and
heavy inline optimisation, analysing the size of individual functions when
they are not static is not a good representation of the size of code when
fully optimised.

So the macro does not have much use and it's simpler to just remove it.
Then you know exactly what it's doing.  For example, newcomers don't have
to learn what the STATIC macro is and why it exists.  Reading the code is
also less "loud" with a lowercase static.

One other minor point in favour of removing it, is that it stops bugs with
`STATIC inline`, which should always be `static inline`.

Methodology for this commit was:

1) git ls-files | egrep '\.[ch]$' | \
   xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/"

2) Do some manual cleanup in the diff by searching for the word STATIC in
   comments and changing those back.

3) "git-grep STATIC docs/", manually fixed those cases.

4) "rg -t python STATIC", manually fixed codegen lines that used STATIC.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-07 14:20:42 +11:00
Damien George a30c29398a ports: Don't include mpthread.h in mpthreadport.h.
Because `mpthreadport.h` is included by `mpthread.h`.

Also remove unnecessary include of `mpthreadport.h` in esp32's `main.c`.

Signed-off-by: Damien George <damien@micropython.org>
2024-02-29 13:35:36 +11:00
Trent Piepho 31e131bd71 esp32/machine_hw_spi: Combine argument parsing for constructor and init.
This combines the argument parsing and checking for the machine.SPI.init()
and machine.SPI() interfaces.

The only real difference was unspecified arguments in init() mean to keep
the same value, while in new they get default values.

Behavior has changed for passing the "id" argument to init().  On other
ports this isn't allowed.  But on esp32 it would change the SPI controller
of the static SPI instance to the new id.  This results in multiple static
spi objects for the same controller and they would fight over which one has
inconsistent mpy vs esp-idf state.  This has been changed to not allow "id"
with init(), like other ports.

In a few causes, a loop is used over arguments that are handled the same
way instead of cut & pasting the same stanza of code for each argument.

The init_internal function had a lot of arguments, which is not efficient
to pass.  Pass the args mp_arg_val_t array instead as a single argument.
This reduced both the number of C lines and the compiled code size.

Summary of code size change:  Two argument lists of 72 bytes are replaced
by a single shared 72 byte list.  New shared argument parsing code is small
enough to be inlined, but is still efficient enough to shrink the overall
code size by 349 bytes of the three argument handlering functions.

add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-349 (-349)
Function                                     old     new   delta
machine_hw_spi_make_new                      255     203     -52
machine_hw_spi_init                          122      67     -55
machine_hw_spi_init_internal                 698     456    -242
Total: Before=1227667, After=1227318, chg -0.03%
add/remove: 2/0 grow/shrink: 0/2 up/down: 92/-144 (-52)
Data                                         old     new   delta
spi_allowed_args                               -      72     +72
defaults$0                                     -      20     +20
allowed_args$1                               240     168     -72
allowed_args$0                              1080    1008     -72
Total: Before=165430, After=165378, chg -0.03%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-02-20 16:55:09 +11:00
IhorNehrutsa d9944983cb esp32/machine_i2c: Fix build warnings when I2C is disabled.
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2024-02-20 16:38:49 +11:00
Damien George cae690d047 all: Use mp_obj_malloc_with_finaliser everywhere it's applicable.
Signed-off-by: Damien George <damien@micropython.org>
2024-02-20 10:32:55 +11:00
Damien George cd66aa05cf esp32: Increase NimBLE task stack size and overflow detection headroom.
The Python BLE IRQ handler will most likely run on the NimBLE task, so its
C stack must be large enough to accommodate reasonably complicated Python
code (eg a few call depths).  So increase this stack size.

Also increase the headroom from 1024 to 2048 bytes.  This is needed because
(1) the esp32 architecture uses a fair amount of stack in general; and (2)
by the time execution gets to setting the Python stack top via
`mp_stack_set_top()` in this interlock code, about 600 bytes of stack are
already used, which reduces the amount available for Python.

Fixes issue #12349.

Signed-off-by: Damien George <damien@micropython.org>
2024-02-16 10:19:26 +11:00
Damien George c27d304bed esp32/mpnimbleport: Release the GIL while doing NimBLE port deinit.
In case callbacks must run (eg a disconnect event happens during the
deinit) and the GIL must be obtained to run the callback.

Fixes part of issue #12349.

Signed-off-by: Damien George <damien@micropython.org>
2024-02-15 16:05:41 +11:00
Trent Piepho 34097b776e esp32/network_ppp: Make PPP support optional.
PPP is not that commonly used, let it be turned off in the board config to
save space.  It is still on by default.

On an basic ESP32-S3 build, turning off PPP with LWIP still on saves ~35 kB
of codend 4 kB of data.

   text    data     bss     dec     hex filename
1321257  304296 2941433 4566986  45afca before-ppp-off.elf
1285101  299920 2810305 4395326  43113e after-ppp-off.elf
-------------------------------
-36156    -4376     -56

Note that the BSS segment size includes all NOBITS sections in ELF file.
Some of these are aligned to 64kB chunk sized dummy blocks, I think for
alignment to MMU boundaries, and these went down by 1 block each, so 128
kiB of BSS is not really part of the binary size reduction.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-02-15 13:29:43 +11:00
Damien George 7d28789544 ports: Use vfs module instead of os.
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07 13:25:09 +11:00
Joey232 3e48d24576 esp32/boards/UM_FEATHERS3: Use read_uv() for accurate battery voltage.
Use read_uv() to get the battery voltage because it uses the on-chip
calibraton values.

Signed-off-by: Joey232 <Joey@jsconsulting.com>
2024-01-31 14:24:16 +11:00
iabdalkader 4a2e510a87 ports: Add LED pin aliases for all Arduino boards.
The standard Arduino pinout uses LEDR/G/B and LED_BUILTIN (if available).
This patch adds aliases to match the standard pinout, while retaining
LED_RED/GREEN/BLUE for compatibility with existing scripts and examples.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-01-26 14:11:42 +11:00
Iksas ce2058685b ports: Fix handling of paths containing spaces in Makefiles.
Make can't handle paths with spaces, see https://savannah.gnu.org/bugs/?712

The following workarounds exist:

- When using make's built-in functions:
    - Use relative paths wherever possible to avoid spaces in the first
      place.
    - All spaces in paths can be escaped with backslashes; quotes don't
      work.
    - Some users use the shell to temporarily rename directories, or to
      create symlinks without spaces.

- When using make to pass commands to the system's shell, enclose paths in
  quotes.  While make will still interpret quoted strings with spaces as
  multiple words, the system's shell will correctly parse the resulting
  command.

This commit contains the following fixes:

- In ports/stm32/mboot/Makefile: Use relative paths to avoid spaces when
  using built-in functions.

- In all other files: Use quotes to enclose paths when make is used to call
  shell functions.

All changes have been tested with a directory containing spaces.

Signed-off-by: Iksas <iksas@mailbox.org>
2024-01-24 10:43:18 +11:00
Angus Gratton a75ca8a1c0 esp32/modsocket: Use all supplied arguments to socket.getaddrinfo().
- Completes a longstanding TODO in the code, to not ignore
  the optional family, type, proto and flags arguments to
  socket.getaddrinfo().

- Note that passing family=socket.AF_INET6 will now cause queries
  to fail (OSError -202). Previously this argument was ignored so
  IPV4 results were returned instead.

- Optional 'type' argument is now always copied into the result. If not
  set, results have type SOCK_STREAM.

- Fixes inconsistency where previously querying mDNS local suffix (.local)
  hostnames returned results with socket type 0 (invalid), but all other
  queries returned results with socket type SOCK_STREAM (regardless of
  'type' argument).

- Optional proto argument is now returned in the result tuple, if supplied.

- Optional flags argument is now passed through to lwIP. lwIP has handling
  for AI_NUMERICHOST, AI_V4MAPPED, AI_PASSIVE (untested, constants for
  these are not currently exposed in the esp32 socket module).

- Also fixes a possible memory leak in an obscure code path
  (lwip_getaddrinfo apparently sometimes returns a result structure with
  address "0.0.0.0" instead of failing, and this structure would have been
  leaked.)

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-01-17 11:00:58 +11:00
Daniël van de Giessen d014c82826 extmod/nimble: Do not set GAP device name after sync.
Instead, configure the default once at compile-time. This means the GAP
name will no longer be set to default after re-initializing Bluetooth.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-12-22 16:07:02 +11:00
Maarten van der Schrieck 3bca93b2d0 ports: Fix sys.stdout.buffer.write() return value.
MicroPython code may rely on the return value of sys.stdout.buffer.write()
to reflect the number of bytes actually written. While in most scenarios a
write() operation is successful, there are cases where it fails, leading to
data loss. This problem arises because, currently, write() merely returns
the number of bytes it was supposed to write, without indication of
failure.

One scenario where write() might fail, is where USB is used and the
receiving end doesn't read quickly enough to empty the receive buffer. In
that case, write() on the MicroPython side can timeout, resulting in the
loss of data without any indication, a behavior observed notably in
communication between a Pi Pico as a client and a Linux host using the ACM
driver.

A complex issue arises with mp_hal_stdout_tx_strn() when it involves
multiple outputs, such as USB, dupterm and hardware UART. The challenge is
in handling cases where writing to one output is successful, but another
fails, either fully or partially. This patch implements the following
solution:

mp_hal_stdout_tx_strn() attempts to write len bytes to all of the possible
destinations for that data, and returns the minimum successful write
length.

The implementation of this is complicated by several factors:
- multiple outputs may be enabled or disabled at compiled time
- multiple outputs may be enabled or disabled at runtime
- mp_os_dupterm_tx_strn() is one such output, optionally containing
  multiple additional outputs
- each of these outputs may or may not be able to report success
- each of these outputs may or may not be able to report partial writes

As a result, there's no single strategy that fits all ports, necessitating
unique logic for each instance of mp_hal_stdout_tx_strn().

Note that addressing sys.stdout.write() is more complex due to its data
modification process ("cooked" output), and it remains unchanged in this
patch. Developers who are concerned about accurate return values from
write operations should use sys.stdout.buffer.write().

This patch might disrupt some existing code, but it's also expected to
resolve issues, considering that the peculiar return value behavior of
sys.stdout.buffer.write() is not well-documented and likely not widely
known. Therefore, it's improbable that much existing code relies on the
previous behavior.

Signed-off-by: Maarten van der Schrieck <maarten@thingsconnected.nl>
2023-12-22 10:32:46 +11:00
IhorNehrutsa 5552896ca8 esp32/mpconfigport: Enable MICROPY_PY_HASHLIB_MD5.
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2023-12-21 11:33:05 +11:00
Damien George f6d630877c esp32: Add MICROPY_GC_INITIAL_HEAP_SIZE option and tune it.
This gets back the old heap-size behaviour on ESP32, before auto-split-heap
was introduced: after the heap is grown one time the size is 111936 bytes,
with about 40k left for the IDF.  That's enough to start WiFi and do a
HTTPS request.

Signed-off-by: Damien George <damien@micropython.org>
2023-12-19 18:34:23 +11:00
Damien George 395886caa3 extmod/modos: Factor os.dupterm_notify() function to common extmod code.
esp8266 doesn't need ets task because the notify is now scheduled (see
commits 7d57037906 and
c60caf1995 for relevant history).

Signed-off-by: Damien George <damien@micropython.org>
2023-12-18 12:20:47 +11:00
Damien George c9eb6bc601 esp32: Re-enable custom mbedtls error string tables.
To match other ports that use mbedtls.

Signed-off-by: Damien George <damien@micropython.org>
2023-12-12 16:25:07 +11:00
IhorNehrutsa 4365edb810 esp32: Change minimum supported IDF version to v5.0.4.
Also, IDF v5.1.2 is now supported, just not used by default.

IDF v5.0.2 still builds but we cannot guarantee continued support for this
version moving forward.

Signed-off-by: IhorNehrutsa <IhorNehrutsa@gmail.com>
2023-12-11 13:00:09 +11:00
Damien George d0758d8a33 esp32/boards/ESP32_GENERIC: Disable network.LAN and VM-opt on D2WD.
To reduce firmware size, because IDF v5.0.4 has increased in size.

Signed-off-by: Damien George <damien@micropython.org>
2023-12-11 13:00:06 +11:00
Damien George b4b77c17b5 esp32/mpconfigport: Keep some funcs out of IRAM for ESP32-SPIRAM builds.
To make sure the build fits.

Signed-off-by: Damien George <damien@micropython.org>
2023-12-11 12:59:51 +11:00
Ihor Nehrutsa 3069fee386 esp32/machine_i2s: Fix deprecated fields and constants.
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2023-12-11 12:59:29 +11:00
Ihor Nehrutsa a427117d03 esp32/modmachine: Fix deprecated esp_pm_config_XXX_t.
Co-Authored-By: Trent Piepho <35062987+xyzzy42@users.noreply.github.com>

Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2023-12-11 12:59:14 +11:00
IhorNehrutsa 495be71d56 esp32/machine_dac: Support one-shot mode of driver.
And simplify board configuration of DAC by using SOC_DAC_SUPPORTED.

Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2023-12-11 12:57:43 +11:00
IhorNehrutsa 3106ee4885 esp32/modnetwork: Add WiFi AUTH_WPA3_ENT_192 authenticate mode.
Available in newer versions of the IDF.

Signed-off-by: IhorNehrutsa <IhorNehrutsa@gmail.com>
2023-12-11 12:57:05 +11:00
IhorNehrutsa 88778be73a esp32/machine_i2c: Use APB_CLK_FREQ instead of I2C_APB_CLK_FREQ.
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2023-12-11 12:56:38 +11:00
Carlosgg c393cd7e48 esp32/boards/sdkconfig.base: Disable unused mbedtls options.
Disable unused EC curves and default certificate bundle which is not
implemented in MicroPython.  This reduces the firmware size significantly.

This follows commit 68f166dae9.

Signed-off-by: Carlos Gil Gonzalez <carlosgilglez@gmail.com>
2023-12-11 12:06:35 +11:00
Scott Zhao 1323a71823 esp32/boards/UM_TINYPICO: Fix typo in baudrate instructions.
The installation instructions for ESP32 TinyPICO board contained a typo
that used a non-standard baud rate 912600 instead of 921600.  This made the
upload command fail on some Windows computers.

Signed-off-by: Scott Zhao <zhaomh1998@outlook.com>
2023-12-06 13:46:04 +11:00
Thomas Wenrich 78b3fe5689 esp32/machine_rtc: Preserve RTC user memory over most reset causes.
The user memory area - accessible by machine.RTC.memory() -- will now
survive most reboot causes.  A power-on reset (also caused by the EN pin on
some boards) will clean the memory.  When this happens, the magic number
not found in the user memory will cause initialization.

After other resets (triggered by watchdogs, machine.reset(), ...), the user
is responsible to check and validate the contents of the user area.

This new behaviour can be changed by enabling
MICROPY_HW_RTC_MEM_INIT_ALWAYS: in that case the RTC memory is always
cleared on boot.

Signed-off-by: Thomas Wenrich <twenrich@gmail.com>
2023-12-06 13:31:13 +11:00
Damien George 69089a532e esp32/boards: Enable further IRAM saving opts to fit ESP32-SPIRAM fw.
The amount of free IRAM in ESP32 SPIRAM builds is very small and went over
the limit due to commit 30b0ee34d3.  This
commit enables further optimisations to reduce IRAM usage.

Signed-off-by: Damien George <damien@micropython.org>
2023-12-06 12:35:45 +11:00
Carlosgg 30b0ee34d3 esp32: Enable mbedtls cert time validation.
Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2023-12-04 10:50:42 +11:00
Damien George ad806df857 ports: Move definitions of ATOMIC_SECTION macros to mphalport.h.
Also move MICROPY_PY_PENDSV_ENTER/REENTER/EXIT to mphalport.h, for ports
where these are not already there.

This helps separate the hardware implementation of these macros from the
MicroPython configuration (eg for renesas-ra and stm32, the IRQ static
inline helper functions can now be moved to irq.h).

Signed-off-by: Damien George <damien@micropython.org>
2023-12-01 14:37:48 +11:00
Damien George f523b86541 extmod/modmachine: Provide common implementation of disable/enable_irq.
The ports esp32, mimxrt, rp2 and samd all shared exactly the same
implementation of machine.disable_irq() and machine.enable_irq(),
implemented in terms of MICROPY_{BEGIN,END}_ATOMIC_SECTION.  This commit
factors these implementations into extmod/modmachine.c.

The cc3200, esp8266, nrf, renesas-ra and stm32 ports do not yet use this
common implementation.

Signed-off-by: Damien George <damien@micropython.org>
2023-11-30 16:11:11 +11:00
Damien George e1ec6af654 extmod/modmachine: Provide common bindings for 6 bare-metal functions.
Minor changes for consistency are:
- nrf gains: unique_id(), freq() [they do nothing]
- samd: deepsleep() now resets after calling lightsleep()
- esp32: lightsleep()/deepsleep() no longer take kw arg "sleep", instead
  it's positional to match others.  also, passing 0 here will now do a 0ms
  sleep instead of acting like nothing was passed.
  reset_cause() no longer takes any args (before it would just ignore them)
- mimxrt: freq() with an argument and lightsleep() both raise
  NotImplementedError

Signed-off-by: Damien George <damien@micropython.org>
2023-11-30 16:11:11 +11:00