Skip to content

Commit f6c7bb3

Browse files
committed
2 parents 81f6721 + 0ee8674 commit f6c7bb3

220 files changed

Lines changed: 2652 additions & 1166 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ports_qemu.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@ concurrency:
2020

2121
jobs:
2222
build_and_test_arm:
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
ci_func: # names are functions in ci.sh
27+
- bigendian
28+
- sabrelite
29+
- thumb
2330
runs-on: ubuntu-latest
2431
steps:
2532
- uses: actions/checkout@v4
2633
- name: Install packages
2734
run: source tools/ci.sh && ci_qemu_setup_arm
28-
- name: Build and run test suite
29-
run: source tools/ci.sh && ci_qemu_build_arm
35+
- name: Build and run test suite ci_qemu_build_arm_${{ matrix.ci_func }}
36+
run: source tools/ci.sh && ci_qemu_build_arm_${{ matrix.ci_func }}
3037
- name: Print failures
3138
if: failure()
3239
run: tests/run-tests.py --print-failures

.github/workflows/ports_unix.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,23 @@ jobs:
262262
- name: Print failures
263263
if: failure()
264264
run: tests/run-tests.py --print-failures
265+
266+
sanitize_undefined:
267+
runs-on: ubuntu-latest
268+
steps:
269+
- uses: actions/checkout@v4
270+
- name: Install packages
271+
run: source tools/ci.sh && ci_unix_coverage_setup
272+
- name: Build
273+
run: source tools/ci.sh && ci_unix_sanitize_undefined_build
274+
- name: Run main test suite
275+
run: source tools/ci.sh && ci_unix_sanitize_undefined_run_tests
276+
- name: Test merging .mpy files
277+
run: source tools/ci.sh && ci_unix_coverage_run_mpy_merge_tests
278+
- name: Build native mpy modules
279+
run: source tools/ci.sh && ci_native_mpy_modules_build
280+
- name: Test importing .mpy generated by mpy_ld.py
281+
run: source tools/ci.sh && ci_unix_coverage_run_native_mpy_tests
282+
- name: Print failures
283+
if: failure()
284+
run: tests/run-tests.py --print-failures

.github/workflows/ports_windows.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,36 @@ jobs:
2828
visualstudio: ['2017', '2019', '2022']
2929
include:
3030
- visualstudio: '2017'
31-
runner: windows-latest
3231
vs_version: '[15, 16)'
3332
- visualstudio: '2019'
34-
runner: windows-2019
3533
vs_version: '[16, 17)'
3634
- visualstudio: '2022'
37-
runner: windows-2022
3835
vs_version: '[17, 18)'
3936
# trim down the number of jobs in the matrix
4037
exclude:
4138
- variant: standard
4239
configuration: Debug
4340
- visualstudio: '2019'
4441
configuration: Debug
42+
runs-on: windows-latest
4543
env:
4644
CI_BUILD_CONFIGURATION: ${{ matrix.configuration }}
47-
runs-on: ${{ matrix.runner }}
4845
steps:
4946
- name: Install Visual Studio 2017
5047
if: matrix.visualstudio == '2017'
5148
run: |
5249
choco install visualstudio2017buildtools
5350
choco install visualstudio2017-workload-vctools
5451
choco install windows-sdk-8.1
52+
- name: Install Visual Studio 2019
53+
if: matrix.visualstudio == '2019'
54+
run: |
55+
choco install visualstudio2019buildtools
56+
choco install visualstudio2019-workload-vctools
57+
choco install windows-sdk-8.1
5558
- uses: microsoft/setup-msbuild@v2
5659
with:
5760
vs-version: ${{ matrix.vs_version }}
58-
- uses: actions/setup-python@v5
59-
if: matrix.runner == 'windows-2019'
60-
with:
61-
python-version: '3.9'
6261
- uses: actions/checkout@v4
6362
- name: Build mpy-cross.exe
6463
run: msbuild mpy-cross\mpy-cross.vcxproj -maxcpucount -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }}
@@ -103,7 +102,7 @@ jobs:
103102
env: i686
104103
- sys: mingw64
105104
env: x86_64
106-
runs-on: windows-2022
105+
runs-on: windows-latest
107106
env:
108107
CHERE_INVOKING: enabled_from_arguments
109108
defaults:

docs/develop/natmod.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,14 @@ Linker limitation: the native module is not linked against the symbol table of t
8181
full MicroPython firmware. Rather, it is linked against an explicit table of exported
8282
symbols found in ``mp_fun_table`` (in ``py/nativeglue.h``), that is fixed at firmware
8383
build time. It is thus not possible to simply call some arbitrary HAL/OS/RTOS/system
84-
function, for example.
84+
function, for example, unless that resides at a fixed address. In that case, the path
85+
of a linkerscript containing a series of symbol names and their fixed address can be
86+
passed to ``mpy_ld.py`` via the ``--externs`` command line argument. That way symbols
87+
appearing in the linkerscript will take precedence over what is provided from object
88+
files, but at the moment the object files' implementation will still reside in the
89+
final MPY file. The linkerscript parser is limited in its capabilities, and is
90+
currently used only for parsing the ESP8266 port ROM symbols list (see
91+
``ports/esp8266/boards/eagle.rom.addr.v6.ld``).
8592

8693
New symbols can be added to the end of the table and the firmware rebuilt.
8794
The symbols also need to be added to ``tools/mpy_ld.py``'s ``fun_table`` dict in the

docs/esp32/quickref.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,27 @@ Legacy methods:
544544

545545
Equivalent to ``ADC.block().init(bits=bits)``.
546546

547+
The only chip that can switch resolution to a lower one is the normal esp32.
548+
The C2 & S3 are stuck at 12 bits, while the S2 is at 13 bits.
549+
547550
For compatibility, the ``ADC`` object also provides constants matching the
548-
supported ADC resolutions:
551+
supported ADC resolutions, per chip:
549552

553+
ESP32:
550554
- ``ADC.WIDTH_9BIT`` = 9
551555
- ``ADC.WIDTH_10BIT`` = 10
552556
- ``ADC.WIDTH_11BIT`` = 11
553557
- ``ADC.WIDTH_12BIT`` = 12
554558

559+
ESP32 C3 & S3:
560+
- ``ADC.WIDTH_12BIT`` = 12
561+
562+
ESP32 S2:
563+
- ``ADC.WIDTH_13BIT`` = 13
564+
565+
.. method:: ADC.deinit()
566+
567+
Provided to deinit the adc driver.
555568

556569
Software SPI bus
557570
----------------

docs/library/esp32.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,31 @@ Functions
1818
Configure whether or not a touch will wake the device from sleep.
1919
*wake* should be a boolean value.
2020

21+
.. note:: This is only available for boards that have touch sensor support.
22+
2123
.. function:: wake_on_ulp(wake)
2224

2325
Configure whether or not the Ultra-Low-Power co-processor can wake the
2426
device from sleep. *wake* should be a boolean value.
2527

28+
.. note:: This is only available for boards that have ULP coprocessor support.
29+
2630
.. function:: wake_on_ext0(pin, level)
2731

2832
Configure how EXT0 wakes the device from sleep. *pin* can be ``None``
2933
or a valid Pin object. *level* should be ``esp32.WAKEUP_ALL_LOW`` or
3034
``esp32.WAKEUP_ANY_HIGH``.
3135

36+
.. note:: This is only available for boards that have ext0 support.
37+
3238
.. function:: wake_on_ext1(pins, level)
3339

3440
Configure how EXT1 wakes the device from sleep. *pins* can be ``None``
3541
or a tuple/list of valid Pin objects. *level* should be ``esp32.WAKEUP_ALL_LOW``
3642
or ``esp32.WAKEUP_ANY_HIGH``.
3743

44+
.. note:: This is only available for boards that have ext1 support.
45+
3846
.. function:: gpio_deep_sleep_hold(enable)
3947

4048
Configure whether non-RTC GPIO pin configuration is retained during

docs/library/framebuf.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ Other methods
137137
is compared to the value from *palette*, not to the value directly from
138138
*fbuf*.)
139139

140+
*fbuf* can be another FrameBuffer instance, or a tuple or list of the form::
141+
142+
(buffer, width, height, format)
143+
144+
or::
145+
146+
(buffer, width, height, format, stride)
147+
148+
This matches the signature of the FrameBuffer constructor, and the elements
149+
of the tuple/list are the same as the arguments to the constructor except that
150+
the *buffer* here can be read-only.
151+
140152
The *palette* argument enables blitting between FrameBuffers with differing
141153
formats. Typical usage is to render a monochrome or grayscale glyph/icon to
142154
a color display. The *palette* is a FrameBuffer instance whose format is

docs/library/socket.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,28 @@ Methods
227227
has the same "no short writes" policy for blocking sockets, and will return
228228
number of bytes sent on non-blocking sockets.
229229

230-
.. method:: socket.recv(bufsize)
230+
.. method:: socket.recv(bufsize, [flags])
231231

232232
Receive data from the socket. The return value is a bytes object representing the data
233233
received. The maximum amount of data to be received at once is specified by bufsize.
234234

235+
Most ports support the optional *flags* argument. Available *flags* are defined as constants
236+
in the socket module and have the same meaning as in CPython. ``MSG_PEEK`` and ``MSG_DONTWAIT``
237+
are supported on all ports which accept the *flags* argument.
238+
235239
.. method:: socket.sendto(bytes, address)
236240

237241
Send data to the socket. The socket should not be connected to a remote socket, since the
238242
destination socket is specified by *address*.
239243

240-
.. method:: socket.recvfrom(bufsize)
244+
.. method:: socket.recvfrom(bufsize, [flags])
241245

242246
Receive data from the socket. The return value is a pair *(bytes, address)* where *bytes* is a
243247
bytes object representing the data received and *address* is the address of the socket sending
244248
the data.
245249

250+
See the `recv` function for an explanation of the optional *flags* argument.
251+
246252
.. method:: socket.setsockopt(level, optname, value)
247253

248254
Set the value of the given socket option. The needed symbolic constants are defined in the

docs/rp2/quickref.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ Use the :mod:`machine.Timer` class::
135135
tim = Timer(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1))
136136
tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))
137137

138+
By default, timer callbacks run as soft IRQs so they can allocate but
139+
are prone to GC jitter and delays. Pass ``hard=True`` to the ``Timer()``
140+
constructor or ``init()`` method to run the callback in hard-IRQ context
141+
instead. This reduces delay and jitter, but see :ref:`isr_rules` for the
142+
restrictions that apply to hard-IRQ handlers.
143+
138144

139145
.. _rp2_Pins_and_GPIO:
140146

drivers/esp-hosted/esp_hosted_bthci_uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int esp_hosted_hci_cmd(int ogf, int ocf, size_t param_len, const uint8_t *param_
7272
// Receive HCI event packet, initially reading 3 bytes (HCI Event, Event code, Plen).
7373
for (mp_uint_t start = mp_hal_ticks_ms(), size = 3, i = 0; i < size;) {
7474
while (!mp_bluetooth_hci_uart_any()) {
75-
MICROPY_EVENT_POLL_HOOK
75+
mp_event_wait_ms(1);
7676
// Timeout.
7777
if ((mp_hal_ticks_ms() - start) > HCI_COMMAND_TIMEOUT) {
7878
error_printf("timeout waiting for HCI packet\n");
@@ -126,7 +126,7 @@ int mp_bluetooth_hci_controller_init(void) {
126126
if (mp_bluetooth_hci_uart_any()) {
127127
mp_bluetooth_hci_uart_readchar();
128128
}
129-
MICROPY_EVENT_POLL_HOOK
129+
mp_event_wait_ms(1);
130130
}
131131

132132
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY

0 commit comments

Comments
 (0)