Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into PWM_and_Time_hard…
Browse files Browse the repository at this point in the history
…ware_pulse_and_Test
  • Loading branch information
IhorNehrutsa committed Dec 16, 2024
2 parents 6e5ca00 + ee8d8b3 commit bbdb2c4
Show file tree
Hide file tree
Showing 116 changed files with 703 additions and 660 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ports_unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
(cd ports/unix && gcov -o build-coverage/py ../../py/*.c || true)
(cd ports/unix && gcov -o build-coverage/extmod ../../extmod/*.c || true)
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
Expand Down
6 changes: 6 additions & 0 deletions docs/library/binascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ Functions
Encode binary data in base64 format, as in `RFC 3548
<https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
followed by a newline character if newline is true, as a bytes object.

.. function:: crc32(data, [value])

Compute CRC-32, the 32-bit checksum of *data*, starting with an initial CRC
of *value*. The default initial CRC is zero. The algorithm is consistent
with the ZIP file checksum.
2 changes: 1 addition & 1 deletion docs/library/bluetooth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ L2CAP connection-oriented-channels

Connect to a listening peer on the specified *psm* with local MTU set to *mtu*.

On successful connection, the the ``_IRQ_L2CAP_CONNECT`` event will be
On successful connection, the ``_IRQ_L2CAP_CONNECT`` event will be
raised, allowing the client to obtain the CID and the local and remote (peer) MTU.

An unsuccessful connection will raise the ``_IRQ_L2CAP_DISCONNECT`` event
Expand Down
5 changes: 4 additions & 1 deletion docs/library/machine.RTC.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ Methods

Get the number of milliseconds left before the alarm expires.

.. method:: RTC.cancel(alarm_id=0)
.. method:: RTC.alarm_cancel(alarm_id=0)

Cancel a running alarm.

The mimxrt port also exposes this function as ``RTC.cancel(alarm_id=0)``, but this is
scheduled to be removed in MicroPython 2.0.

.. method:: RTC.irq(*, trigger, handler=None, wake=machine.IDLE)

Create an irq object triggered by a real time clock alarm.
Expand Down
2 changes: 1 addition & 1 deletion docs/library/machine.TimerWiPy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Methods

Otherwise, a TimerChannel object is initialized and returned.

The operating mode is is the one configured to the Timer object that was used to
The operating mode is the one configured to the Timer object that was used to
create the channel.

- ``channel`` if the width of the timer is 16-bit, then must be either ``TIMER.A``, ``TIMER.B``.
Expand Down
2 changes: 1 addition & 1 deletion docs/library/pyb.Timer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Methods
- ``callback`` - as per TimerChannel.callback()

- ``pin`` None (the default) or a Pin object. If specified (and not None)
this will cause the alternate function of the the indicated pin
this will cause the alternate function of the indicated pin
to be configured for this timer channel. An error will be raised if
the pin doesn't support any alternate functions for this timer channel.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/manifest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ re-flashing the entire firmware. However, it can still be useful to
selectively freeze some rarely-changing dependencies (such as third-party
libraries).

The way to list the Python files to be be frozen into the firmware is via
The way to list the Python files to be frozen into the firmware is via
a "manifest", which is a Python file that will be interpreted by the build
process. Typically you would write a manifest file as part of a board
definition, but you can also write a stand-alone manifest file and use it with
Expand Down
10 changes: 10 additions & 0 deletions drivers/memory/spiflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#define CMD_RD_DEVID (0x9f)
#define CMD_CHIP_ERASE (0xc7)
#define CMD_C4READ (0xeb)
#define CMD_RSTEN (0x66)
#define CMD_RESET (0x99)

// 32 bit addressing commands
#define CMD_WRITE_32 (0x12)
Expand Down Expand Up @@ -180,6 +182,14 @@ void mp_spiflash_init(mp_spiflash_t *self) {
// Ensure SPI flash is out of sleep mode
mp_spiflash_deepsleep_internal(self, 0);

// Software reset.
#if MICROPY_HW_SPIFLASH_SOFT_RESET
mp_spiflash_write_cmd(self, CMD_RSTEN);
mp_spiflash_write_cmd(self, CMD_RESET);
mp_spiflash_wait_wip0(self);
mp_hal_delay_ms(1);
#endif

#if defined(CHECK_DEVID)
// Validate device id
uint32_t devid;
Expand Down
2 changes: 1 addition & 1 deletion extmod/extmod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,6 @@ $(BUILD)/$(OPENAMP_DIR)/lib/virtio_mmio/virtio_mmio_drv.o: CFLAGS += -Wno-unused
# We need to have generated libmetal before compiling OpenAMP.
$(addprefix $(BUILD)/, $(SRC_OPENAMP_C:.c=.o)): $(BUILD)/openamp/metal/config.h

SRC_THIRDPARTY_C += $(SRC_LIBMETAL_C) $(SRC_OPENAMP_C)
SRC_THIRDPARTY_C += $(SRC_OPENAMP_C) $(SRC_LIBMETAL_C:$(BUILD)/%=%)

endif # MICROPY_PY_OPENAMP
23 changes: 21 additions & 2 deletions extmod/modplatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,34 @@
// See: https://sourceforge.net/p/predef/wiki/Home/

#if defined(__ARM_ARCH)
#if defined(__ARM_ARCH_ISA_A64)
#define MICROPY_PLATFORM_ARCH "aarch64"
#else
#define MICROPY_PLATFORM_ARCH "arm"
#endif
#elif defined(__x86_64__) || defined(_M_X64)
#define MICROPY_PLATFORM_ARCH "x86_64"
#elif defined(__i386__) || defined(_M_IX86)
#define MICROPY_PLATFORM_ARCH "x86"
#elif defined(__xtensa__)
#define MICROPY_PLATFORM_ARCH "xtensa"
#elif defined(__riscv)
#if __riscv_xlen == 64
#define MICROPY_PLATFORM_ARCH "riscv64"
#else
#define MICROPY_PLATFORM_ARCH "riscv"
#endif
#else
#define MICROPY_PLATFORM_ARCH ""
#endif

#if defined(__GNUC__)
#if defined(__clang__)
#define MICROPY_PLATFORM_COMPILER \
"Clang " \
MP_STRINGIFY(__clang_major__) "." \
MP_STRINGIFY(__clang_minor__) "." \
MP_STRINGIFY(__clang_patchlevel__)
#elif defined(__GNUC__)
#define MICROPY_PLATFORM_COMPILER \
"GCC " \
MP_STRINGIFY(__GNUC__) "." \
Expand Down Expand Up @@ -86,12 +100,17 @@
#elif defined(_PICOLIBC__)
#define MICROPY_PLATFORM_LIBC_LIB "picolibc"
#define MICROPY_PLATFORM_LIBC_VER _PICOLIBC_VERSION
#elif defined(__ANDROID__)
#define MICROPY_PLATFORM_LIBC_LIB "bionic"
#define MICROPY_PLATFORM_LIBC_VER MP_STRINGIFY(__ANDROID_API__)
#else
#define MICROPY_PLATFORM_LIBC_LIB ""
#define MICROPY_PLATFORM_LIBC_VER ""
#endif

#if defined(__linux)
#if defined(__ANDROID__)
#define MICROPY_PLATFORM_SYSTEM "Android"
#elif defined(__linux)
#define MICROPY_PLATFORM_SYSTEM "Linux"
#elif defined(__unix__)
#define MICROPY_PLATFORM_SYSTEM "Unix"
Expand Down
2 changes: 1 addition & 1 deletion ports/cc3200/FreeRTOS/Source/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) == pdFALSE )
{
/* Is it in the suspended list because it is in the Suspended
state, or because is is blocked with no timeout? */
state, or because it is blocked with no timeout? */
if( listIS_CONTAINED_WITHIN( NULL, &( pxTCB->xEventListItem ) ) != pdFALSE )
{
xReturn = pdTRUE;
Expand Down
10 changes: 0 additions & 10 deletions ports/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
# needs to be duplicated for out-of-tree builds, and can easily get out of date.
cmake_minimum_required(VERSION 3.12)

# Retrieve IDF version
include($ENV{IDF_PATH}/tools/cmake/version.cmake)
set(IDF_VERSION "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")

# Set the board if it's not already set.
if(NOT MICROPY_BOARD)
set(MICROPY_BOARD ESP32_GENERIC)
Expand All @@ -35,12 +31,6 @@ set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
# Save the manifest file set from the cmake command line.
set(MICROPY_USER_FROZEN_MANIFEST ${MICROPY_FROZEN_MANIFEST})

# Specific options for IDF v5.2 and later
set(SDKCONFIG_IDF_VERSION_SPECIFIC "")
if (IDF_VERSION VERSION_GREATER_EQUAL "5.2.0")
set(SDKCONFIG_IDF_VERSION_SPECIFIC boards/sdkconfig.idf52)
endif()

# Include board config; this is expected to set (among other options):
# - SDKCONFIG_DEFAULTS
# - IDF_TARGET
Expand Down
6 changes: 6 additions & 0 deletions ports/esp32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# This is a simple, convenience wrapper around idf.py (which uses cmake).

include ../../py/verbose.mk

# Select the board to build for:
ifdef BOARD_DIR
# Custom board path - remove trailing slash and get the final component of
Expand Down Expand Up @@ -61,6 +63,10 @@ ifdef MICROPY_PREVIEW_VERSION_2
IDFPY_FLAGS += -D MICROPY_PREVIEW_VERSION_2=1
endif

ifeq ($(BUILD_VERBOSE),1)
IDFPY_FLAGS += --verbose
endif

HELP_BUILD_ERROR ?= "See \033[1;31mhttps://github.com/micropython/micropython/wiki/Build-Troubleshooting\033[0m"

define RUN_IDF_PY
Expand Down
2 changes: 1 addition & 1 deletion ports/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ manage the ESP32 microcontroller, as well as a way to manage the required
build environment and toolchains needed to build the firmware.

The ESP-IDF changes quickly and MicroPython only supports certain versions.
Currently MicroPython supports v5.0.4, v5.0.5, v5.1.2, v5.2.0, v5.2.2.
Currently MicroPython supports v5.2, v5.2.2, and v5.3.

To install the ESP-IDF the full instructions can be found at the
[Espressif Getting Started guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#installation-step-by-step).
Expand Down
20 changes: 9 additions & 11 deletions ports/esp32/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,26 @@
#define DEFAULT_VREF 1100

void madcblock_bits_helper(machine_adc_block_obj_t *self, mp_int_t bits) {
if (bits < SOC_ADC_RTC_MIN_BITWIDTH && bits > SOC_ADC_RTC_MAX_BITWIDTH) {
// Invalid value for the current chip, raise exception in the switch below.
bits = -1;
}
switch (bits) {
#if CONFIG_IDF_TARGET_ESP32
case 9:
self->width = ADC_WIDTH_BIT_9;
self->width = ADC_BITWIDTH_9;
break;
case 10:
self->width = ADC_WIDTH_BIT_10;
self->width = ADC_BITWIDTH_10;
break;
case 11:
self->width = ADC_WIDTH_BIT_11;
self->width = ADC_BITWIDTH_11;
break;
#endif
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3
case 12:
self->width = ADC_WIDTH_BIT_12;
self->width = ADC_BITWIDTH_12;
break;
#endif
#if CONFIG_IDF_TARGET_ESP32S2
case 13:
self->width = ADC_WIDTH_BIT_13;
self->width = ADC_BITWIDTH_13;
break;
#endif
default:
mp_raise_ValueError(MP_ERROR_TEXT("invalid bits"));
}
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/ARDUINO_NANO_ESP32/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set(IDF_TARGET esp32s3)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.usb
boards/sdkconfig.ble
boards/sdkconfig.240mhz
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/ESP32_GENERIC/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
)
1 change: 0 additions & 1 deletion ports/esp32/boards/ESP32_GENERIC_C3/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32c3)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
boards/ESP32_GENERIC_C3/sdkconfig.c3usb
)
1 change: 0 additions & 1 deletion ports/esp32/boards/ESP32_GENERIC_C6/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32c6)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.c6
boards/sdkconfig.ble
)
1 change: 0 additions & 1 deletion ports/esp32/boards/ESP32_GENERIC_S2/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32s2)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.usb
boards/sdkconfig.spiram_sx
)
1 change: 0 additions & 1 deletion ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32s3)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.usb
boards/sdkconfig.ble
boards/sdkconfig.spiram_sx
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
)

Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32c3)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
boards/LOLIN_C3_MINI/sdkconfig.board
)
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/LOLIN_S2_MINI/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32s2)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.spiram_sx
boards/sdkconfig.usb
)
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/LOLIN_S2_PICO/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32s2)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.spiram_sx
boards/sdkconfig.usb
)
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/M5STACK_ATOM/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
boards/sdkconfig.240mhz
boards/M5STACK_ATOM/sdkconfig.board
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/M5STACK_NANOC6/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32c6)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.c6
boards/sdkconfig.ble
)
1 change: 0 additions & 1 deletion ports/esp32/boards/OLIMEX_ESP32_EVB/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
boards/OLIMEX_ESP32_EVB/sdkconfig.board
)
1 change: 0 additions & 1 deletion ports/esp32/boards/OLIMEX_ESP32_POE/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
boards/OLIMEX_ESP32_POE/sdkconfig.board
)
1 change: 0 additions & 1 deletion ports/esp32/boards/SIL_WESP32/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.ble
boards/sdkconfig.240mhz
boards/SIL_WESP32/sdkconfig.board
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_FEATHERS2/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(IDF_TARGET esp32s2)
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.spiram_sx
boards/sdkconfig.usb
boards/UM_FEATHERS2/sdkconfig.board
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_FEATHERS2NEO/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(IDF_TARGET esp32s2)
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.spiram_sx
boards/sdkconfig.usb
boards/UM_FEATHERS2NEO/sdkconfig.board
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_FEATHERS3/mpconfigboard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(IDF_TARGET esp32s3)

set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
${SDKCONFIG_IDF_VERSION_SPECIFIC}
boards/sdkconfig.usb
boards/sdkconfig.ble
boards/sdkconfig.240mhz
Expand Down
Loading

0 comments on commit bbdb2c4

Please sign in to comment.