mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
Compare commits
43 Commits
22cff2f6f5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9274f80130 | ||
|
|
099cc9f507 | ||
|
|
78ff170de9 | ||
|
|
2bd337ef18 | ||
|
|
7702f7f59d | ||
|
|
365cdb6f56 | ||
|
|
504adc689b | ||
|
|
4d7c2fd186 | ||
|
|
c25667f6a9 | ||
|
|
84061266ec | ||
|
|
4538599475 | ||
|
|
d3391b7632 | ||
|
|
d357eff2bc | ||
|
|
9939eae599 | ||
|
|
37bac07f5d | ||
|
|
3f796b687b | ||
|
|
0b1a6bebae | ||
|
|
5ea9a2662d | ||
|
|
a94f8114f3 | ||
|
|
797925c057 | ||
|
|
e6a7dc1114 | ||
|
|
2db2f536ac | ||
|
|
b24c9cf2a9 | ||
|
|
1ef76c7fba | ||
|
|
8dc05cdba3 | ||
|
|
bfacf821f4 | ||
|
|
7357fc583b | ||
|
|
bdf7613296 | ||
|
|
ff7f7449d2 | ||
|
|
eb5d89cd83 | ||
|
|
50a06b6404 | ||
|
|
e6f1f78713 | ||
|
|
604cda5d54 | ||
|
|
521b2f86be | ||
|
|
83131c106d | ||
|
|
2fbd72ad78 | ||
|
|
f63e64f4bc | ||
|
|
9c2b0cd2e3 | ||
|
|
41acdd8083 | ||
|
|
63c94fe73e | ||
|
|
f43810b1cd | ||
|
|
14b5080515 | ||
|
|
9b73e344eb |
1
.github/workflows/ports_esp32.yml
vendored
1
.github/workflows/ports_esp32.yml
vendored
@@ -30,6 +30,7 @@ jobs:
|
||||
- esp32_build_cmod_spiram_s2
|
||||
- esp32_build_s3_c3
|
||||
- esp32_build_c2_c5_c6
|
||||
- esp32_build_p4
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
2
.github/workflows/ports_stm32.yml
vendored
2
.github/workflows/ports_stm32.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install packages
|
||||
run: tools/ci.sh stm32_setup
|
||||
run: tools/ci.sh stm32_setup && tools/ci.sh stm32_path >> $GITHUB_PATH
|
||||
- name: Build ci_${{matrix.ci_func }}
|
||||
run: tools/ci.sh ${{ matrix.ci_func }}
|
||||
|
||||
|
||||
@@ -4,37 +4,47 @@
|
||||
class Timer -- control hardware timers
|
||||
======================================
|
||||
|
||||
Hardware timers deal with timing of periods and events. Timers are perhaps
|
||||
the most flexible and heterogeneous kind of hardware in MCUs and SoCs,
|
||||
differently greatly from a model to a model. MicroPython's Timer class
|
||||
defines a baseline operation of executing a callback with a given period
|
||||
(or once after some delay), and allow specific boards to define more
|
||||
non-standard behaviour (which thus won't be portable to other boards).
|
||||
Timer class provides the ability to trigger a Python callback function after an
|
||||
expiry time, or periodically at a regular interval.
|
||||
|
||||
See discussion of :ref:`important constraints <machine_callbacks>` on
|
||||
Timer callbacks.
|
||||
|
||||
.. note::
|
||||
|
||||
Memory can't be allocated inside irq handlers (an interrupt) and so
|
||||
exceptions raised within a handler don't give much information. See
|
||||
:func:`micropython.alloc_emergency_exception_buf` for how to get around
|
||||
this limitation, which applies to all callbacks of Timers created with
|
||||
``hard=True``.
|
||||
The available features and restrictions of Timer objects vary depending on the
|
||||
MicroPython board and port.
|
||||
|
||||
If you are using a WiPy board please refer to :ref:`machine.TimerWiPy <machine.TimerWiPy>`
|
||||
instead of this class.
|
||||
|
||||
Timer Types
|
||||
-----------
|
||||
|
||||
There are two types of Timer in MicroPython, but not all ports support both:
|
||||
|
||||
- Virtual timers. These are managed in software, and are generally more
|
||||
flexible. Multiple virtual timers can be constructed and active at once. The
|
||||
``id`` of a virtual timer is ``-1``. Not all ports support virtual timers, but
|
||||
it's recommended to use them when available.
|
||||
- Hardware timers. Hardware timers have integer ``id`` values starting at ``0``.
|
||||
The number of available ``id`` values is determined by the hardware. Hardware
|
||||
timers may be more accurate for very fine sub-millisecond timing (especially
|
||||
when ``hard=True`` is supported and set, see :ref:`isr_rules`.) Most
|
||||
microcontroller ports support hardware timers, except Zephyr and RP2 which
|
||||
only support virtual timers.
|
||||
|
||||
Constructors
|
||||
------------
|
||||
|
||||
.. class:: Timer(id, /, ...)
|
||||
|
||||
Construct a new timer object of the given ``id``. ``id`` of -1 constructs a
|
||||
virtual timer (if supported by a board).
|
||||
Construct a new Timer object with the given ``id``.
|
||||
|
||||
On ports which support virtual timers the ``id`` parameter is optional - the
|
||||
default value is ``-1`` which constructs a virtual timer.
|
||||
|
||||
On ports which support hardware timers, setting the ``id`` parameter to a
|
||||
non-negative integer determines which timer to use.
|
||||
|
||||
``id`` shall not be passed as a keyword argument.
|
||||
|
||||
See ``init`` for parameters of initialisation.
|
||||
Any additional parameters are handled the same as :func:`Timer.init()`.
|
||||
|
||||
Methods
|
||||
-------
|
||||
@@ -73,22 +83,22 @@ Methods
|
||||
|
||||
- ``callback`` - The callable to call upon expiration of the timer period.
|
||||
The callback must take one argument, which is passed the Timer object.
|
||||
|
||||
The ``callback`` argument shall be specified. Otherwise an exception
|
||||
will occur upon timer expiration:
|
||||
``TypeError: 'NoneType' object isn't callable``
|
||||
|
||||
- ``hard`` can be one of:
|
||||
|
||||
- ``True`` - The callback will be executed in hard interrupt
|
||||
context, which minimises delay and jitter but is subject to the
|
||||
limitations described in :ref:`isr_rules` including being unable
|
||||
to allocate on the heap.
|
||||
- ``True`` - The callback will be executed in hard interrupt context,
|
||||
which minimises delay and jitter but is subject to the limitations
|
||||
described in :ref:`isr_rules`. Not all ports support hard interrupts,
|
||||
see the port documentation for more information.
|
||||
- ``False`` - The callback will be scheduled as a soft interrupt,
|
||||
allowing it to allocate but possibly also introducing
|
||||
garbage-collection delays and jitter.
|
||||
|
||||
The default value of this option is port-specific for historical
|
||||
reasons.
|
||||
The default value of this parameter is port-specific for historical reasons.
|
||||
|
||||
.. method:: Timer.deinit()
|
||||
|
||||
|
||||
@@ -18,16 +18,6 @@ defines a baseline operation of executing a callback with a given period
|
||||
(or once after some delay), and allow specific boards to define more
|
||||
non-standard behaviour (which thus won't be portable to other boards).
|
||||
|
||||
See discussion of :ref:`important constraints <machine_callbacks>` on
|
||||
Timer callbacks.
|
||||
|
||||
.. note::
|
||||
|
||||
Memory can't be allocated inside irq handlers (an interrupt) and so
|
||||
exceptions raised within a handler don't give much information. See
|
||||
:func:`micropython.alloc_emergency_exception_buf` for how to get around this
|
||||
limitation.
|
||||
|
||||
Constructors
|
||||
------------
|
||||
|
||||
@@ -134,6 +124,9 @@ Methods
|
||||
``TimerWiPy.ONE_SHOT``. In the case that mode is ``TimerWiPy.PWM`` then trigger must be equal to
|
||||
``TimerWiPy.MATCH``.
|
||||
|
||||
Note that callback handlers are hard interrupts, and the constraints described in :ref:`isr_rules`
|
||||
apply when they are executed.
|
||||
|
||||
Returns a callback object.
|
||||
|
||||
.. method:: timerchannel.freq([value])
|
||||
|
||||
@@ -11,14 +11,6 @@ and unrestricted access to and control of hardware blocks on a system
|
||||
malfunction, lockups, crashes of your board, and in extreme cases, hardware
|
||||
damage.
|
||||
|
||||
.. _machine_callbacks:
|
||||
|
||||
A note of callbacks used by functions and class methods of :mod:`machine` module:
|
||||
all these callbacks should be considered as executing in an interrupt context.
|
||||
This is true for both physical devices with IDs >= 0 and "virtual" devices
|
||||
with negative IDs like -1 (these "virtual" devices are still thin shims on
|
||||
top of real hardware and real hardware interrupts). See :ref:`isr_rules`.
|
||||
|
||||
Memory access
|
||||
-------------
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#define HAS_BUILTIN_DRIVERS (MICROPY_HW_USB_CDC || MICROPY_HW_USB_MSC)
|
||||
|
||||
#define RHPORT TUD_OPT_RHPORT
|
||||
|
||||
const mp_obj_type_t machine_usb_device_type;
|
||||
|
||||
static mp_obj_t usb_device_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
@@ -111,11 +113,11 @@ static mp_obj_t usb_device_submit_xfer(mp_obj_t self, mp_obj_t ep, mp_obj_t buff
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("ep"));
|
||||
}
|
||||
|
||||
if (!usbd_edpt_claim(USBD_RHPORT, ep_addr)) {
|
||||
if (!usbd_edpt_claim(RHPORT, ep_addr)) {
|
||||
mp_raise_OSError(MP_EBUSY);
|
||||
}
|
||||
|
||||
result = usbd_edpt_xfer(USBD_RHPORT, ep_addr, buf_info.buf, buf_info.len);
|
||||
result = usbd_edpt_xfer(RHPORT, ep_addr, buf_info.buf, buf_info.len);
|
||||
|
||||
if (result) {
|
||||
// Store the buffer object until the transfer completes
|
||||
@@ -168,14 +170,14 @@ static mp_obj_t usb_device_stall(size_t n_args, const mp_obj_t *args) {
|
||||
|
||||
usb_device_check_active(self);
|
||||
|
||||
mp_obj_t res = mp_obj_new_bool(usbd_edpt_stalled(USBD_RHPORT, epnum));
|
||||
mp_obj_t res = mp_obj_new_bool(usbd_edpt_stalled(RHPORT, epnum));
|
||||
|
||||
if (n_args == 3) { // Set stall state
|
||||
mp_obj_t stall = args[2];
|
||||
if (mp_obj_is_true(stall)) {
|
||||
usbd_edpt_stall(USBD_RHPORT, epnum);
|
||||
usbd_edpt_stall(RHPORT, epnum);
|
||||
} else {
|
||||
usbd_edpt_clear_stall(USBD_RHPORT, epnum);
|
||||
usbd_edpt_clear_stall(RHPORT, epnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Submodule lib/micropython-lib updated: 34c4ee1647...6ae440a8a1
@@ -112,4 +112,4 @@ size-files:
|
||||
# This is done in a dedicated build directory as some CMake cache values are not
|
||||
# set correctly if not all submodules are loaded yet.
|
||||
submodules:
|
||||
$(Q)IDF_COMPONENT_MANAGER=0 idf.py $(IDFPY_FLAGS) -B $(BUILD)/submodules -D UPDATE_SUBMODULES=1 reconfigure
|
||||
$(Q)idf.py $(IDFPY_FLAGS) -B $(BUILD)/submodules -D UPDATE_SUBMODULES=1 reconfigure
|
||||
|
||||
@@ -6,7 +6,7 @@ microcontrollers. It uses the ESP-IDF framework and MicroPython runs as
|
||||
a task under FreeRTOS.
|
||||
|
||||
Currently supports ESP32, ESP32-C2 (aka ESP8684), ESP32-C3, ESP32-C5, ESP32-C6,
|
||||
ESP32-S2 and ESP32-S3. ESP8266 is supported by a separate MicroPython port.
|
||||
ESP32-P4, ESP32-S2 and ESP32-S3. ESP8266 is supported by a separate MicroPython port.
|
||||
|
||||
Supported features include:
|
||||
- REPL (Python prompt) over UART0 and/or the integrated USB peripheral.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"WiFi"
|
||||
],
|
||||
"images": [
|
||||
"esp32c2_devkitmini.jpg"
|
||||
"esp8684_devkitc.jpg"
|
||||
],
|
||||
"mcu": "esp32c2",
|
||||
"product": "ESP32-C2",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"WiFi"
|
||||
],
|
||||
"images": [
|
||||
"esp32c5_devkitmini.jpg"
|
||||
"esp32c5_devkitc.jpg"
|
||||
],
|
||||
"mcu": "esp32c5",
|
||||
"product": "ESP32-C5",
|
||||
|
||||
25
ports/esp32/boards/ESP32_GENERIC_P4/board.json
Normal file
25
ports/esp32/boards/ESP32_GENERIC_P4/board.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"deploy": [
|
||||
"../deploy.md"
|
||||
],
|
||||
"deploy_options": {
|
||||
"flash_offset": "0x2000"
|
||||
},
|
||||
"docs": "",
|
||||
"features": [
|
||||
"BLE",
|
||||
"WiFi"
|
||||
],
|
||||
"images": [
|
||||
"esp32_p4_function_ev_board.jpg"
|
||||
],
|
||||
"mcu": "esp32p4",
|
||||
"product": "ESP32-P4",
|
||||
"thumbnail": "",
|
||||
"url": "https://www.espressif.com/en/products/modules",
|
||||
"variants": {
|
||||
"C5_WIFI": "Support for external C5 WiFi/BLE",
|
||||
"C6_WIFI": "Support for external C6 WiFi/BLE"
|
||||
},
|
||||
"vendor": "Espressif"
|
||||
}
|
||||
11
ports/esp32/boards/ESP32_GENERIC_P4/board.md
Normal file
11
ports/esp32/boards/ESP32_GENERIC_P4/board.md
Normal file
@@ -0,0 +1,11 @@
|
||||
The following firmware is applicable to most development boards based on ESP32-P4, and
|
||||
the development boards must be equipped with at least 16 MiB external SPI Flash.
|
||||
|
||||
This board has multiple variants available:
|
||||
|
||||
* If your board has a standalone ESP32-P4 processor (or the board has a coprocessor but
|
||||
you do not want to use it) then choose the generic variant (first heading below).
|
||||
* If your board has an external ESP32-C5 coprocessor for WiFi and BLE then choose the
|
||||
"C5 WiFi/BLE" variant.
|
||||
* If your board has an external ESP32-C6 coprocessor for WiFi and BLE then choose the
|
||||
"C6 WiFi/BLE" variant.
|
||||
6
ports/esp32/boards/ESP32_GENERIC_P4/mpconfigboard.cmake
Normal file
6
ports/esp32/boards/ESP32_GENERIC_P4/mpconfigboard.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
set(IDF_TARGET esp32p4)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
boards/sdkconfig.p4
|
||||
)
|
||||
31
ports/esp32/boards/ESP32_GENERIC_P4/mpconfigboard.h
Normal file
31
ports/esp32/boards/ESP32_GENERIC_P4/mpconfigboard.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// Both of these can be set by mpconfigboard.cmake if a BOARD_VARIANT is
|
||||
// specified.
|
||||
|
||||
#ifndef MICROPY_HW_BOARD_NAME
|
||||
#define MICROPY_HW_BOARD_NAME "Generic ESP32P4 module"
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_HW_MCU_NAME
|
||||
#define MICROPY_HW_MCU_NAME "ESP32P4"
|
||||
#endif
|
||||
|
||||
#define MICROPY_PY_ESPNOW (0)
|
||||
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
#ifndef USB_SERIAL_JTAG_PACKET_SZ_BYTES
|
||||
#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)
|
||||
#endif
|
||||
|
||||
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
|
||||
#define MICROPY_HW_ENABLE_UART_REPL (1)
|
||||
|
||||
#define MICROPY_PY_MACHINE_I2S (1)
|
||||
|
||||
// Disable Wi-Fi and Bluetooth by default, these are re-enabled in the WIFI variants
|
||||
#ifndef MICROPY_PY_NETWORK_WLAN
|
||||
#define MICROPY_PY_NETWORK_WLAN (0)
|
||||
#endif
|
||||
#ifndef MICROPY_PY_BLUETOOTH
|
||||
#define MICROPY_PY_BLUETOOTH (0)
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
set(IDF_TARGET esp32p4)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
boards/sdkconfig.p4
|
||||
boards/sdkconfig.p4_wifi_common
|
||||
boards/sdkconfig.p4_wifi_c5
|
||||
)
|
||||
|
||||
list(APPEND MICROPY_DEF_BOARD
|
||||
MICROPY_HW_BOARD_NAME="Generic ESP32P4 module with WIFI module of external ESP32C5"
|
||||
MICROPY_PY_NETWORK_WLAN=1
|
||||
MICROPY_PY_BLUETOOTH=1
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
set(IDF_TARGET esp32p4)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
boards/sdkconfig.p4
|
||||
boards/sdkconfig.p4_wifi_common
|
||||
boards/sdkconfig.p4_wifi_c6
|
||||
)
|
||||
|
||||
list(APPEND MICROPY_DEF_BOARD
|
||||
MICROPY_HW_BOARD_NAME="Generic ESP32P4 module with WIFI module of external ESP32C6"
|
||||
MICROPY_PY_NETWORK_WLAN=1
|
||||
MICROPY_PY_BLUETOOTH=1
|
||||
)
|
||||
@@ -22,5 +22,8 @@
|
||||
"vendor": "Espressif",
|
||||
"variants": {
|
||||
"SPIRAM_OCT": "Support for Octal-SPIRAM"
|
||||
},
|
||||
"old_variants": {
|
||||
"FLASH_4M": ["4MiB flash", "Use the standard variant instead."]
|
||||
}
|
||||
}
|
||||
|
||||
23
ports/esp32/boards/SOLDERED_NULA_MINI/board.json
Normal file
23
ports/esp32/boards/SOLDERED_NULA_MINI/board.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"deploy": [
|
||||
"../deploy.md"
|
||||
],
|
||||
"deploy_options": {
|
||||
"flash_offset": "0"
|
||||
},
|
||||
"docs": "",
|
||||
"features": [
|
||||
"BLE",
|
||||
"WiFi",
|
||||
"USB-C",
|
||||
"JST-PH"
|
||||
],
|
||||
"images": [
|
||||
"soldered-nula-mini-esp32c6.jpg"
|
||||
],
|
||||
"mcu": "esp32c6",
|
||||
"product": "NULA Mini",
|
||||
"thumbnail": "",
|
||||
"url": "https://soldered.com/product/nula-mini-esp32-c6/",
|
||||
"vendor": "Soldered Electronics"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
set(IDF_TARGET esp32c6)
|
||||
|
||||
set(SDKCONFIG_DEFAULTS
|
||||
boards/sdkconfig.base
|
||||
boards/sdkconfig.riscv
|
||||
boards/sdkconfig.c6
|
||||
boards/sdkconfig.ble
|
||||
)
|
||||
10
ports/esp32/boards/SOLDERED_NULA_MINI/mpconfigboard.h
Normal file
10
ports/esp32/boards/SOLDERED_NULA_MINI/mpconfigboard.h
Normal file
@@ -0,0 +1,10 @@
|
||||
// This configuration is for a generic ESP32C6 board with 4MiB (or more) of flash.
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Soldered NULA Mini"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32C6"
|
||||
|
||||
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
|
||||
#define MICROPY_HW_ENABLE_UART_REPL (1)
|
||||
|
||||
#define MICROPY_HW_I2C0_SCL (7)
|
||||
#define MICROPY_HW_I2C0_SDA (6)
|
||||
7
ports/esp32/boards/SOLDERED_NULA_MINI/pins.csv
Normal file
7
ports/esp32/boards/SOLDERED_NULA_MINI/pins.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
IO2,GPIO2
|
||||
IO3,GPIO3
|
||||
IO4,GPIO4
|
||||
IO5,GPIO5
|
||||
IO18,GPIO18
|
||||
IO19,GPIO19
|
||||
USER_BUTTON,GPIO9
|
||||
|
@@ -7,8 +7,8 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../../tools"))
|
||||
import boardgen
|
||||
|
||||
|
||||
# Pins start at zero, and the highest pin index on any ESP32* chip is 48.
|
||||
NUM_GPIOS = 49
|
||||
# Pins start at zero, and the highest pin index on any ESP32* chip is 54.
|
||||
NUM_GPIOS = 55
|
||||
|
||||
|
||||
class Esp32Pin(boardgen.Pin):
|
||||
|
||||
18
ports/esp32/boards/sdkconfig.p4
Normal file
18
ports/esp32/boards/sdkconfig.p4
Normal file
@@ -0,0 +1,18 @@
|
||||
# Select the minimum chip revision to cover all possible boards.
|
||||
CONFIG_ESP32P4_REV_MIN_0=y
|
||||
|
||||
# Flash
|
||||
CONFIG_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
|
||||
# Memory
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_MEMTEST=
|
||||
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
|
||||
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
|
||||
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768
|
||||
|
||||
# ULP: not fixed
|
||||
CONFIG_SOC_ULP_SUPPORTED=n
|
||||
CONFIG_ULP_COPROC_ENABLED=n
|
||||
CONFIG_ULP_COPROC_TYPE_FSM=n
|
||||
2
ports/esp32/boards/sdkconfig.p4_wifi_c5
Normal file
2
ports/esp32/boards/sdkconfig.p4_wifi_c5
Normal file
@@ -0,0 +1,2 @@
|
||||
# Most settings are in sdkconfig.p4_wifi_common
|
||||
CONFIG_SLAVE_IDF_TARGET_ESP32C5=y
|
||||
2
ports/esp32/boards/sdkconfig.p4_wifi_c6
Normal file
2
ports/esp32/boards/sdkconfig.p4_wifi_c6
Normal file
@@ -0,0 +1,2 @@
|
||||
# Most settings are in sdkconfig.p4_wifi_common
|
||||
CONFIG_SLAVE_IDF_TARGET_ESP32C6=y
|
||||
59
ports/esp32/boards/sdkconfig.p4_wifi_common
Normal file
59
ports/esp32/boards/sdkconfig.p4_wifi_common
Normal file
@@ -0,0 +1,59 @@
|
||||
# This sdkconfig file has the common settings for an ESP32-P4
|
||||
# host with an external ESP-Hosted Wi-Fi/BT interface.
|
||||
|
||||
# Wifi
|
||||
CONFIG_ESP_HOSTED_ENABLED=y
|
||||
CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16
|
||||
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64
|
||||
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=64
|
||||
CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y
|
||||
CONFIG_ESP_WIFI_TX_BA_WIN=32
|
||||
CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y
|
||||
CONFIG_ESP_WIFI_RX_BA_WIN=32
|
||||
|
||||
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=65534
|
||||
CONFIG_LWIP_TCP_WND_DEFAULT=65534
|
||||
CONFIG_LWIP_TCP_RECVMBOX_SIZE=64
|
||||
CONFIG_LWIP_UDP_RECVMBOX_SIZE=64
|
||||
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
|
||||
|
||||
CONFIG_LWIP_TCP_SACK_OUT=y
|
||||
|
||||
# Bluetooth Support
|
||||
CONFIG_ESP_HOSTED_ENABLE_BT_BLUEDROID=y
|
||||
CONFIG_ESP_HOSTED_ENABLE_BT_NIMBLE=y
|
||||
CONFIG_ESP_HOSTED_NIMBLE_HCI_VHCI=y
|
||||
CONFIG_ESP_WIFI_REMOTE_ENABLED=y
|
||||
CONFIG_SLAVE_SOC_WIFI_SUPPORTED=y
|
||||
CONFIG_SLAVE_SOC_WIFI_WAPI_SUPPORT=y
|
||||
CONFIG_SLAVE_SOC_WIFI_CSI_SUPPORT=y
|
||||
CONFIG_SLAVE_SOC_WIFI_MESH_SUPPORT=y
|
||||
CONFIG_SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH=12
|
||||
CONFIG_SLAVE_SOC_WIFI_HW_TSF=y
|
||||
CONFIG_SLAVE_SOC_WIFI_FTM_SUPPORT=y
|
||||
CONFIG_SLAVE_FREERTOS_UNICORE=y
|
||||
CONFIG_SLAVE_SOC_WIFI_GCMP_SUPPORT=y
|
||||
CONFIG_SLAVE_IDF_TARGET_ARCH_RISCV=y
|
||||
CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT=y
|
||||
CONFIG_SLAVE_SOC_WIFI_MAC_VERSION_NUM=2
|
||||
CONFIG_ESP_WIFI_REMOTE_LIBRARY_HOSTED=y
|
||||
|
||||
CONFIG_ESP_HOSTED_P4_DEV_BOARD_FUNC_BOARD=y
|
||||
|
||||
# BLE
|
||||
CONFIG_ESP_HOSTED_ENABLE_BT_NIMBLE=y
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
CONFIG_BT_CONTROLLER_DISABLED=y
|
||||
CONFIG_BT_BLUEDROID_ENABLED=n
|
||||
CONFIG_BT_NIMBLE_TRANSPORT_UART=n
|
||||
CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR=y
|
||||
|
||||
CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="MPY ESP32"
|
||||
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4
|
||||
|
||||
CONFIG_BT_HCI_LOG_DEBUG_EN=y
|
||||
|
||||
# Increase NimBLE task stack size from the default, because Python code
|
||||
# (BLE IRQ handlers) will most likely run on this task.
|
||||
CONFIG_BT_NIMBLE_TASK_STACK_SIZE=6144
|
||||
@@ -23,7 +23,7 @@ if(CONFIG_IDF_TARGET_ARCH_RISCV)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED MICROPY_PY_TINYUSB)
|
||||
if(CONFIG_IDF_TARGET_ESP32S2 OR CONFIG_IDF_TARGET_ESP32S3)
|
||||
if(CONFIG_IDF_TARGET_ESP32S2 OR CONFIG_IDF_TARGET_ESP32S3 OR CONFIG_IDF_TARGET_ESP32P4)
|
||||
set(MICROPY_PY_TINYUSB ON)
|
||||
endif()
|
||||
endif()
|
||||
@@ -166,7 +166,9 @@ list(APPEND IDF_COMPONENTS
|
||||
driver
|
||||
esp_adc
|
||||
esp_app_format
|
||||
esp_mm
|
||||
esp_common
|
||||
esp_driver_touch_sens
|
||||
esp_eth
|
||||
esp_event
|
||||
esp_hw_support
|
||||
|
||||
@@ -30,6 +30,6 @@ direct_dependencies:
|
||||
- espressif/lan867x
|
||||
- espressif/mdns
|
||||
- idf
|
||||
manifest_hash: da32add5eb5e196ac97a99eb579025222ec572f5db4038873fbf9d3b9d6ed5a3
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32
|
||||
version: 2.0.0
|
||||
|
||||
@@ -16,6 +16,6 @@ dependencies:
|
||||
direct_dependencies:
|
||||
- espressif/mdns
|
||||
- idf
|
||||
manifest_hash: da32add5eb5e196ac97a99eb579025222ec572f5db4038873fbf9d3b9d6ed5a3
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32c2
|
||||
version: 2.0.0
|
||||
|
||||
@@ -16,6 +16,6 @@ dependencies:
|
||||
direct_dependencies:
|
||||
- espressif/mdns
|
||||
- idf
|
||||
manifest_hash: da32add5eb5e196ac97a99eb579025222ec572f5db4038873fbf9d3b9d6ed5a3
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32c3
|
||||
version: 2.0.0
|
||||
|
||||
@@ -16,6 +16,6 @@ dependencies:
|
||||
direct_dependencies:
|
||||
- espressif/mdns
|
||||
- idf
|
||||
manifest_hash: da32add5eb5e196ac97a99eb579025222ec572f5db4038873fbf9d3b9d6ed5a3
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32c5
|
||||
version: 2.0.0
|
||||
|
||||
@@ -16,6 +16,6 @@ dependencies:
|
||||
direct_dependencies:
|
||||
- espressif/mdns
|
||||
- idf
|
||||
manifest_hash: da32add5eb5e196ac97a99eb579025222ec572f5db4038873fbf9d3b9d6ed5a3
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32c6
|
||||
version: 2.0.0
|
||||
|
||||
93
ports/esp32/lockfiles/dependencies.lock.esp32p4
Normal file
93
ports/esp32/lockfiles/dependencies.lock.esp32p4
Normal file
@@ -0,0 +1,93 @@
|
||||
dependencies:
|
||||
espressif/eppp_link:
|
||||
component_hash: 41f6519edda527ec6a0553c872ebaf8fc6d3812523c9d4c8d1660ad21c720abe
|
||||
dependencies:
|
||||
- name: espressif/esp_serial_slave_link
|
||||
registry_url: https://components.espressif.com
|
||||
require: private
|
||||
version: ^1.1.0
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=5.2'
|
||||
source:
|
||||
registry_url: https://components.espressif.com
|
||||
type: service
|
||||
version: 1.1.3
|
||||
espressif/esp_hosted:
|
||||
component_hash: 53544436deb5fcbfdbf4a8e2c643cdbe31126556781784278c016d674df99cd2
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=5.3'
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 2.7.0
|
||||
espressif/esp_serial_slave_link:
|
||||
component_hash: ac1776806de0a6e371c84e87898bb983e19ce62aa7f1e2e5c4a3b0234a575d2c
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=5.0'
|
||||
source:
|
||||
registry_url: https://components.espressif.com
|
||||
type: service
|
||||
version: 1.1.2
|
||||
espressif/esp_wifi_remote:
|
||||
component_hash: 4ed1ebe454d63ddb4a91bbd8db74a6f883c85a863db1f79770c57fbd2e5c134c
|
||||
dependencies:
|
||||
- name: espressif/eppp_link
|
||||
registry_url: https://components.espressif.com
|
||||
require: private
|
||||
version: '>=0.1'
|
||||
- name: espressif/esp_hosted
|
||||
registry_url: https://components.espressif.com
|
||||
require: private
|
||||
rules:
|
||||
- if: target in [esp32h2, esp32p4]
|
||||
version: '>=0.0.6'
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=5.3'
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 0.15.2
|
||||
espressif/mdns:
|
||||
component_hash: 46ee81d32fbf850462d8af1e83303389602f6a6a9eddd2a55104cb4c063858ed
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=5.0'
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 1.1.0
|
||||
espressif/tinyusb:
|
||||
component_hash: ee1c962cff61eb975d508258d509974d58031cc27ff0d6c4117a67a613a49594
|
||||
dependencies:
|
||||
- name: idf
|
||||
version: '>=5.0'
|
||||
source:
|
||||
git: https://github.com/micropython/tinyusb-espressif.git
|
||||
path: .
|
||||
type: git
|
||||
targets:
|
||||
- esp32s2
|
||||
- esp32s3
|
||||
- esp32p4
|
||||
- esp32h4
|
||||
version: e4c0ec3caab3d9c25374de7047653b9ced8f14ff
|
||||
idf:
|
||||
source:
|
||||
type: idf
|
||||
version: 5.5.1
|
||||
direct_dependencies:
|
||||
- espressif/esp_hosted
|
||||
- espressif/esp_wifi_remote
|
||||
- espressif/mdns
|
||||
- espressif/tinyusb
|
||||
- idf
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32p4
|
||||
version: 2.0.0
|
||||
@@ -32,6 +32,6 @@ direct_dependencies:
|
||||
- espressif/mdns
|
||||
- espressif/tinyusb
|
||||
- idf
|
||||
manifest_hash: da32add5eb5e196ac97a99eb579025222ec572f5db4038873fbf9d3b9d6ed5a3
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32s2
|
||||
version: 2.0.0
|
||||
|
||||
@@ -32,6 +32,6 @@ direct_dependencies:
|
||||
- espressif/mdns
|
||||
- espressif/tinyusb
|
||||
- idf
|
||||
manifest_hash: da32add5eb5e196ac97a99eb579025222ec572f5db4038873fbf9d3b9d6ed5a3
|
||||
manifest_hash: 482087bc40f0e187795a9ef9ad08ef15a585b4cdabc296c715a9d19284622150
|
||||
target: esp32s3
|
||||
version: 2.0.0
|
||||
|
||||
@@ -136,6 +136,21 @@ static const machine_adc_obj_t madc_obj[] = {
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_7, GPIO_NUM_18},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_8, GPIO_NUM_19},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_9, GPIO_NUM_20},
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_0, GPIO_NUM_16},
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_1, GPIO_NUM_17},
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_2, GPIO_NUM_18},
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_3, GPIO_NUM_19},
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_4, GPIO_NUM_20},
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_5, GPIO_NUM_21},
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_6, GPIO_NUM_22},
|
||||
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_7, GPIO_NUM_23},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_0, GPIO_NUM_49},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_1, GPIO_NUM_50},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_2, GPIO_NUM_51},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_3, GPIO_NUM_52},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_4, GPIO_NUM_53},
|
||||
{{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_5, GPIO_NUM_54},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -73,6 +73,10 @@
|
||||
#define MICROPY_HW_SPI2_SCK (36)
|
||||
#define MICROPY_HW_SPI2_MOSI (35)
|
||||
#define MICROPY_HW_SPI2_MISO (37)
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
#define MICROPY_HW_SPI2_SCK (43)
|
||||
#define MICROPY_HW_SPI2_MOSI (44)
|
||||
#define MICROPY_HW_SPI2_MISO (39)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
#define GPIO_FIRST_NON_OUTPUT (34)
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#define GPIO_FIRST_NON_OUTPUT (46)
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
#define GPIO_FIRST_NON_OUTPUT (54)
|
||||
#endif
|
||||
|
||||
// Return the gpio_num_t index for a given machine_pin_obj_t pointer.
|
||||
|
||||
@@ -216,6 +216,66 @@
|
||||
#define MICROPY_HW_ENABLE_GPIO47 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO48 (1)
|
||||
#endif
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
#define MICROPY_HW_ENABLE_GPIO0 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO1 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO2 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO3 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO4 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO5 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO6 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO7 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO8 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO9 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO10 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO11 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO12 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO13 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO14 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO15 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO16 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO17 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO18 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO19 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO20 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO21 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO22 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO23 (1)
|
||||
#if !MICROPY_HW_ESP_USB_SERIAL_JTAG
|
||||
// Note: ESP32-P4 can switch USJ to 26/27 instead, but
|
||||
// this isn't supported
|
||||
#define MICROPY_HW_ENABLE_GPIO24 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO25 (1)
|
||||
#endif
|
||||
#define MICROPY_HW_ENABLE_GPIO26 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO27 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO28 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO29 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO30 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO31 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO32 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO33 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO34 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO35 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO36 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO37 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO38 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO39 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO40 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO41 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO42 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO43 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO44 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO45 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO46 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO47 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO48 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO49 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO50 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO51 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO52 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO53 (1)
|
||||
#define MICROPY_HW_ENABLE_GPIO54 (1)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
|
||||
#define TIMER_FLAGS 0
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
static uint8_t __DECLARE_RCC_ATOMIC_ENV __attribute__ ((unused));
|
||||
#endif
|
||||
const mp_obj_type_t machine_timer_type;
|
||||
|
||||
static mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
|
||||
@@ -41,8 +41,11 @@
|
||||
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32 only
|
||||
#include "driver/touch_pad.h"
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 2 // All other SoCs with touch, to date
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 2 // most ESP32
|
||||
#include "driver/touch_sensor.h"
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 3 // At present, it can only be used on ESP32P4.
|
||||
#include "driver/touch_sens.h"
|
||||
#include "soc/touch_sensor_channel.h"
|
||||
#else
|
||||
#error "Unknown touch hardware version"
|
||||
#endif
|
||||
@@ -50,9 +53,18 @@
|
||||
typedef struct _mtp_obj_t {
|
||||
mp_obj_base_t base;
|
||||
gpio_num_t gpio_id;
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 1 || SOC_TOUCH_SENSOR_VERSION == 2
|
||||
touch_pad_t touchpad_id;
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 3
|
||||
int touchpad_id;
|
||||
#endif
|
||||
} mtp_obj_t;
|
||||
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 3
|
||||
static touch_sensor_handle_t touch_sens_handle;
|
||||
static touch_channel_handle_t touch_chan_handle[15];
|
||||
#endif
|
||||
|
||||
static const mtp_obj_t touchpad_obj[] = {
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
{{&machine_touchpad_type}, GPIO_NUM_4, TOUCH_PAD_NUM0},
|
||||
@@ -80,6 +92,21 @@ static const mtp_obj_t touchpad_obj[] = {
|
||||
{{&machine_touchpad_type}, GPIO_NUM_12, TOUCH_PAD_NUM12},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_13, TOUCH_PAD_NUM13},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_14, TOUCH_PAD_NUM14},
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
{{&machine_touchpad_type}, GPIO_NUM_2, TOUCH_PAD_GPIO2_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_3, TOUCH_PAD_GPIO3_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_4, TOUCH_PAD_GPIO4_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_5, TOUCH_PAD_GPIO5_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_6, TOUCH_PAD_GPIO6_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_7, TOUCH_PAD_GPIO7_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_8, TOUCH_PAD_GPIO8_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_9, TOUCH_PAD_GPIO9_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_10, TOUCH_PAD_GPIO10_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_11, TOUCH_PAD_GPIO11_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_12, TOUCH_PAD_GPIO12_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_13, TOUCH_PAD_GPIO13_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_14, TOUCH_PAD_GPIO14_CHANNEL},
|
||||
{{&machine_touchpad_type}, GPIO_NUM_15, TOUCH_PAD_GPIO15_CHANNEL},
|
||||
#else
|
||||
#error "Please add GPIO mapping for this SoC"
|
||||
#endif
|
||||
@@ -102,14 +129,45 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
|
||||
|
||||
static int initialized = 0;
|
||||
if (!initialized) {
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 1 || SOC_TOUCH_SENSOR_VERSION == 2
|
||||
touch_pad_init();
|
||||
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 3
|
||||
touch_sensor_sample_config_t sample_cfg[1] = {
|
||||
TOUCH_SENSOR_V3_DEFAULT_SAMPLE_CONFIG(1, 1, 1),
|
||||
};
|
||||
touch_sensor_config_t sens_cfg = TOUCH_SENSOR_DEFAULT_BASIC_CONFIG(1, sample_cfg);
|
||||
check_esp_err(touch_sensor_new_controller(&sens_cfg, &touch_sens_handle));
|
||||
touch_sensor_filter_config_t filter_cfg = TOUCH_SENSOR_DEFAULT_FILTER_CONFIG();
|
||||
check_esp_err(touch_sensor_config_filter(touch_sens_handle, &filter_cfg));
|
||||
#endif
|
||||
initialized = 1;
|
||||
}
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 3
|
||||
else {
|
||||
// Stop the touch controller so a new channel can be added.
|
||||
check_esp_err(touch_sensor_stop_continuous_scanning(touch_sens_handle));
|
||||
check_esp_err(touch_sensor_disable(touch_sens_handle));
|
||||
}
|
||||
#endif
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 1
|
||||
esp_err_t err = touch_pad_config(self->touchpad_id, 0);
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 2
|
||||
esp_err_t err = touch_pad_config(self->touchpad_id);
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 3
|
||||
touch_channel_config_t chan_cfg = {
|
||||
.active_thresh = {1000},
|
||||
};
|
||||
esp_err_t err = ESP_OK;
|
||||
if (touch_chan_handle[self->touchpad_id] != NULL) {
|
||||
err = touch_sensor_del_channel(touch_chan_handle[self->touchpad_id]);
|
||||
touch_chan_handle[self->touchpad_id] = NULL;
|
||||
}
|
||||
if (err == ESP_OK) {
|
||||
err = touch_sensor_new_channel(touch_sens_handle, self->touchpad_id, &chan_cfg, &touch_chan_handle[self->touchpad_id]);
|
||||
}
|
||||
check_esp_err(touch_sensor_enable(touch_sens_handle));
|
||||
check_esp_err(touch_sensor_start_continuous_scanning(touch_sens_handle));
|
||||
#endif
|
||||
if (err == ESP_OK) {
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 2
|
||||
@@ -121,6 +179,7 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
|
||||
}
|
||||
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 1 || SOC_TOUCH_SENSOR_VERSION == 2
|
||||
static mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
|
||||
mtp_obj_t *self = self_in;
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 1
|
||||
@@ -135,6 +194,7 @@ static mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(mtp_config_obj, mtp_config);
|
||||
#endif
|
||||
|
||||
static mp_obj_t mtp_read(mp_obj_t self_in) {
|
||||
mtp_obj_t *self = self_in;
|
||||
@@ -144,6 +204,9 @@ static mp_obj_t mtp_read(mp_obj_t self_in) {
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 2
|
||||
uint32_t value;
|
||||
esp_err_t err = touch_pad_read_raw_data(self->touchpad_id, &value);
|
||||
#elif SOC_TOUCH_SENSOR_VERSION == 3
|
||||
uint32_t value;
|
||||
esp_err_t err = touch_channel_read_data(touch_chan_handle[self->touchpad_id], TOUCH_CHAN_DATA_TYPE_SMOOTH, &value);
|
||||
#endif
|
||||
if (err == ESP_OK) {
|
||||
return MP_OBJ_NEW_SMALL_INT(value);
|
||||
@@ -154,7 +217,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(mtp_read_obj, mtp_read);
|
||||
|
||||
static const mp_rom_map_elem_t mtp_locals_dict_table[] = {
|
||||
// instance methods
|
||||
#if SOC_TOUCH_SENSOR_VERSION == 1 || SOC_TOUCH_SENSOR_VERSION == 2
|
||||
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&mtp_config_obj) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mtp_read_obj) },
|
||||
};
|
||||
|
||||
|
||||
@@ -293,6 +293,14 @@ static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
|
||||
self->tx = 5;
|
||||
break;
|
||||
#endif
|
||||
#if SOC_UART_HP_NUM > 3
|
||||
case UART_NUM_3:
|
||||
break;
|
||||
#endif
|
||||
#if SOC_UART_HP_NUM > 4
|
||||
case UART_NUM_4:
|
||||
break;
|
||||
#endif
|
||||
case UART_NUM_MAX:
|
||||
assert(0); // Range is checked in mp_machine_uart_make_new, value should be unreachable
|
||||
}
|
||||
|
||||
@@ -90,7 +90,8 @@ int vprintf_null(const char *format, va_list ap) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
time_t platform_mbedtls_time(time_t *timer) {
|
||||
#if MICROPY_SSL_MBEDTLS
|
||||
static time_t platform_mbedtls_time(time_t *timer) {
|
||||
// mbedtls_time requires time in seconds from EPOCH 1970
|
||||
|
||||
struct timeval tv;
|
||||
@@ -98,6 +99,7 @@ time_t platform_mbedtls_time(time_t *timer) {
|
||||
|
||||
return tv.tv_sec + TIMEUTILS_SECONDS_1970_TO_2000;
|
||||
}
|
||||
#endif
|
||||
|
||||
void mp_task(void *pvParameter) {
|
||||
volatile uint32_t sp = (uint32_t)esp_cpu_get_sp();
|
||||
@@ -106,7 +108,8 @@ void mp_task(void *pvParameter) {
|
||||
#endif
|
||||
#if MICROPY_HW_ESP_USB_SERIAL_JTAG
|
||||
usb_serial_jtag_init();
|
||||
#elif MICROPY_HW_ENABLE_USBDEV
|
||||
#endif
|
||||
#if MICROPY_HW_ENABLE_USBDEV
|
||||
usb_phy_init();
|
||||
#endif
|
||||
#if MICROPY_HW_ENABLE_UART_REPL
|
||||
@@ -114,8 +117,10 @@ void mp_task(void *pvParameter) {
|
||||
#endif
|
||||
machine_init();
|
||||
|
||||
#if MICROPY_SSL_MBEDTLS
|
||||
// Configure time function, for mbedtls certificate time validation.
|
||||
mbedtls_platform_set_time(platform_mbedtls_time);
|
||||
#endif
|
||||
|
||||
esp_err_t err = esp_event_loop_create_default();
|
||||
if (err != ESP_OK) {
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
## IDF Component Manager Manifest File
|
||||
dependencies:
|
||||
espressif/mdns: "~1.1.0"
|
||||
espressif/tinyusb:
|
||||
rules:
|
||||
- if: "target in [esp32s2, esp32s3]"
|
||||
- if: "target in [esp32s2, esp32s3, esp32p4]"
|
||||
# Temporary workaround for https://github.com/hathach/tinyusb/issues/3154
|
||||
# Can be removed once fix is released in espressif/tinyusb
|
||||
git: https://github.com/micropython/tinyusb-espressif.git
|
||||
version: cherrypick/dwc2_zlp_fix
|
||||
espressif/esp_hosted:
|
||||
rules:
|
||||
- if: "target == esp32p4"
|
||||
version: "2.7.0"
|
||||
espressif/esp_wifi_remote:
|
||||
rules:
|
||||
- if: "target == esp32p4"
|
||||
version: "0.15.2"
|
||||
espressif/lan867x:
|
||||
version: "~1.0.0"
|
||||
rules:
|
||||
|
||||
@@ -196,7 +196,7 @@ static mp_obj_t esp32_wake_on_gpio(size_t n_args, const mp_obj_t *pos_args, mp_m
|
||||
}
|
||||
static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_gpio_obj, 0, esp32_wake_on_gpio);
|
||||
|
||||
#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
|
||||
#if SOC_GPIO_SUPPORT_HOLD_IO_IN_DSLP && !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
|
||||
static mp_obj_t esp32_gpio_deep_sleep_hold(const mp_obj_t enable) {
|
||||
if (mp_obj_is_true(enable)) {
|
||||
gpio_deep_sleep_hold_en();
|
||||
@@ -331,7 +331,7 @@ static const mp_rom_map_elem_t esp32_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_wake_on_ulp), MP_ROM_PTR(&esp32_wake_on_ulp_obj) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_wake_on_gpio), MP_ROM_PTR(&esp32_wake_on_gpio_obj) },
|
||||
#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
|
||||
#if SOC_GPIO_SUPPORT_HOLD_IO_IN_DSLP && !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
|
||||
{ MP_ROM_QSTR(MP_QSTR_gpio_deep_sleep_hold), MP_ROM_PTR(&esp32_gpio_deep_sleep_hold_obj) },
|
||||
#endif
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
|
||||
@@ -260,8 +260,12 @@ static mp_int_t mp_machine_reset_cause(void) {
|
||||
}
|
||||
|
||||
#if MICROPY_ESP32_USE_BOOTLOADER_RTC
|
||||
#if !CONFIG_IDF_TARGET_ESP32P4
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "usb.h"
|
||||
#else
|
||||
#include "soc/lp_system_reg.h"
|
||||
#endif
|
||||
#if CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/rom/usb/usb_dc.h"
|
||||
#include "esp32s3/rom/usb/usb_persist.h"
|
||||
@@ -274,8 +278,13 @@ MP_NORETURN static void machine_bootloader_rtc(void) {
|
||||
usb_dc_prepare_persist();
|
||||
chip_usb_set_persist_flags(USBDC_BOOT_DFU);
|
||||
#endif
|
||||
#if !CONFIG_IDF_TARGET_ESP32P4
|
||||
REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
|
||||
esp_restart();
|
||||
#else
|
||||
REG_WRITE(LP_SYSTEM_REG_SYS_CTRL_REG, LP_SYSTEM_REG_FORCE_DOWNLOAD_BOOT);
|
||||
esp_restart();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
#include "lwip/igmp.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
// See note at bottom of file about why this isn't MICROPY_PY_SOCKET
|
||||
#if MICROPY_PY_NETWORK
|
||||
|
||||
#define SOCKET_POLL_US (100000)
|
||||
#define MDNS_QUERY_TIMEOUT_MS (5000)
|
||||
#define MDNS_LOCAL_SUFFIX ".local"
|
||||
@@ -1028,3 +1031,5 @@ const mp_obj_module_t mp_module_socket = {
|
||||
// this will not conflict with the common implementation provided by
|
||||
// extmod/mod{lwip,socket}.c.
|
||||
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_socket, mp_module_socket);
|
||||
|
||||
#endif // MICROPY_PY_NETWORK
|
||||
|
||||
@@ -92,6 +92,9 @@
|
||||
#endif
|
||||
#ifndef MICROPY_PY_BLUETOOTH
|
||||
#define MICROPY_PY_BLUETOOTH (1)
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_BLUETOOTH
|
||||
#define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS (1)
|
||||
#define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS_WITH_INTERLOCK (1)
|
||||
// Event stack size is the RTOS stack size minus an allowance for the stack used
|
||||
@@ -102,7 +105,8 @@
|
||||
#define MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING (1)
|
||||
#define MICROPY_BLUETOOTH_NIMBLE (1)
|
||||
#define MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY (1)
|
||||
#endif
|
||||
#endif // MICROPY_PY_BLUETOOTH
|
||||
|
||||
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (esp_random())
|
||||
#define MICROPY_PY_OS_INCLUDEFILE "ports/esp32/modos.c"
|
||||
#define MICROPY_PY_OS_DUPTERM (1)
|
||||
@@ -158,7 +162,9 @@
|
||||
#define MICROPY_PY_MACHINE_UART_IRQ (1)
|
||||
#define MICROPY_PY_MACHINE_WDT (1)
|
||||
#define MICROPY_PY_MACHINE_WDT_INCLUDEFILE "ports/esp32/machine_wdt.c"
|
||||
#ifndef MICROPY_PY_NETWORK
|
||||
#define MICROPY_PY_NETWORK (1)
|
||||
#endif
|
||||
#ifndef MICROPY_PY_NETWORK_HOSTNAME_DEFAULT
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32"
|
||||
@@ -174,6 +180,8 @@
|
||||
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32c5"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C6
|
||||
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32c6"
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-esp32p4"
|
||||
#endif
|
||||
#endif
|
||||
#define MICROPY_PY_NETWORK_INCLUDEFILE "ports/esp32/modnetwork.h"
|
||||
@@ -189,10 +197,10 @@
|
||||
#ifndef MICROPY_HW_ESP_NEW_I2C_DRIVER
|
||||
#define MICROPY_HW_ESP_NEW_I2C_DRIVER (0)
|
||||
#endif
|
||||
#define MICROPY_PY_SSL (1)
|
||||
#define MICROPY_SSL_MBEDTLS (1)
|
||||
#define MICROPY_PY_WEBSOCKET (1)
|
||||
#define MICROPY_PY_WEBREPL (1)
|
||||
#define MICROPY_PY_SSL (MICROPY_PY_NETWORK)
|
||||
#define MICROPY_SSL_MBEDTLS (MICROPY_PY_SSL)
|
||||
#define MICROPY_PY_WEBSOCKET (MICROPY_PY_NETWORK)
|
||||
#define MICROPY_PY_WEBREPL (MICROPY_PY_NETWORK)
|
||||
#define MICROPY_PY_ONEWIRE (1)
|
||||
#define MICROPY_PY_SOCKET_EVENTS (MICROPY_PY_WEBREPL)
|
||||
#define MICROPY_PY_BLUETOOTH_RANDOM_ADDR (1)
|
||||
@@ -251,6 +259,17 @@
|
||||
#define MICROPY_HW_USB_PRODUCT_FS_STRING "Espressif Device"
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
// By default, ESP32-P4 uses the HS USB PHY (RHPORT1) for TinyUSB
|
||||
// and configures the full speed USB port as USB Serial/JTAG device
|
||||
#ifndef MICROPY_HW_USB_HS
|
||||
#define MICROPY_HW_USB_HS 1
|
||||
#endif // MICROPY_HW_USB_HS
|
||||
#if MICROPY_HW_USB_HS && !defined(CFG_TUSB_RHPORT0_MODE) && !defined(CFG_TUSB_RHPORT1_MODE)
|
||||
#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // MICROPY_HW_ENABLE_USBDEV
|
||||
|
||||
// Enable stdio over native USB peripheral CDC via TinyUSB
|
||||
@@ -259,14 +278,14 @@
|
||||
#endif
|
||||
|
||||
// Enable stdio over USB Serial/JTAG peripheral
|
||||
// (SOC_USB_OTG_PERIPH_NUM is only 2 on the ESP32-P4, which supports both native USB & Serial/JTAG simultaneously)
|
||||
#ifndef MICROPY_HW_ESP_USB_SERIAL_JTAG
|
||||
#define MICROPY_HW_ESP_USB_SERIAL_JTAG (SOC_USB_SERIAL_JTAG_SUPPORTED && !MICROPY_HW_USB_CDC)
|
||||
#define MICROPY_HW_ESP_USB_SERIAL_JTAG (SOC_USB_SERIAL_JTAG_SUPPORTED && (!MICROPY_HW_USB_CDC || SOC_USB_OTG_PERIPH_NUM > 1))
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_USB_CDC && MICROPY_HW_ESP_USB_SERIAL_JTAG
|
||||
#if MICROPY_HW_USB_CDC && MICROPY_HW_ESP_USB_SERIAL_JTAG && (SOC_USB_OTG_PERIPH_NUM <= 1)
|
||||
#error "Invalid build config: Can't enable both native USB and USB Serial/JTAG peripheral"
|
||||
#endif
|
||||
|
||||
// type definitions for the specific machine
|
||||
|
||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
|
||||
@@ -345,7 +364,7 @@ typedef long mp_off_t;
|
||||
|
||||
#ifndef MICROPY_BOARD_ENTER_BOOTLOADER
|
||||
// RTC has a register to trigger bootloader on these targets
|
||||
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3
|
||||
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32P4
|
||||
#define MICROPY_ESP32_USE_BOOTLOADER_RTC (1)
|
||||
#define MICROPY_BOARD_ENTER_BOOTLOADER(nargs, args) machine_bootloader_rtc()
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "driver/spi_master.h"
|
||||
#include "esp_cache.h"
|
||||
#include "soc/gpio_reg.h"
|
||||
|
||||
#define MICROPY_PLATFORM_VERSION "IDF" IDF_VER
|
||||
@@ -51,6 +52,11 @@
|
||||
#define MP_TASK_COREID (1)
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
#define MP_HAL_CLEAN_DCACHE(data, len) \
|
||||
esp_cache_msync((void *)(data), (len), ESP_CACHE_MSYNC_FLAG_UNALIGNED | ESP_CACHE_MSYNC_FLAG_DIR_C2M)
|
||||
#endif
|
||||
|
||||
extern TaskHandle_t mp_main_task_handle;
|
||||
|
||||
extern ringbuf_t stdin_ringbuf;
|
||||
|
||||
@@ -182,13 +182,13 @@ static mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
|
||||
}
|
||||
|
||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32P4
|
||||
eth_esp32_emac_config_t esp32_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||
#endif
|
||||
|
||||
esp_eth_mac_t *mac = NULL;
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32P4
|
||||
// Dynamic ref_clk configuration.
|
||||
if (args[ARG_ref_clk_mode].u_int != -1) {
|
||||
// Map the GPIO_MODE constants to EMAC_CLK constants.
|
||||
@@ -223,7 +223,7 @@ static mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
|
||||
#endif
|
||||
|
||||
switch (args[ARG_phy_type].u_int) {
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32P4
|
||||
case PHY_LAN8710:
|
||||
case PHY_LAN8720:
|
||||
self->phy = esp_eth_phy_new_lan87xx(&phy_config);
|
||||
@@ -251,7 +251,7 @@ static mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
|
||||
self->phy = esp_eth_phy_new_generic(&phy_config);
|
||||
break;
|
||||
#endif
|
||||
#endif // CONFIG_IDF_TARGET_ESP32
|
||||
#endif // CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32P4
|
||||
#if CONFIG_ETH_USE_SPI_ETHERNET
|
||||
#if CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL
|
||||
case PHY_KSZ8851SNL: {
|
||||
@@ -286,7 +286,7 @@ static mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32P4
|
||||
if (!IS_SPI_PHY(args[ARG_phy_type].u_int)) {
|
||||
if (self->mdc_pin == -1 || self->mdio_pin == -1) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("mdc and mdio must be specified"));
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
|
||||
static void uart_irq_handler(void *arg);
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
static uint8_t __DECLARE_RCC_ATOMIC_ENV __attribute__ ((unused));
|
||||
#endif
|
||||
|
||||
// Declaring the HAL structure on the stack saves a tiny amount of static RAM
|
||||
#define REPL_HAL_DEFN() { .dev = UART_LL_GET_HW(MICROPY_HW_UART_REPL) }
|
||||
|
||||
|
||||
@@ -42,18 +42,17 @@ void usb_phy_init(void) {
|
||||
// ref: https://github.com/espressif/esp-usb/blob/4b6a798d0bed444fff48147c8dcdbbd038e92892/device/esp_tinyusb/tinyusb.c
|
||||
|
||||
// Configure USB PHY
|
||||
usb_phy_config_t phy_conf = {
|
||||
static const usb_phy_config_t phy_conf = {
|
||||
.controller = USB_PHY_CTRL_OTG,
|
||||
.otg_mode = USB_OTG_MODE_DEVICE,
|
||||
.target = USB_PHY_TARGET_INT,
|
||||
};
|
||||
// Internal USB PHY
|
||||
phy_conf.target = USB_PHY_TARGET_INT;
|
||||
|
||||
// Init ESP USB Phy
|
||||
usb_new_phy(&phy_conf, &phy_hdl);
|
||||
}
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32S3
|
||||
#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
|
||||
void usb_usj_mode(void) {
|
||||
// Switch the USB PHY back to Serial/Jtag mode, disabling OTG support
|
||||
// This should be run before jumping to bootloader.
|
||||
|
||||
@@ -71,23 +71,31 @@ static void usb_serial_jtag_handle_rx(void) {
|
||||
|
||||
static void usb_serial_jtag_isr_handler(void *arg) {
|
||||
uint32_t flags = usb_serial_jtag_ll_get_intsts_mask();
|
||||
|
||||
if (flags & USB_SERIAL_JTAG_INTR_SOF) {
|
||||
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF);
|
||||
}
|
||||
usb_serial_jtag_ll_clr_intsts_mask(flags);
|
||||
|
||||
if (flags & USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT) {
|
||||
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT);
|
||||
usb_serial_jtag_handle_rx();
|
||||
mp_hal_wake_main_task_from_isr();
|
||||
}
|
||||
|
||||
if (flags & USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY) {
|
||||
// As per the ESP-IDF driver, allow for the possibility the USJ just sent a full
|
||||
// 64-bit endpoint to the host and now it's waiting for another ZLP to flush the result
|
||||
// to the OS
|
||||
usb_serial_jtag_ll_txfifo_flush();
|
||||
|
||||
// Disable this interrupt until next time we write into the FIFO
|
||||
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
void usb_serial_jtag_init(void) {
|
||||
// Note: Don't clear the SERIAL_IN_EMPTY interrupt, as it's possible the
|
||||
// bootloader wrote enough data to the host that we need the interrupt to flush it.
|
||||
usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT |
|
||||
USB_SERIAL_JTAG_INTR_SOF);
|
||||
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT |
|
||||
USB_SERIAL_JTAG_INTR_SOF);
|
||||
USB_SERIAL_JTAG_INTR_SOF | USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
|
||||
ESP_ERROR_CHECK(esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, ESP_INTR_FLAG_LEVEL1,
|
||||
usb_serial_jtag_isr_handler, NULL, NULL));
|
||||
}
|
||||
@@ -114,10 +122,11 @@ void usb_serial_jtag_tx_strn(const char *str, size_t len) {
|
||||
}
|
||||
terminal_connected = true;
|
||||
l = usb_serial_jtag_ll_write_txfifo((const uint8_t *)str, l);
|
||||
usb_serial_jtag_ll_txfifo_flush();
|
||||
str += l;
|
||||
len -= l;
|
||||
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY);
|
||||
}
|
||||
usb_serial_jtag_ll_txfifo_flush();
|
||||
}
|
||||
|
||||
#endif // MICROPY_HW_ESP_USB_SERIAL_JTAG
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
freeze("modules")
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import deflate
|
||||
import io
|
||||
|
||||
_compressed_pinout = b'(\x91\xcd\x92\xbdn\xdb0\x10\xc7w\xbdB\x96\x1b\x93M$E\xc9\x82\xa7:Q\x83"A\x1c\xd8\x89;d*\x1a\x0f\x1d\x04\x03A:t\x0b\xbc6F:HA\x91%C\xbb\x14h\x9d<A\x1f\x86OR\x8a\x92]K"O\x96\x98\x02=\x10\x12\xc1\xfb \x7f\xff;\x07r\xdb\xb9\xf0\xbc>\x89amo\xa7\xaf\xde_\xc3\xf8\xfa\xe3\xe5\x87\x19\x8cN)\xe3\xee\x00\xf6gWS\x18\xcc\xde]]\xfe\r\xdc\xb9pc\xc7\x01\x83\x89\xf4\x97Hn\xe4\x82Q4\x8e\xceVqG\xd3O\xb0{(\xab\xeeA\xee\xceV\xba\x94\xf1\xc9|3i0\x1c\x9eUk\xaf\xbd\xffp\xa5KG\x82\xb1^\x9f\xf7\t\x8f\xa58\xd9\x8ey1P?\'\x06\x83\x9b\xaf\xdc\x12\xa4\x88\xa0\xd4\x8d\xc5\xedou\xac9*p\xd2e}\xb3\x81[\xbb\x8d\x12?\x86\xfd\xe3\xa3\xe2:\xd0\x95\xae\x1f)y\xf5/\xf7P0\xa0\xach\xb5!\xbd\x87\xeb\x12\xb4\xd7%\x99\x8b\x9f\xdf\xb3om\x93\xeb"\xff\x986\x07o\x86\xe5\x17uV\x866(CPe\x98\x8b+\x13v\x98\x98g5\x1fO\xf5M\xed\x8aL\tq\xf7\xa0\xae\xc8&J\xa9fV\x8e\xc8\xf7N\x98\x8a\xb6U\r\xc7\x06\x12\xe2\xaa\xe1\xa23\xd2Z5i\xc7\xd1\xc1\xba\x1c\rcq\xffc\xe5\xd9\xae\xc4\xd6\x17Y\xcf\x1c\xe95\xa8\x17\xe0\xeay\xb8z\xac\x83z\xbb\x87\xa7\x94\xef\xc9\x8dx\xfc,\x1e\x17\xb0a\xb6\xb0~\x03,\xc7a\xf1t\xc6\xbb\x8cJn\x125\xff-^\x0e\x16o\r\x10\x86\xc3\xe2\x83\xc1\x82\xae\xb0\x05j\x05\xd7\x16\x966\xc0\x12#,\xed\xc5\xe0\xb98l\xd8\x1dv\xa1\xe1\xb6\x85\xc5_\x0b\x10\xe2\xb0f\xad\x94\x9b\xd8\x8c\xf1\xa2\x82j\r\x0b\xf8\x1c\x02\x048\xac\x87\xc3\xb2\xee\xb0\n\xb7\x84j\x0f\xeb7\xc0r\x1c\xd6\x9c\xae\xdc\xdc\x06\xb6l\xb6\xa0\xe6\xb6\xe4\xa0l\x05\n\xa3\xf3\x130\x01\x05\xff\x0f\x10m\x00"\xc6\xce\x91\x18\xd8\x84\x99\xb2K\xde\xd6\x98"\xb9\x15\xc9Mm}y1l\x17\x9d\xb8\xc9(zm\xc4\xf63\xa0\xbb\x87j\x01\x7f]\x80\xca\x0b\xa2\x13C\x8b\xef\xbf5\xb3\xcf+\x9b\n\xaf\xa6D~\xa4\xe75=X\x13\xd0\x96\xd9\x18\xd0\x0c]\x1cm\r\xdd\xb2\xc9r\xfc\xf8\xc4\xfc\\\xd9\xe2\xc1\xf9\xb8\xc0-\x9bH\x9fu\xa3W_\x89\xee\xf0\xebV\xb9\xe9\x93\xe3\xfc\x01\x83\'\xd6K'
|
||||
|
||||
|
||||
def pinout():
|
||||
print(str(deflate.DeflateIO(io.BytesIO(_compressed_pinout), deflate.ZLIB).read(), "utf-8"))
|
||||
@@ -60,7 +60,7 @@ class Rp2Pin(boardgen.Pin):
|
||||
m = re.match("([A-Z][A-Z0-9][A-Z]+)(([0-9]+)(_.*)?)?", af)
|
||||
af_fn = m.group(1)
|
||||
af_unit = int(m.group(3)) if m.group(3) is not None else 0
|
||||
if af_idx == 10:
|
||||
if af_idx == 11:
|
||||
# AF11 uses UART_AUX in lieu of UART
|
||||
af_fn = "UART_AUX"
|
||||
if af_fn.startswith("QMI"):
|
||||
@@ -74,7 +74,7 @@ class Rp2Pin(boardgen.Pin):
|
||||
# pin can only be I2C0 _or_ I2C1, both sharing the same AF
|
||||
# index), so each PIO unit has a distinct AF index.
|
||||
af_fn = "{:s}{:d}".format(af_fn, af_unit)
|
||||
self._afs.append((af_idx + 1, af_fn, af_unit, af))
|
||||
self._afs.append((af_idx, af_fn, af_unit, af))
|
||||
|
||||
# This will be called at the start of the output (after the prefix). Use
|
||||
# it to emit the af objects (via the AF() macro in rp2_prefix.c).
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
Pin,AF1,AF2,AF3,AF4,AF5,AF6,AF7,AF8,AF9
|
||||
GPIO0,SPI0_RX,UART0_TX,I2C0_SDA,PWM0_A,SIO,PIO0,PIO1,,USB_OVCUR_DET
|
||||
GPIO1,SPI0_CS,UART0_RX,I2C0_SCL,PWM0_B,SIO,PIO0,PIO1,,USB_VBUS_DET
|
||||
GPIO2,SPI0_SCK,UART0_CTS,I2C1_SDA,PWM1_A,SIO,PIO0,PIO1,,USB_VBUS_EN
|
||||
GPIO3,SPI0_TX,UART0_RTS,I2C1_SCL,PWM1_B,SIO,PIO0,PIO1,,USB_OVCUR_DET
|
||||
GPIO4,SPI0_RX,UART1_TX,I2C0_SDA,PWM2_A,SIO,PIO0,PIO1,,USB_VBUS_DET
|
||||
GPIO5,SPI0_CS,UART1_RX,I2C0_SCL,PWM2_B,SIO,PIO0,PIO1,,USB_VBUS_EN
|
||||
GPIO6,SPI0_SCK,UART1_CTS,I2C1_SDA,PWM3_A,SIO,PIO0,PIO1,,USB_OVCUR_DET
|
||||
GPIO7,SPI0_TX,UART1_RTS,I2C1_SCL,PWM3_B,SIO,PIO0,PIO1,,USB_VBUS_DET
|
||||
GPIO8,SPI1_RX,UART1_TX,I2C0_SDA,PWM4_A,SIO,PIO0,PIO1,,USB_VBUS_EN
|
||||
GPIO9,SPI1_CS,UART1_RX,I2C0_SCL,PWM4_B,SIO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1_SCL,PWM5_B,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,UART1_RX
|
||||
GPIO28,SPI1_RX,UART0_TX,I2C0_SDA,PWM6_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,
|
||||
GPIO29,SPI1_CS,UART0_RX,I2C0_SCL,PWM6_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,
|
||||
GPIO30,SPI1_SCK,UART0_CTS,I2C1_SDA,PWM7_A,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,UART0_TX
|
||||
GPIO31,SPI1_TX,UART0_RTS,I2C1_SCL,PWM7_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,UART0_RX
|
||||
GPIO32,SPI0_RX,UART0_TX,I2C0_SDA,PWM8_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,
|
||||
GPIO33,SPI0_CS,UART0_RX,I2C0_SCL,PWM8_B,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,
|
||||
GPIO34,SPI0_SCK,UART0_CTS,I2C1_SDA,PWM9_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,UART0_TX
|
||||
GPIO35,SPI0_TX,UART0_RTS,I2C1_SCL,PWM9_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,UART0_RX
|
||||
GPIO36,SPI0_RX,UART1_TX,I2C0_SDA,PWM10_A,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,
|
||||
GPIO37,SPI0_CS,UART1_RX,I2C0_SCL,PWM10_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,
|
||||
GPIO38,SPI0_SCK,UART1_CTS,I2C1_SCL,PWM11_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,UART1_TX
|
||||
GPIO39,SPI0_TX,UART1_RTS,I2C1_SCL,PWM11_B,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,UART1_RX
|
||||
GPIO40,SPI1_RX,UART1_TX,I2C0_SDA,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IO28,,SPI1_RX,UART0_TX,I2C0_SDA,PWM6_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,
|
||||
GPIO29,,SPI1_CS,UART0_RX,I2C0_SCL,PWM6_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,
|
||||
GPIO30,,SPI1_SCK,UART0_CTS,I2C1_SDA,PWM7_A,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,UART0_TX
|
||||
GPIO31,,SPI1_TX,UART0_RTS,I2C1_SCL,PWM7_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,UART0_RX
|
||||
GPIO32,,SPI0_RX,UART0_TX,I2C0_SDA,PWM8_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,
|
||||
GPIO33,,SPI0_CS,UART0_RX,I2C0_SCL,PWM8_B,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,
|
||||
GPIO34,,SPI0_SCK,UART0_CTS,I2C1_SDA,PWM9_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,UART0_TX
|
||||
GPIO35,,SPI0_TX,UART0_RTS,I2C1_SCL,PWM9_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,UART0_RX
|
||||
GPIO36,,SPI0_RX,UART1_TX,I2C0_SDA,PWM10_A,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,
|
||||
GPIO37,,SPI0_CS,UART1_RX,I2C0_SCL,PWM10_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,
|
||||
GPIO38,,SPI0_SCK,UART1_CTS,I2C1_SCL,PWM11_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,UART1_TX
|
||||
GPIO39,,SPI0_TX,UART1_RTS,I2C1_SCL,PWM11_B,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,UART1_RX
|
||||
GPIO40,,SPI1_RX,UART1_TX,I2C0_SDA,PWM8_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,
|
||||
GPIO41,,SPI1_CS,UART1_RX,I2C0_SCL,PWM8_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,
|
||||
GPIO42,,SPI1_SCK,UART1_CTS,I2C1_SDA,PWM9_A,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,UART1_TX
|
||||
GPIO43,,SPI1_TX,UART1_RTS,I2C1_SCL,PWM9_B,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,UART1_RX
|
||||
GPIO44,,SPI1_RX,UART0_TX,I2C0_SDA,PWM10_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_EN,
|
||||
GPIO45,,SPI1_CS,UART0_RX,I2C0_SCL,PWM10_B,SIO,PIO0,PIO1,PIO2,,USB_OVCUR_DET,
|
||||
GPIO46,,SPI1_SCK,UART0_CTS,I2C1_SDA,PWM11_A,SIO,PIO0,PIO1,PIO2,,USB_VBUS_DET,UART0_TX
|
||||
GPIO47,,SPI1_TX,UART0_RTS,I2C1_SCL,PWM11_B,SIO,PIO0,PIO1,PIO2,QMI_CS1,USB_VBUS_EN,UART0_RX
|
||||
|
||||
|
@@ -521,6 +521,7 @@ static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_ALT_GPCK), MP_ROM_INT(GPIO_FUNC_GPCK) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ALT_USB), MP_ROM_INT(GPIO_FUNC_USB) },
|
||||
#if PICO_RP2350
|
||||
{ MP_ROM_QSTR(MP_QSTR_ALT_HSTX), MP_ROM_INT(GPIO_FUNC_HSTX) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ALT_XIP_CS1), MP_ROM_INT(GPIO_FUNC_XIP_CS1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ALT_CORESIGHT_TRACE), MP_ROM_INT(GPIO_FUNC_CORESIGHT_TRACE) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ALT_UART_AUX), MP_ROM_INT(GPIO_FUNC_UART_AUX) },
|
||||
|
||||
@@ -192,7 +192,9 @@ int main(int argc, char **argv) {
|
||||
machine_pin_init();
|
||||
rp2_pio_init();
|
||||
rp2_dma_init();
|
||||
#if MICROPY_PY_MACHINE_I2S
|
||||
machine_i2s_init0();
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_BLUETOOTH
|
||||
mp_bluetooth_hci_init();
|
||||
|
||||
@@ -151,6 +151,9 @@
|
||||
#define MICROPY_PY_OS_URANDOM (1)
|
||||
#define MICROPY_PY_RE_MATCH_GROUPS (1)
|
||||
#define MICROPY_PY_RE_MATCH_SPAN_START_END (1)
|
||||
#define MICROPY_PY_HASHLIB_MD5 (1)
|
||||
#define MICROPY_PY_HASHLIB_SHA1 (1)
|
||||
#define MICROPY_PY_CRYPTOLIB (1)
|
||||
#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)
|
||||
#define MICROPY_PY_TIME_TIME_TIME_NS (1)
|
||||
#define MICROPY_PY_TIME_INCLUDEFILE "ports/rp2/modtime.c"
|
||||
|
||||
@@ -427,6 +427,14 @@ static mp_obj_t rp2_dma_close(mp_obj_t self_in) {
|
||||
uint8_t channel = self->channel;
|
||||
|
||||
if (channel != CHANNEL_CLOSED) {
|
||||
// Reset this channel's registers to their default values (zeros).
|
||||
dma_channel_config config = { .ctrl = 0 };
|
||||
dma_channel_configure(channel, &config, NULL, NULL, 0, false);
|
||||
|
||||
// Abort this channel. Must be done after clearing EN bit in control
|
||||
// register due to errata RP2350-E5.
|
||||
dma_channel_abort(channel);
|
||||
|
||||
// Clean up interrupt handler to ensure garbage collection
|
||||
mp_irq_obj_t *irq = MP_STATE_PORT(rp2_dma_irq_obj[channel]);
|
||||
MP_STATE_PORT(rp2_dma_irq_obj[channel]) = MP_OBJ_NULL;
|
||||
|
||||
@@ -271,12 +271,32 @@ static void asm_pio_get_pins(PIO pio, const char *type, mp_obj_t prog_pins, mp_o
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t rotl32a(const uint32_t x, const int k) {
|
||||
return (x << k) | (x >> (32 - k));
|
||||
}
|
||||
|
||||
static void asm_pio_init_gpio(PIO pio, uint32_t sm, asm_pio_config_t *config) {
|
||||
uint32_t pinmask = ((1 << config->count) - 1) << (config->base - pio_get_gpio_base(pio));
|
||||
pio_sm_set_pins_with_mask(pio, sm, config->pinvals << (config->base - pio_get_gpio_base(pio)), pinmask);
|
||||
pio_sm_set_pindirs_with_mask(pio, sm, config->pindirs << (config->base - pio_get_gpio_base(pio)), pinmask);
|
||||
for (size_t i = 0; i < config->count; ++i) {
|
||||
gpio_set_function(config->base + i, GPIO_FUNC_PIO0 + pio_get_index(pio));
|
||||
uint gpio_base = pio_get_gpio_base(pio);
|
||||
uint32_t pinmask = rotl32a(~(-1 << config->count), config->base - gpio_base);
|
||||
uint32_t pinvals = rotl32a(config->pinvals, config->base - gpio_base);
|
||||
uint32_t pindirs = rotl32a(config->pindirs, config->base - gpio_base);
|
||||
|
||||
#if !PICO_PIO_USE_GPIO_BASE
|
||||
// optimization: avoid 64-bit arithmetic on RP2040 and RP2350A
|
||||
pio_sm_set_pins_with_mask(pio, sm, pinvals, pinmask);
|
||||
pio_sm_set_pindirs_with_mask(pio, sm, pindirs, pinmask);
|
||||
#else
|
||||
uint64_t pinmask64 = (uint64_t)pinmask << gpio_base;
|
||||
uint64_t pinvals64 = (uint64_t)pinvals << gpio_base;
|
||||
uint64_t pindirs64 = (uint64_t)pindirs << gpio_base;
|
||||
pio_sm_set_pins_with_mask64(pio, sm, pinvals64, pinmask64);
|
||||
pio_sm_set_pindirs_with_mask64(pio, sm, pindirs64, pinmask64);
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < 32; ++i) {
|
||||
if (pinmask & (1 << i)) {
|
||||
gpio_set_function(gpio_base + i, GPIO_FUNC_PIO0 + pio_get_index(pio));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,16 +9,6 @@
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (0) // QSPI extflash not mounted
|
||||
|
||||
#define MICROPY_PY_ASYNCIO (0)
|
||||
#define MICROPY_PY_DEFLATE (0)
|
||||
#define MICROPY_PY_BINASCII (0)
|
||||
#define MICROPY_PY_HASHLIB (0)
|
||||
#define MICROPY_PY_JSON (0)
|
||||
#define MICROPY_PY_RE (0)
|
||||
#define MICROPY_PY_FRAMEBUF (0)
|
||||
#define MICROPY_PY_SOCKET (0)
|
||||
#define MICROPY_PY_NETWORK (0)
|
||||
|
||||
// The board has an 24MHz HSE, the following gives 170MHz CPU speed
|
||||
#define MICROPY_HW_CLK_PLLM (6)
|
||||
#define MICROPY_HW_CLK_PLLN (85)
|
||||
|
||||
47
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/bdev.c
Normal file
47
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/bdev.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* This file is part of the MicroPython project, http://micropython.org/
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2019 Damien P. George
|
||||
*/
|
||||
|
||||
#include "storage.h"
|
||||
#include "spi.h"
|
||||
#include "qspi.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
static const spi_proto_cfg_t spi_bus = {
|
||||
.spi = &spi_obj[0], // SPI1
|
||||
.baudrate = 25000000,
|
||||
.polarity = 0,
|
||||
.phase = 0,
|
||||
.bits = 8,
|
||||
.firstbit = SPI_FIRSTBIT_MSB,
|
||||
};
|
||||
|
||||
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
|
||||
static mp_spiflash_cache_t spi_bdev_cache;
|
||||
#endif
|
||||
|
||||
const mp_spiflash_config_t spiflash_config = {
|
||||
.bus_kind = MP_SPIFLASH_BUS_SPI,
|
||||
.bus.u_spi.cs = MICROPY_HW_SPIFLASH_CS,
|
||||
|
||||
.bus.u_spi.data = (void *)&spi_bus,
|
||||
.bus.u_spi.proto = &spi_proto,
|
||||
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
|
||||
.cache = &spi_bdev_cache,
|
||||
#endif
|
||||
};
|
||||
|
||||
spi_bdev_t spi_bdev;
|
||||
|
||||
// Second external SPI flash uses hardware QSPI interface
|
||||
const mp_spiflash_config_t spiflash2_config = {
|
||||
.bus_kind = MP_SPIFLASH_BUS_QSPI,
|
||||
.bus.u_qspi.data = NULL,
|
||||
.bus.u_qspi.proto = &qspi_proto,
|
||||
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
|
||||
.cache = &spi_bdev_cache,
|
||||
#endif
|
||||
};
|
||||
|
||||
spi_bdev_t spi_bdev2;
|
||||
13
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/board.json
Normal file
13
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/board.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"deploy": [
|
||||
"deploy.md"
|
||||
],
|
||||
"features": ["External Flash", "DAC", "Display","microSD", "USB", "USB-C"],
|
||||
"images": [
|
||||
"weact_stm32h743.jpg"
|
||||
],
|
||||
"mcu": "stm32h7",
|
||||
"product": "Mini STM32H743",
|
||||
"url": "https://github.com/WeActStudio/MiniSTM32H7xx",
|
||||
"vendor": "WeAct Studio"
|
||||
}
|
||||
16
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/board_init.c
Normal file
16
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/board_init.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/* This file is part of the MicroPython project, http://micropython.org/
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2019 Damien P. George
|
||||
*/
|
||||
|
||||
#include "py/mphal.h"
|
||||
#include "storage.h"
|
||||
|
||||
void WeAct_Core_early_init(void) {
|
||||
// Turn off the USB switch.
|
||||
mp_hal_pin_output(pyb_pin_OTG_FS_POWER);
|
||||
mp_hal_pin_low(pyb_pin_OTG_FS_POWER);
|
||||
|
||||
// Explicitly init SPI2 because it's not enabled as a block device
|
||||
spi_bdev_ioctl(&spi_bdev2, BDEV_IOCTL_INIT, (uint32_t)&spiflash2_config);
|
||||
}
|
||||
19
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/deploy.md
Normal file
19
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/deploy.md
Normal file
@@ -0,0 +1,19 @@
|
||||
### WeAct Studio STM32H7xx
|
||||
|
||||
WeAct Studio make a number of STM32H7xx-based boards, they can all be updated
|
||||
using
|
||||
[DFU](https://en.wikipedia.org/wiki/USB?useskin=vector#Device_Firmware_Upgrade_mechanism).
|
||||
|
||||
### DFU update
|
||||
|
||||
Hold the Boot button - the middle of the cluster of three buttons - while the
|
||||
board is reset (either by connecting USB or by pressing reset). Release the Boot
|
||||
button shortly after the board has reset. The board ought to now be in DFU mode
|
||||
and detectable as such from a connected computer.
|
||||
|
||||
Use a tool like [`dfu-util`](https://dfu-util.sourceforge.net/) to update the
|
||||
firmware:
|
||||
|
||||
```bash
|
||||
dfu-util --alt 0 -D firmware.dfu
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
include("$(PORT_DIR)/boards/manifest.py")
|
||||
|
||||
# Currently this file is a placeholder.
|
||||
# It would be good to extend to add an LCD driver.
|
||||
171
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/mpconfigboard.h
Normal file
171
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/mpconfigboard.h
Normal file
@@ -0,0 +1,171 @@
|
||||
#define MICROPY_HW_BOARD_NAME "WEACTSTUDIO_MINI_STM32H743"
|
||||
#define MICROPY_HW_MCU_NAME "STM32H743VIT6"
|
||||
|
||||
#define MICROPY_FATFS_EXFAT (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_ADC (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_ENABLE_SERVO (1)
|
||||
#define MICROPY_HW_ENABLE_TIMER (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
#define MICROPY_HW_ENABLE_MMCARD (0)
|
||||
|
||||
// ROMFS config
|
||||
#define MICROPY_HW_ROMFS_ENABLE_EXTERNAL_QSPI (1)
|
||||
#define MICROPY_HW_ROMFS_QSPI_SPIFLASH_OBJ (&spi_bdev2.spiflash)
|
||||
#define MICROPY_HW_ROMFS_ENABLE_PART0 (1)
|
||||
|
||||
// Flash storage config
|
||||
#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
|
||||
// Disable internal filesystem to use spiflash.
|
||||
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
|
||||
|
||||
// W25Q64 for storage
|
||||
#define MICROPY_HW_SPIFLASH_SIZE_BYTES (8 * 1024 * 1024)
|
||||
|
||||
// SPI flash #1, for R/W storage
|
||||
#define MICROPY_HW_SPIFLASH_CS (pin_D6)
|
||||
#define MICROPY_HW_SPIFLASH_SCK (pin_B3)
|
||||
#define MICROPY_HW_SPIFLASH_MOSI (pin_D7)
|
||||
#define MICROPY_HW_SPIFLASH_MISO (pin_B4)
|
||||
|
||||
// External SPI Flash configuration
|
||||
#define MICROPY_HW_SPI_IS_RESERVED(id) (id == 1)
|
||||
|
||||
// SPI flash #1, block device config
|
||||
extern const struct _mp_spiflash_config_t spiflash_config;
|
||||
extern struct _spi_bdev_t spi_bdev;
|
||||
|
||||
#define MICROPY_HW_BDEV_SPIFLASH (&spi_bdev)
|
||||
#define MICROPY_HW_BDEV_SPIFLASH_CONFIG (&spiflash_config)
|
||||
#define MICROPY_HW_BDEV_SPIFLASH_SIZE_BYTES (MICROPY_HW_SPIFLASH_SIZE_BITS / 8)
|
||||
#define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol
|
||||
#define MICROPY_HW_SPIFLASH_SIZE_BITS (MICROPY_HW_SPIFLASH_SIZE_BYTES * 8)
|
||||
|
||||
// SPI flash #2, to be memory mapped
|
||||
#define MICROPY_HW_QSPI_PRESCALER (2) // 120 MHz
|
||||
#define MICROPY_HW_QSPIFLASH_SIZE_BITS_LOG2 (26)
|
||||
#define MICROPY_HW_QSPIFLASH_CS (pin_B6)
|
||||
#define MICROPY_HW_QSPIFLASH_SCK (pin_B2)
|
||||
#define MICROPY_HW_QSPIFLASH_IO0 (pin_D11)
|
||||
#define MICROPY_HW_QSPIFLASH_IO1 (pin_D12)
|
||||
#define MICROPY_HW_QSPIFLASH_IO2 (pin_E2)
|
||||
#define MICROPY_HW_QSPIFLASH_IO3 (pin_D13)
|
||||
|
||||
// SPI flash #2, block device config
|
||||
extern const struct _mp_spiflash_config_t spiflash2_config;
|
||||
extern struct _spi_bdev_t spi_bdev2;
|
||||
|
||||
#define MICROPY_BOARD_EARLY_INIT WeAct_Core_early_init
|
||||
|
||||
// This board has 25MHz HSE.
|
||||
// The following gives a 480MHz CPU speed.
|
||||
#define MICROPY_HW_CLK_USE_HSE (1)
|
||||
#define MICROPY_HW_CLK_PLLM (5)
|
||||
#define MICROPY_HW_CLK_PLLN (192)
|
||||
#define MICROPY_HW_CLK_PLLP (2)
|
||||
#define MICROPY_HW_CLK_PLLQ (20)
|
||||
#define MICROPY_HW_CLK_PLLR (2)
|
||||
#define MICROPY_HW_CLK_PLLVCI (RCC_PLL1VCIRANGE_2)
|
||||
#define MICROPY_HW_CLK_PLLVCO (RCC_PLL1VCOWIDE)
|
||||
#define MICROPY_HW_CLK_PLLFRAC (0)
|
||||
|
||||
// The USB clock is set using PLL3
|
||||
#define MICROPY_HW_CLK_PLL3M (5)
|
||||
#define MICROPY_HW_CLK_PLL3N (192)
|
||||
#define MICROPY_HW_CLK_PLL3P (2)
|
||||
#define MICROPY_HW_CLK_PLL3Q (20)
|
||||
#define MICROPY_HW_CLK_PLL3R (2)
|
||||
#define MICROPY_HW_CLK_PLL3VCI (RCC_PLL3VCIRANGE_2)
|
||||
#define MICROPY_HW_CLK_PLL3VCO (RCC_PLL3VCOWIDE)
|
||||
#define MICROPY_HW_CLK_PLL3FRAC (0)
|
||||
|
||||
// 32kHz crystal for RTC
|
||||
#define MICROPY_HW_RTC_USE_LSE (1)
|
||||
#define MICROPY_HW_RTC_USE_US (0)
|
||||
|
||||
// 6 wait states
|
||||
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_6
|
||||
|
||||
// UART
|
||||
#define MICROPY_HW_UART1_TX (pin_A9)
|
||||
#define MICROPY_HW_UART1_RX (pin_A10)
|
||||
#define MICROPY_HW_UART2_TX (pin_A2)
|
||||
#define MICROPY_HW_UART2_RX (pin_A3)
|
||||
#define MICROPY_HW_UART3_TX (pin_B10)
|
||||
#define MICROPY_HW_UART3_RX (pin_B11)
|
||||
#define MICROPY_HW_UART4_TX (pin_C11)
|
||||
#define MICROPY_HW_UART4_RX (pin_C10)
|
||||
#define MICROPY_HW_UART5_TX (pin_B12) // or SPI2
|
||||
#define MICROPY_HW_UART5_RX (pin_B13) // or SPI2
|
||||
#define MICROPY_HW_UART6_TX (pin_C6)
|
||||
#define MICROPY_HW_UART6_RX (pin_C7)
|
||||
#define MICROPY_HW_UART7_TX (pin_E8)
|
||||
#define MICROPY_HW_UART7_RX (pin_E7)
|
||||
|
||||
// I2C buses
|
||||
#define MICROPY_HW_I2C1_SCL (pin_B8)
|
||||
#define MICROPY_HW_I2C1_SDA (pin_B9)
|
||||
|
||||
#define MICROPY_HW_I2C2_SCL (pin_B10)
|
||||
#define MICROPY_HW_I2C2_SDA (pin_B11)
|
||||
|
||||
// SPI buses
|
||||
// NOTE: SPI1 is used for the SPI flash.
|
||||
#define MICROPY_HW_SPI1_NSS (pin_D6)
|
||||
#define MICROPY_HW_SPI1_SCK (pin_B3)
|
||||
#define MICROPY_HW_SPI1_MISO (pin_B4)
|
||||
#define MICROPY_HW_SPI1_MOSI (pin_D7)
|
||||
|
||||
#define MICROPY_HW_SPI2_NSS (pin_B12)
|
||||
#define MICROPY_HW_SPI2_SCK (pin_B13)
|
||||
#define MICROPY_HW_SPI2_MISO (pin_B14)
|
||||
#define MICROPY_HW_SPI2_MOSI (pin_B15)
|
||||
// NOTE: SPI3 is used for the QSPI flash.
|
||||
#define MICROPY_HW_SPI3_NSS (pin_A4)
|
||||
#define MICROPY_HW_SPI3_SCK (pin_B3)
|
||||
#define MICROPY_HW_SPI3_MISO (pin_B4)
|
||||
#define MICROPY_HW_SPI3_MOSI (pin_B5)
|
||||
// NOTE: SPI4 is used for the ST7735 LCD.
|
||||
#define MICROPY_HW_SPI4_NSS (pin_E11)
|
||||
#define MICROPY_HW_SPI4_SCK (pin_E12)
|
||||
#define MICROPY_HW_SPI4_MISO (pin_E13)
|
||||
#define MICROPY_HW_SPI4_MOSI (pin_E14)
|
||||
|
||||
// CAN buses
|
||||
#define MICROPY_HW_CAN1_TX (pin_B9)
|
||||
#define MICROPY_HW_CAN1_RX (pin_B8)
|
||||
|
||||
// USRSW is pulled low. Pressing the button makes the input go high.
|
||||
#define MICROPY_HW_USRSW_PIN (pin_C13) // K1 on the board.
|
||||
#define MICROPY_HW_USRSW_PULL (GPIO_PULLDOWN)
|
||||
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
|
||||
#define MICROPY_HW_USRSW_PRESSED (1)
|
||||
|
||||
// LEDs
|
||||
#define MICROPY_HW_LED1 (pin_E3) // the only controllable LED on the board.
|
||||
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
|
||||
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
|
||||
|
||||
// SD Card SDMMC
|
||||
#define MICROPY_HW_SDCARD_SDMMC (1)
|
||||
#define MICROPY_HW_SDCARD_CK (pin_C12)
|
||||
#define MICROPY_HW_SDCARD_CMD (pin_D2)
|
||||
#define MICROPY_HW_SDCARD_D0 (pin_C8)
|
||||
#define MICROPY_HW_SDCARD_D1 (pin_C9)
|
||||
#define MICROPY_HW_SDCARD_D2 (pin_C10)
|
||||
#define MICROPY_HW_SDCARD_D3 (pin_C11)
|
||||
|
||||
// SD card detect switch
|
||||
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_D4)
|
||||
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
|
||||
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_SET)
|
||||
|
||||
// USB config
|
||||
#define MICROPY_HW_USB_FS (1)
|
||||
|
||||
void WeAct_Core_early_init(void);
|
||||
@@ -0,0 +1,22 @@
|
||||
USE_MBOOT ?= 0
|
||||
|
||||
# MCU settings
|
||||
MCU_SERIES = h7
|
||||
CMSIS_MCU = STM32H743xx
|
||||
MICROPY_FLOAT_IMPL = double
|
||||
AF_FILE = boards/stm32h743_af.csv
|
||||
|
||||
ifeq ($(USE_MBOOT),1)
|
||||
# When using Mboot everything goes after the bootloader
|
||||
LD_FILES = boards/stm32h723.ld boards/common_bl.ld
|
||||
TEXT0_ADDR = 0x08020000
|
||||
else
|
||||
# When not using Mboot everything goes at the start of flash
|
||||
LD_FILES = boards/WEACTSTUDIO_MINI_STM32H743/weact_stm32h743.ld boards/common_basic.ld
|
||||
TEXT0_ADDR = 0x08000000
|
||||
endif
|
||||
|
||||
# MicroPython settings
|
||||
MICROPY_VFS_LFS2 = 1
|
||||
|
||||
FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py
|
||||
100
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/pins.csv
Normal file
100
ports/stm32/boards/WEACTSTUDIO_MINI_STM32H743/pins.csv
Normal file
@@ -0,0 +1,100 @@
|
||||
A0,PA0
|
||||
A1,PA1
|
||||
A2,PA2
|
||||
A3,PA3
|
||||
A4,PA4
|
||||
A5,PA5
|
||||
A6,PA6
|
||||
A7,PA7
|
||||
A8,PA8
|
||||
A9,PA9
|
||||
A10,PA10
|
||||
A11,PA11
|
||||
A12,PA12
|
||||
A15,PA15
|
||||
B0,PB0
|
||||
B1,PB1
|
||||
B2,PB2
|
||||
B3,PB3
|
||||
B4,PB4
|
||||
B5,PB5
|
||||
B6,PB6
|
||||
B7,PB7
|
||||
B8,PB8
|
||||
B9,PB9
|
||||
B10,PB10
|
||||
B11,PB11
|
||||
B12,PB12
|
||||
B13,PB13
|
||||
B14,PB14
|
||||
B15,PB15
|
||||
C0,PC0
|
||||
C1,PC1
|
||||
C2,PC2
|
||||
C3,PC3
|
||||
C4,PC4
|
||||
C5,PC5
|
||||
C6,PC6
|
||||
C7,PC7
|
||||
C8,PC8
|
||||
C9,PC9
|
||||
C10,PC10
|
||||
C11,PC11
|
||||
C12,PC12
|
||||
C13,PC13
|
||||
D0,PD0
|
||||
D1,PD1
|
||||
D2,PD2
|
||||
D3,PD3
|
||||
D4,PD4
|
||||
D5,PD5
|
||||
D6,PD6
|
||||
D7,PD7
|
||||
D8,PD8
|
||||
D9,PD9
|
||||
D10,PD10
|
||||
D11,PD11
|
||||
D12,PD12
|
||||
D13,PD13
|
||||
D14,PD14
|
||||
D15,PD15
|
||||
E0,PE0
|
||||
E1,PE1
|
||||
E2,PE2
|
||||
E3,PE3
|
||||
E4,PE4
|
||||
E5,PE5
|
||||
E6,PE6
|
||||
E7,PE7
|
||||
E8,PE8
|
||||
E9,PE9
|
||||
E10,PE10
|
||||
E11,PE11
|
||||
E11,PE11
|
||||
E12,PE12
|
||||
E13,PE13
|
||||
E14,PE14
|
||||
E15,PE15
|
||||
LED_BLUE,PE3
|
||||
KEY_1,PC13
|
||||
QSPI_CS,PB6
|
||||
QSPI_CLK,PB2
|
||||
QSPI_D0,PD11
|
||||
QSPI_D1,PD12
|
||||
QSPI_D2,PE2
|
||||
QSPI_D3,PD13
|
||||
USB_DM,PA11
|
||||
USB_DP,PA12
|
||||
OSC32_IN,PC14
|
||||
OSC32_OUT,PC15
|
||||
SDIO_D0,PC8
|
||||
SDIO_D1,PC9
|
||||
SDIO_D2,PC10
|
||||
SDIO_D3,PC11
|
||||
SDIO_CMD,PD2
|
||||
SDIO_CK,PC12
|
||||
SD_SW,PD4
|
||||
OTG_FS_POWER,PD10
|
||||
OTG_FS_OVER_CURRENT,PG7
|
||||
USB_VBUS,PA9
|
||||
USB_ID,PA10
|
||||
|
@@ -0,0 +1,19 @@
|
||||
/* This file is part of the MicroPython project, http://micropython.org/
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2019 Damien P. George
|
||||
*/
|
||||
#ifndef MICROPY_INCLUDED_STM32H7XX_HAL_CONF_H
|
||||
#define MICROPY_INCLUDED_STM32H7XX_HAL_CONF_H
|
||||
|
||||
// Oscillator values in Hz
|
||||
#define HSE_VALUE (25000000)
|
||||
#define LSE_VALUE (32768)
|
||||
#define EXTERNAL_CLOCK_VALUE (12288000)
|
||||
|
||||
// Oscillator timeouts in ms
|
||||
#define HSE_STARTUP_TIMEOUT (5000)
|
||||
#define LSE_STARTUP_TIMEOUT (5000)
|
||||
|
||||
#include "boards/stm32h7xx_hal_conf_base.h"
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32H7XX_HAL_CONF_H
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
GNU linker script for WeAct Studio STM32H743
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* sectors (0-15) */
|
||||
FLASH_APP (rx) : ORIGIN = 0x08020000, LENGTH = 1920K /* sectors (1-15) */
|
||||
FLASH_ROMFS (rx): ORIGIN = 0x90000000, LENGTH = 8192K /* external QSPI */
|
||||
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K /* Used for storage cache */
|
||||
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 512K /* AXI SRAM */
|
||||
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
|
||||
}
|
||||
|
||||
/* produce a link error if there is not this amount of RAM for these sections */
|
||||
_minimum_stack_size = 2K;
|
||||
_minimum_heap_size = 16K;
|
||||
|
||||
/* Define the stack. The stack is full descending so begins just above last byte
|
||||
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
|
||||
_estack = ORIGIN(RAM) + LENGTH(RAM) - _estack_reserve;
|
||||
_sstack = _estack - 16K; /* tunable */
|
||||
|
||||
/* RAM extents for the garbage collector */
|
||||
_ram_start = ORIGIN(RAM);
|
||||
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||
_heap_start = _ebss; /* heap starts just after statically allocated memory */
|
||||
_heap_end = _sstack;
|
||||
|
||||
/* ROMFS location */
|
||||
_micropy_hw_romfs_part0_start = ORIGIN(FLASH_ROMFS);
|
||||
_micropy_hw_romfs_part0_size = LENGTH(FLASH_ROMFS);
|
||||
@@ -611,14 +611,9 @@ soft_reset:
|
||||
pyb_can_init0();
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_USB
|
||||
#if MICROPY_HW_TINYUSB_STACK
|
||||
pyb_usbd_init();
|
||||
mp_usbd_init();
|
||||
#else
|
||||
#if MICROPY_HW_STM_USB_STACK && MICROPY_HW_ENABLE_USB
|
||||
pyb_usb_init0();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_MACHINE_I2S
|
||||
machine_i2s_init0();
|
||||
@@ -690,6 +685,10 @@ soft_reset:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_TINYUSB_STACK && MICROPY_HW_ENABLE_USBDEV
|
||||
mp_usbd_init();
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_HAS_MMA7660
|
||||
// MMA accel: init and reset
|
||||
accel_init();
|
||||
|
||||
@@ -261,6 +261,7 @@
|
||||
#if MICROPY_HW_TINYUSB_STACK
|
||||
#ifndef MICROPY_HW_ENABLE_USBDEV
|
||||
#define MICROPY_HW_ENABLE_USBDEV (1)
|
||||
#define MICROPY_HW_TINYUSB_LL_INIT mp_usbd_ll_init
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_HW_USB_CDC
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// We use the ST Cube HAL library for most hardware peripherals
|
||||
#include STM32_HAL_H
|
||||
#include "pin.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "py/ringbuf.h"
|
||||
#include "shared/runtime/interrupt_char.h"
|
||||
|
||||
|
||||
@@ -134,19 +134,27 @@ void rtc_init_start(bool force_init) {
|
||||
if (!force_init) {
|
||||
bool rtc_running = false;
|
||||
#if defined(STM32N6)
|
||||
// Note: the low-level boot on the N6 seems to always enable the RTC and the LSI, and
|
||||
// switch the RTC to LSI mode. So the logic below needs to account for that:
|
||||
// - if LSE is ready then switch back to the LSE
|
||||
// - even if LSI is ready, don't use it if the board is configured to use LSE
|
||||
uint32_t rtc_clock_source = LL_RCC_GetRTCClockSource();
|
||||
if (LL_RCC_IsEnabledRTC()
|
||||
&& LL_RCC_GetRTCClockSource() == LL_RCC_RTC_CLKSOURCE_LSE
|
||||
&& LL_RCC_LSE_IsReady()) {
|
||||
// LSE is enabled & ready --> no need to (re-)init RTC
|
||||
rtc_running = true;
|
||||
if (rtc_clock_source != LL_RCC_RTC_CLKSOURCE_LSE) {
|
||||
LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE);
|
||||
}
|
||||
// remove Backup Domain write protection
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
// Clear source Reset Flag
|
||||
__HAL_RCC_CLEAR_RESET_FLAGS();
|
||||
// provide some status information
|
||||
rtc_info |= 0x40000;
|
||||
} else if (LL_RCC_IsEnabledRTC()
|
||||
&& LL_RCC_GetRTCClockSource() == LL_RCC_RTC_CLKSOURCE_LSI) {
|
||||
} else if (!rtc_use_lse
|
||||
&& LL_RCC_IsEnabledRTC()
|
||||
&& rtc_clock_source == LL_RCC_RTC_CLKSOURCE_LSI) {
|
||||
// LSI configured as the RTC clock source --> no need to (re-)init RTC
|
||||
rtc_running = true;
|
||||
// remove Backup Domain write protection
|
||||
|
||||
@@ -301,6 +301,8 @@ void DebugMon_Handler(void) {
|
||||
/* file (startup_stm32f4xx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
#if MICROPY_HW_STM_USB_STACK || MICROPY_HW_TINYUSB_STACK
|
||||
|
||||
#if defined(STM32G0)
|
||||
|
||||
#if MICROPY_HW_USB_FS
|
||||
@@ -499,6 +501,8 @@ void OTG_HS_WKUP_IRQHandler(void) {
|
||||
|
||||
#endif // !defined(STM32L0)
|
||||
|
||||
#endif // MICROPY_HW_STM_USB_STACK || MICROPY_HW_TINYUSB_STACK
|
||||
|
||||
/**
|
||||
* @brief This function handles PPP interrupt request.
|
||||
* @param None
|
||||
|
||||
@@ -535,13 +535,14 @@ MP_WEAK void SystemClock_Config(void) {
|
||||
MICROPY_BOARD_FATAL_ERROR("HAL_RCC_ClockConfig");
|
||||
}
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_LPUART1
|
||||
| RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_ADC12
|
||||
| RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_ADC12 | RCC_PERIPHCLK_ADC345
|
||||
| RCC_PERIPHCLK_FDCAN | RCC_PERIPHCLK_USB;
|
||||
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
|
||||
PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK1;
|
||||
PeriphClkInitStruct.FdcanClockSelection = RCC_FDCANCLKSOURCE_HSE;
|
||||
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_HSI48;
|
||||
PeriphClkInitStruct.Adc12ClockSelection = RCC_ADC12CLKSOURCE_SYSCLK;
|
||||
PeriphClkInitStruct.Adc345ClockSelection = RCC_ADC345CLKSOURCE_SYSCLK;
|
||||
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
||||
MICROPY_BOARD_FATAL_ERROR("HAL_RCCEx_PeriphCLKConfig");
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
#include "usbd_core.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/mphal.h"
|
||||
#include "shared/tinyusb/mp_usbd.h"
|
||||
#include "irq.h"
|
||||
#include "usb.h"
|
||||
|
||||
#if MICROPY_HW_USB_FS || MICROPY_HW_USB_HS
|
||||
#if MICROPY_HW_STM_USB_STACK || MICROPY_HW_TINYUSB_STACK
|
||||
|
||||
#if BUILDING_MBOOT
|
||||
// TinyUSB not used in mboot
|
||||
@@ -62,16 +63,8 @@ PCD_HandleTypeDef pcd_hs_handle;
|
||||
#define OTG_HS_IRQn USB1_OTG_HS_IRQn
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_TINYUSB_STACK
|
||||
void pyb_usbd_init(void)
|
||||
#else
|
||||
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
|
||||
#endif
|
||||
{
|
||||
#if MICROPY_HW_USB_FS
|
||||
#if MICROPY_HW_STM_USB_STACK
|
||||
if (hpcd->Instance == USB_OTG_FS)
|
||||
#endif
|
||||
#if MICROPY_HW_USB_FS
|
||||
static void mp_usbd_ll_init_fs(void) {
|
||||
{
|
||||
// Configure USB GPIO's.
|
||||
|
||||
@@ -192,17 +185,12 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_STM_USB_STACK
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // MICROPY_HW_USB_FS
|
||||
|
||||
#if MICROPY_HW_USB_HS
|
||||
#if MICROPY_HW_STM_USB_STACK
|
||||
if (hpcd->Instance == USB_OTG_HS)
|
||||
#endif
|
||||
#if MICROPY_HW_USB_HS
|
||||
static void mp_usbd_ll_init_hs(void) {
|
||||
{
|
||||
#if MICROPY_HW_USB_HS_IN_FS
|
||||
|
||||
@@ -342,10 +330,41 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
|
||||
NVIC_SetPriority(OTG_HS_IRQn, IRQ_PRI_OTG_HS);
|
||||
HAL_NVIC_EnableIRQ(OTG_HS_IRQn);
|
||||
}
|
||||
#endif // MICROPY_HW_USB_HS
|
||||
}
|
||||
#endif // MICROPY_HW_USB_HS
|
||||
|
||||
#if MICROPY_HW_TINYUSB_STACK
|
||||
|
||||
void mp_usbd_ll_init(void) {
|
||||
// Only initialize the USB hardware once.
|
||||
if (tusb_inited()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if MICROPY_HW_USB_FS
|
||||
mp_usbd_ll_init_fs();
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_USB_HS
|
||||
mp_usbd_ll_init_hs();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MICROPY_HW_STM_USB_STACK
|
||||
#elif MICROPY_HW_STM_USB_STACK
|
||||
|
||||
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) {
|
||||
#if MICROPY_HW_USB_FS
|
||||
if (hpcd->Instance == USB_OTG_FS) {
|
||||
mp_usbd_ll_init_fs();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_USB_HS
|
||||
if (hpcd->Instance == USB_OTG_HS) {
|
||||
mp_usbd_ll_init_hs();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitializes the PCD MSP.
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
#define USBD_HS_NUM_FIFO (1 + USBD_HS_NUM_TX_FIFO)
|
||||
|
||||
#if MICROPY_HW_TINYUSB_STACK
|
||||
void pyb_usbd_init(void);
|
||||
void mp_usbd_ll_init(void);
|
||||
#endif
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32_USBD_CONF_H
|
||||
|
||||
@@ -102,7 +102,7 @@ void mp_asm_base_label_assign(mp_asm_base_t *as, size_t label) {
|
||||
|
||||
// align must be a multiple of 2
|
||||
void mp_asm_base_align(mp_asm_base_t *as, unsigned int align) {
|
||||
as->code_offset = (as->code_offset + align - 1) & (~(align - 1));
|
||||
as->code_offset = (as->code_offset + align - 1) & (~(size_t)(align - 1));
|
||||
}
|
||||
|
||||
// this function assumes a little endian machine
|
||||
|
||||
@@ -152,9 +152,8 @@ static void mp_help_print_obj(const mp_obj_t obj) {
|
||||
}
|
||||
if (map != NULL) {
|
||||
for (uint i = 0; i < map->alloc; i++) {
|
||||
mp_obj_t key = map->table[i].key;
|
||||
if (key != MP_OBJ_NULL) {
|
||||
mp_help_print_info_about_object(key, map->table[i].value);
|
||||
if (mp_map_slot_is_filled(map, i)) {
|
||||
mp_help_print_info_about_object(map->table[i].key, map->table[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "py/emitglue.h"
|
||||
#include "py/mphal.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/bc.h"
|
||||
#include "py/objfun.h"
|
||||
@@ -126,6 +127,9 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, cons
|
||||
"mcr p15, 0, r0, c7, c7, 0\n" // invalidate I-cache and D-cache
|
||||
: : : "r0", "cc");
|
||||
#endif
|
||||
#elif (MICROPY_EMIT_RV32 || MICROPY_EMIT_INLINE_RV32) && defined(MP_HAL_CLEAN_DCACHE)
|
||||
// Flush the D-cache.
|
||||
MP_HAL_CLEAN_DCACHE(fun_data, fun_len);
|
||||
#endif
|
||||
|
||||
rc->kind = kind;
|
||||
|
||||
@@ -390,9 +390,9 @@ static const opcode_t OPCODES[] = {
|
||||
|
||||
// These two checks assume the bitmasks are contiguous.
|
||||
|
||||
static bool is_in_signed_mask(mp_uint_t mask, mp_uint_t value) {
|
||||
mp_uint_t leading_zeroes = mp_clz(mask);
|
||||
if (leading_zeroes == 0 || leading_zeroes > 32) {
|
||||
static bool is_in_signed_mask(uint32_t mask, mp_uint_t value) {
|
||||
uint32_t leading_zeroes = mp_clz(mask);
|
||||
if (leading_zeroes == 0) {
|
||||
return true;
|
||||
}
|
||||
mp_uint_t positive_mask = ~(mask & ~(1U << (31 - leading_zeroes)));
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// as well as a fallback to generate MICROPY_GIT_TAG if the git repo or tags
|
||||
// are unavailable.
|
||||
#define MICROPY_VERSION_MAJOR 1
|
||||
#define MICROPY_VERSION_MINOR 27
|
||||
#define MICROPY_VERSION_MINOR 28
|
||||
#define MICROPY_VERSION_MICRO 0
|
||||
#define MICROPY_VERSION_PRERELEASE 1
|
||||
|
||||
|
||||
@@ -22,11 +22,17 @@ ACKNOWLEDGEMENTS,\
|
||||
|
||||
[tool.ruff]
|
||||
# Exclude third-party code from linting and formatting
|
||||
extend-exclude = ["lib"]
|
||||
extend-exclude = [
|
||||
"lib",
|
||||
"esp-idf",
|
||||
"pico-sdk",
|
||||
"emsdk",
|
||||
"tests/cpydiff/syntax_assign_expr.py" # intentionally incorrect CPython code
|
||||
]
|
||||
# Include Python source files that don't end with .py
|
||||
extend-include = ["tools/cc1"]
|
||||
line-length = 99
|
||||
target-version = "py37"
|
||||
target-version = "py38"
|
||||
|
||||
[tool.ruff.lint]
|
||||
exclude = [ # Ruff finds Python SyntaxError in these files
|
||||
@@ -44,7 +50,7 @@ exclude = [ # Ruff finds Python SyntaxError in these files
|
||||
"tests/micropython/viper_args.py",
|
||||
]
|
||||
extend-select = ["C9", "PLC"]
|
||||
ignore = [
|
||||
extend-ignore = [
|
||||
"E401",
|
||||
"E402",
|
||||
"E722",
|
||||
@@ -54,6 +60,7 @@ ignore = [
|
||||
"F403",
|
||||
"F405",
|
||||
"PLC0206",
|
||||
"PLC0415", # conditional imports are common in MicroPython
|
||||
]
|
||||
mccabe.max-complexity = 40
|
||||
|
||||
@@ -64,6 +71,8 @@ mccabe.max-complexity = 40
|
||||
# manifest.py files are evaluated with some global names pre-defined
|
||||
"**/manifest.py" = ["F821"]
|
||||
"ports/**/boards/**/manifest_*.py" = ["F821"]
|
||||
# Uses assignment expressions.
|
||||
"tests/cpydiff/syntax_assign_expr.py" = ["F821"]
|
||||
|
||||
[tool.ruff.format]
|
||||
# Exclude third-party code, and exclude the following tests:
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
#define MICROPY_WRAP_TUD_EVENT_HOOK_CB(name) name
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_HW_TINYUSB_LL_INIT
|
||||
#define MICROPY_HW_TINYUSB_LL_INIT()
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_USBDEV
|
||||
|
||||
#include "py/obj.h"
|
||||
@@ -102,6 +106,7 @@ void mp_usbd_task_callback(mp_sched_node_t *node);
|
||||
static inline void mp_usbd_init(void) {
|
||||
// Without runtime USB support, this can be a thin wrapper wrapper around tusb_init()
|
||||
// which is called in the below helper function.
|
||||
MICROPY_HW_TINYUSB_LL_INIT();
|
||||
mp_usbd_init_tud();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "device/usbd_pvt.h"
|
||||
#endif
|
||||
|
||||
#define RHPORT TUD_OPT_RHPORT
|
||||
|
||||
static bool in_usbd_task; // Flags if mp_usbd_task() is currently running
|
||||
|
||||
// Some top-level functions that manage global TinyUSB USBD state, not the
|
||||
@@ -233,7 +235,7 @@ static uint16_t _runtime_dev_claim_itfs(tusb_desc_interface_t const *itf_desc, u
|
||||
} else if (tu_desc_type(p_desc) == TUSB_DESC_ENDPOINT) {
|
||||
// Open any endpoints that we come across
|
||||
if (tu_desc_type(p_desc) == TUSB_DESC_ENDPOINT) {
|
||||
bool r = usbd_edpt_open(USBD_RHPORT, (const void *)p_desc);
|
||||
bool r = usbd_edpt_open(RHPORT, (const void *)p_desc);
|
||||
if (!r) {
|
||||
mp_obj_t exc = mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(MP_ENODEV));
|
||||
usbd_pend_exception(exc);
|
||||
@@ -322,7 +324,7 @@ static bool runtime_dev_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_cont
|
||||
|
||||
// Check if callback returned any data to submit
|
||||
if (mp_get_buffer(cb_res, &buf_info, dir == TUSB_DIR_IN ? MP_BUFFER_READ : MP_BUFFER_RW)) {
|
||||
result = tud_control_xfer(USBD_RHPORT,
|
||||
result = tud_control_xfer(RHPORT,
|
||||
request,
|
||||
buf_info.buf,
|
||||
buf_info.len);
|
||||
@@ -430,6 +432,8 @@ void mp_usbd_init(void) {
|
||||
}
|
||||
|
||||
if (need_usb) {
|
||||
// Call any port-specific initialization code.
|
||||
MICROPY_HW_TINYUSB_LL_INIT();
|
||||
// The following will call tusb_init(), which is safe to call redundantly.
|
||||
mp_usbd_init_tud();
|
||||
// Reconnect if mp_usbd_deinit() has disconnected.
|
||||
@@ -466,7 +470,7 @@ static void mp_usbd_disconnect(mp_obj_usb_device_t *usbd) {
|
||||
for (int epnum = 0; epnum < CFG_TUD_ENDPPOINT_MAX; epnum++) {
|
||||
for (int dir = 0; dir < 2; dir++) {
|
||||
if (usbd->xfer_data[epnum][dir] != mp_const_none) {
|
||||
usbd_edpt_stall(USBD_RHPORT, tu_edpt_addr(epnum, dir));
|
||||
usbd_edpt_stall(RHPORT, tu_edpt_addr(epnum, dir));
|
||||
usbd->xfer_data[epnum][dir] = mp_const_none;
|
||||
}
|
||||
}
|
||||
@@ -477,7 +481,7 @@ static void mp_usbd_disconnect(mp_obj_usb_device_t *usbd) {
|
||||
// Ensure no pending static CDC writes, as these can cause TinyUSB to crash
|
||||
tud_cdc_write_clear();
|
||||
// Prevent cdc write flush from initiating any new transfers while disconnecting
|
||||
usbd_edpt_stall(USBD_RHPORT, USBD_CDC_EP_IN);
|
||||
usbd_edpt_stall(RHPORT, USBD_CDC_EP_IN);
|
||||
#endif
|
||||
|
||||
bool was_connected = tud_connected();
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#define MICROPY_HW_USB_MSC_INQUIRY_REVISION_STRING "1.00"
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_RHPORT0_MODE
|
||||
#if !defined(CFG_TUSB_RHPORT0_MODE) && !defined(CFG_TUSB_RHPORT1_MODE)
|
||||
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE)
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
#ifndef CFG_TUD_CDC_TX_BUFSIZE
|
||||
#define CFG_TUD_CDC_TX_BUFSIZE ((CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED) ? 512 : 256)
|
||||
#endif
|
||||
#endif
|
||||
#endif // CFG_TUD_CDC
|
||||
|
||||
// MSC Configuration
|
||||
#if CFG_TUD_MSC
|
||||
@@ -92,9 +92,7 @@
|
||||
#endif
|
||||
// Set MSC EP buffer size to FatFS block size to avoid partial read/writes (offset arg).
|
||||
#define CFG_TUD_MSC_BUFSIZE (MICROPY_FATFS_MAX_SS)
|
||||
#endif
|
||||
|
||||
#define USBD_RHPORT (0) // Currently only one port is supported
|
||||
#endif // CFG_TUD_MSC
|
||||
|
||||
// Define built-in interface, string and endpoint numbering based on the above config
|
||||
|
||||
|
||||
@@ -14,4 +14,10 @@ import micropython
|
||||
help(micropython) # help for a module
|
||||
help('modules') # list available modules
|
||||
|
||||
class A:
|
||||
x = 1
|
||||
y = 2
|
||||
del x
|
||||
help(A)
|
||||
|
||||
print('done') # so last bit of output is predictable
|
||||
|
||||
Binary file not shown.
@@ -8,7 +8,7 @@ if not hasattr(ssl, "CERT_REQUIRED"):
|
||||
# This certificate was obtained from micropython.org using openssl:
|
||||
# $ openssl s_client -showcerts -connect micropython.org:443 </dev/null 2>/dev/null
|
||||
# The certificate is from Let's Encrypt:
|
||||
# 1 s:C=US, O=Let's Encrypt, CN=R11
|
||||
# 1 s:C=US, O=Let's Encrypt, CN=R12
|
||||
# i:C=US, O=Internet Security Research Group, CN=ISRG Root X1
|
||||
# a:PKEY: RSA, 2048 (bit); sigalg: sha256WithRSAEncryption
|
||||
# v:NotBefore: Mar 13 00:00:00 2024 GMT; NotAfter: Mar 12 23:59:59 2027 GMT
|
||||
@@ -17,39 +17,39 @@ if not hasattr(ssl, "CERT_REQUIRED"):
|
||||
# Then convert to hex format using: for i in range(0,len(data),40):print(data[i:i+40].hex())
|
||||
|
||||
ca_cert_chain = bytes.fromhex(
|
||||
"30820506308202eea0030201020211008a7d3e13d62f30ef2386bd29076b34f8300d06092a864886"
|
||||
"30820506308202eea003020102021100c212324b70a9b49171dc40f7e285263c300d06092a864886"
|
||||
"f70d01010b0500304f310b300906035504061302555331293027060355040a1320496e7465726e65"
|
||||
"742053656375726974792052657365617263682047726f7570311530130603550403130c49535247"
|
||||
"20526f6f74205831301e170d3234303331333030303030305a170d3237303331323233353935395a"
|
||||
"3033310b300906035504061302555331163014060355040a130d4c6574277320456e637279707431"
|
||||
"0c300a0603550403130352313130820122300d06092a864886f70d01010105000382010f00308201"
|
||||
"0a0282010100ba87bc5c1b0039cbca0acdd46710f9013ca54ea561cb26ca52fb1501b7b928f5281e"
|
||||
"ed27b324183967090c08ece03ab03b770ebdf3e53954410c4eae41d69974de51dbef7bff58bda8b7"
|
||||
"13f6de31d5f272c9726a0b8374959c4600641499f3b1d922d9cda892aa1c267a3ffeef58057b0895"
|
||||
"81db710f8efbe33109bb09be504d5f8f91763d5a9d9e83f2e9c466b3e106664348188065a037189a"
|
||||
"9b843297b1b2bdc4f815009d2788fbe26317966c9b27674bc4db285e69c279f0495ce02450e1c4bc"
|
||||
"a105ac7b406d00b4c2413fa758b82fc55c9ba5bb099ef1feebb08539fda80aef45c478eb652ac2cf"
|
||||
"5f3cdee35c4d1bf70b272baa0b4277534f796a1d87d90203010001a381f83081f5300e0603551d0f"
|
||||
"0c300a0603550403130352313230820122300d06092a864886f70d01010105000382010f00308201"
|
||||
"0a0282010100da982874adbe94fe3be01ee2e54b75ab2c127feda703327e3697ece8318fa5138d0b"
|
||||
"992e1ecd01513d4ce5286e095531aaa5225d72f42d07c24d403cdf0123b97837f51a653234e68671"
|
||||
"9d04ef84085bbd021a99eba601009a73906d8fa207a0d097d3da456181353d14f9c4c05f6adc0b96"
|
||||
"1ab09fe32aeabd2ad698c79b71ab3b740f3cdbb260be5a4b4e18e9db2a735c8961659efeed3ca6cb"
|
||||
"4e6fe49ef90046b3ff194d2a63b38e66c6188570c750656f3b74e548830f08585d2d239d5ea3fee8"
|
||||
"db00a1d2f4e3194df2ee7af6279ee5cd9c2da2f27f9c17adef133739d1b4c82c41d686c0e9ec21f8"
|
||||
"591b7fb93a7c9f5c019d6204c228bd0aad3cca10ec1b0203010001a381f83081f5300e0603551d0f"
|
||||
"0101ff040403020186301d0603551d250416301406082b0601050507030206082b06010505070301"
|
||||
"30120603551d130101ff040830060101ff020100301d0603551d0e04160414c5cf46a4eaf4c3c07a"
|
||||
"6c95c42db05e922f26e3b9301f0603551d2304183016801479b459e67bb6e5e40173800888c81a58"
|
||||
"30120603551d130101ff040830060101ff020100301d0603551d0e0416041400b529f22d8e6f31e8"
|
||||
"9b4cad783efadce90cd1d2301f0603551d2304183016801479b459e67bb6e5e40173800888c81a58"
|
||||
"f6e99b6e303206082b0601050507010104263024302206082b060105050730028616687474703a2f"
|
||||
"2f78312e692e6c656e63722e6f72672f30130603551d20040c300a3008060667810c010201302706"
|
||||
"03551d1f0420301e301ca01aa0188616687474703a2f2f78312e632e6c656e63722e6f72672f300d"
|
||||
"06092a864886f70d01010b050003820201004ee2895d0a031c9038d0f51ff9715cf8c38fb237887a"
|
||||
"6fb0251fedbeb7d886068ee90984cd72bf81f3fccacf5348edbdf66942d4a5113e35c813b2921d05"
|
||||
"5fea2ed4d8f849c3adf599969cef26d8e1b4240b48204dfcd354b4a9c621c8e1361bff77642917b9"
|
||||
"f04bef5deacd79d0bf90bfbe23b290da4aa9483174a9440be1e2f62d8371a4757bd294c10519461c"
|
||||
"b98ff3c47448252a0de5f5db43e2db939bb919b41f2fdf6a0e8f31d3630fbb29dcdd662c3fb01b67"
|
||||
"51f8413ce44db9acb8a49c6663f5ab85231dcc53b6ab71aedcc50171da36ee0a182a32fd09317c8f"
|
||||
"f673e79c9cb54a156a77825acfda8d45fe1f2a6405303e73c2c60cb9d63b634aab4603fe99c04640"
|
||||
"276063df503a0747d8154a9fea471f995a08620cb66c33084dd738ed482d2e0568ae805def4cdcd8"
|
||||
"20415f68f1bb5acde30eb00c31879b43de4943e1c8043fd13c1b87453069a8a9720e79121c31d83e"
|
||||
"2357dda74fa0f01c81d1771f6fd6d2b9a8b3031681394b9f55aed26ae4b3bfeaa5d59f4ba3c9d63b"
|
||||
"72f34af654ab0cfc38f76080df6e35ca75a154e42fbc6e17c91aa537b5a29abaecf4c075464f77a8"
|
||||
"e8595691662d6ede2981d6a697055e6445be2cceea644244b0c34fadf0b4dc03ca999b098295820d"
|
||||
"638a66f91972f8d5b98910e289980935f9a21cbe92732374e99d1fd73b4a9a845810c2f3a7e235ec"
|
||||
"7e3b45ce3046526bc0c0"
|
||||
"06092a864886f70d01010b050003820201008f75d009cf6a7648653292deb544c88576f415848c02"
|
||||
"bf76ebb3f1e2f96e84a85691e1924bf7e1ea0078488f7592e3e4467b1b602b20afa0ce14e5450d6a"
|
||||
"e05286a4f3da1414a9a95ff16d46f952501740e9e41e7de61558fea98bfceff59e63e066e2c3773b"
|
||||
"1f01872694ed4010dcb799ecdd57d35c7141ee30200004dc954b5028879992feaa8094b6060814f8"
|
||||
"1c837e7440c5085a0c4f5cd1849dc4fddb59deee796e234d95f292d498296a5ceb02c142f0f8f54e"
|
||||
"64207ba8e331c4c06809478bd8b978a0ca4e4abe69242a4b377b51036b3a3f528bb3d4d2ad584e93"
|
||||
"eecb5f6f0d314948bac43f9f12c9203d11840785b4f8f23823ac710040e77f8d4634826a4ecfe00e"
|
||||
"635fba699a47091022fe4b48b7917554cb931ee416eb53cf7bde364dbff6b1ebe64ae9333c8d69a2"
|
||||
"98bea87fa3ab5fb654e84d96a9acf3b05acb1b7a3693249bce5852809f350a5e2dbf749b6226179c"
|
||||
"9131290bf37fcdc3628b68c777f47f0bfbc659f503664ba6509bd0efa5fc02b4604d034b614fc520"
|
||||
"078b48b031f5b69cd1c9ad7718dcb2c70fbee04608dee04bdeb9b8b6c716be36693f86684b748113"
|
||||
"8950c56a7a02acc548a50e7d5d61e4cdd166a075c7055ee889b5631923bb50b490ecc275373e75a6"
|
||||
"1b83252800214ec0d33acb9ceac08ff75fae51164610af0206eec0b657d40dac8cd8d7a0f3876ec3"
|
||||
"e2cbe94ed4a17cfd763b"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -8,12 +8,25 @@
|
||||
# The `serial-device` will default to /dev/ttyACM0.
|
||||
|
||||
import argparse
|
||||
import random
|
||||
import serial
|
||||
import sys
|
||||
import time
|
||||
|
||||
run_tests_module = __import__("run-tests")
|
||||
|
||||
echo_test_script = """
|
||||
import sys
|
||||
bytes_min=%u
|
||||
bytes_max=%u
|
||||
repeat=%u
|
||||
b=memoryview(bytearray(bytes_max))
|
||||
for n in range(bytes_min,bytes_max+1):
|
||||
for _ in range(repeat):
|
||||
n2 = sys.stdin.readinto(b[:n])
|
||||
sys.stdout.write(b[:n2])
|
||||
"""
|
||||
|
||||
read_test_script = """
|
||||
bin = True
|
||||
try:
|
||||
@@ -86,6 +99,8 @@ def drain_input(ser):
|
||||
|
||||
|
||||
def send_script(ser, script):
|
||||
ser.write(b"\x03\x01\x04") # break, raw-repl, soft-reboot
|
||||
drain_input(ser)
|
||||
chunk_size = 32
|
||||
for i in range(0, len(script), chunk_size):
|
||||
ser.write(script[i : i + chunk_size])
|
||||
@@ -98,6 +113,59 @@ def send_script(ser, script):
|
||||
raise TestError("could not send script", response)
|
||||
|
||||
|
||||
def echo_test(ser_repl, ser_data):
|
||||
global test_passed
|
||||
|
||||
# Make the test data deterministic.
|
||||
random.seed(0)
|
||||
|
||||
# Set parameters for the test.
|
||||
# Go just a bit above the size of a USB high-speed packet.
|
||||
bytes_min = 1
|
||||
bytes_max = 520
|
||||
num_repeat = 1
|
||||
|
||||
# Load and run the write_test_script.
|
||||
script = bytes(echo_test_script % (bytes_min, bytes_max, num_repeat), "ascii")
|
||||
send_script(ser_repl, script)
|
||||
|
||||
# A selection of printable bytes for echo data.
|
||||
printable_bytes = list(range(48, 58)) + list(range(65, 91)) + list(range(97, 123))
|
||||
|
||||
# Write data to the device and record the echo'd data.
|
||||
# Use a different selection of random printable characters for each
|
||||
# echo, to make it easier to debug when the echo doesn't match.
|
||||
num_errors = 0
|
||||
echo_results = []
|
||||
for num_bytes in range(bytes_min, bytes_max + 1):
|
||||
print(f"DATA ECHO: {num_bytes} / {bytes_max}", end="\r")
|
||||
for repeat in range(num_repeat):
|
||||
rand_bytes = list(random.choice(printable_bytes) for _ in range(8))
|
||||
buf = bytes(random.choice(rand_bytes) for _ in range(num_bytes))
|
||||
ser_data.write(buf)
|
||||
buf2 = ser_data.read(len(buf))
|
||||
match = buf == buf2
|
||||
num_errors += not match
|
||||
echo_results.append((match, buf, buf2))
|
||||
if num_errors > 8:
|
||||
# Stop early if there are too many errors.
|
||||
break
|
||||
ser_repl.write(b"\x03")
|
||||
|
||||
# Print results.
|
||||
if all(match for match, _, _ in echo_results):
|
||||
print("DATA ECHO: OK for {}-{} bytes at a time".format(bytes_min, bytes_max))
|
||||
else:
|
||||
test_passed = False
|
||||
print("DATA ECHO: FAIL ")
|
||||
for match, buf, buf2 in echo_results:
|
||||
print(" sent", len(buf), buf)
|
||||
if match:
|
||||
print(" echo match")
|
||||
else:
|
||||
print(" echo", len(buf), buf2)
|
||||
|
||||
|
||||
def read_test(ser_repl, ser_data, bufsize, nbuf):
|
||||
global test_passed
|
||||
|
||||
@@ -109,8 +177,6 @@ def read_test(ser_repl, ser_data, bufsize, nbuf):
|
||||
READ_TIMEOUT_S = 2
|
||||
|
||||
# Load and run the read_test_script.
|
||||
ser_repl.write(b"\x03\x01\x04") # break, raw-repl, soft-reboot
|
||||
drain_input(ser_repl)
|
||||
script = bytes(read_test_script % (bufsize, nbuf), "ascii")
|
||||
send_script(ser_repl, script)
|
||||
|
||||
@@ -166,8 +232,6 @@ def write_test(ser_repl, ser_data, bufsize, nbuf, verified):
|
||||
global test_passed
|
||||
|
||||
# Load and run the write_test_script.
|
||||
ser_repl.write(b"\x03\x01\x04") # break, raw-repl, soft-reboot
|
||||
drain_input(ser_repl)
|
||||
if verified:
|
||||
script = write_test_script_verified
|
||||
else:
|
||||
@@ -214,6 +278,12 @@ def do_test(dev_repl, dev_data=None, time_per_subtest=1):
|
||||
ser_repl = serial.Serial(dev_repl, baudrate=115200, timeout=1)
|
||||
ser_data = serial.Serial(dev_data, baudrate=115200, timeout=1)
|
||||
|
||||
# Do echo test first, and abort if it doesn't pass.
|
||||
echo_test(ser_repl, ser_data)
|
||||
if not test_passed:
|
||||
return
|
||||
|
||||
# Do read and write throughput test.
|
||||
for test_func, test_args, bufsize in (
|
||||
(read_test, (), 256),
|
||||
(write_test, (True,), 128),
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
# - IDF_PATH_V50 must be set
|
||||
# - MICROPY_AUTOBUILD_MICROPYTHON_REPO must be set to location of micropython repository
|
||||
# - MICROPY_AUTOBUILD_MAKE must be set to the make command to use, eg "make -j2"
|
||||
# - MICROPY_AUTOBUILD_DEST must be set to a directory name to place the output firmware
|
||||
# (this directory will be created, and removed at the end if firmware is copied to a
|
||||
# remote machine using MICROPY_AUTOBUILD_REMOTE_MACHINE and MICROPY_AUTOBUILD_REMOTE_DIR)
|
||||
#
|
||||
# Optional settings:
|
||||
# - MICROPY_AUTOBUILD_REMOTE_MACHINE can be set to a remote ssh machine to copy files to
|
||||
@@ -27,6 +30,11 @@ if [ -z "$MICROPY_AUTOBUILD_MAKE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MICROPY_AUTOBUILD_DEST" ]; then
|
||||
echo "must set MICROPY_AUTOBUILD_DEST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
########################################
|
||||
# Initialisation
|
||||
|
||||
@@ -37,7 +45,7 @@ AUTODIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
source ${AUTODIR}/build-boards.sh
|
||||
|
||||
# make local directory to put firmware
|
||||
LOCAL_FIRMWARE=/tmp/autobuild-firmware-$$
|
||||
LOCAL_FIRMWARE=${MICROPY_AUTOBUILD_DEST}
|
||||
mkdir -p ${LOCAL_FIRMWARE}
|
||||
|
||||
# get latest MicroPython
|
||||
|
||||
28
tools/ci.sh
28
tools/ci.sh
@@ -254,6 +254,13 @@ function ci_esp32_build_c2_c5_c6 {
|
||||
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_C6
|
||||
}
|
||||
|
||||
function ci_esp32_build_p4 {
|
||||
ci_esp32_build_common
|
||||
|
||||
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_P4
|
||||
make ${MAKEOPTS} -C ports/esp32 BOARD=ESP32_GENERIC_P4 BOARD_VARIANT=C6_WIFI
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# ports/esp8266
|
||||
|
||||
@@ -494,13 +501,22 @@ function ci_samd_build {
|
||||
# ports/stm32
|
||||
|
||||
function ci_stm32_setup {
|
||||
ci_gcc_arm_setup
|
||||
# Use a recent version of the ARM toolchain, to work with Cortex-M55.
|
||||
wget https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz
|
||||
xzcat arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz | tar x
|
||||
|
||||
pip3 install pyelftools
|
||||
pip3 install ar
|
||||
pip3 install pyhy
|
||||
}
|
||||
|
||||
function ci_stm32_path {
|
||||
echo $(pwd)/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/bin
|
||||
}
|
||||
|
||||
function ci_stm32_pyb_build {
|
||||
# This function builds the following MCU families: F4, F7.
|
||||
|
||||
make ${MAKEOPTS} -C mpy-cross
|
||||
make ${MAKEOPTS} -C ports/stm32 MICROPY_PY_NETWORK_WIZNET5K=5200 submodules
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF2 submodules
|
||||
@@ -515,6 +531,8 @@ function ci_stm32_pyb_build {
|
||||
}
|
||||
|
||||
function ci_stm32_nucleo_build {
|
||||
# This function builds the following MCU families: F0, H5, H7, L0, L4, WB.
|
||||
|
||||
make ${MAKEOPTS} -C mpy-cross
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI submodules
|
||||
git submodule update --init lib/mynewt-nimble
|
||||
@@ -541,9 +559,17 @@ function ci_stm32_nucleo_build {
|
||||
}
|
||||
|
||||
function ci_stm32_misc_build {
|
||||
# This function builds the following MCU families: G0, G4, H7, L1, N6, U5, WL.
|
||||
|
||||
make ${MAKEOPTS} -C mpy-cross
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=ARDUINO_GIGA submodules
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=ARDUINO_GIGA
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_G0B1RE
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_G474RE
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L152RE
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_N657X0
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_U5A5ZJ_Q
|
||||
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_WL55
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
|
||||
43
tools/make_pinout_diagram/README.md
Normal file
43
tools/make_pinout_diagram/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Pinout diagram
|
||||
|
||||
Pinout diagrams can be a helpful tool to display the pin layout for a board.
|
||||
|
||||
Rendering them using ANSI and building them into a board's firmware means they
|
||||
are always conveniently available, even over a serial connection.
|
||||
|
||||

|
||||
|
||||
## Overview
|
||||
|
||||
`pinout.py` generates a unicode pinout diagram that uses ANSI escape characters
|
||||
to add colour. It currently generates the pinout diagram for the WeActStudio
|
||||
RP2350B board but is an example that could be extended for any board.
|
||||
|
||||
Display the output by executing the script:
|
||||
|
||||
```bash
|
||||
python pinout.py
|
||||
```
|
||||
|
||||
|
||||
## Compression
|
||||
|
||||
`compress.py` uses zlib to _compress input_ and output a _byte string_.
|
||||
|
||||
The output from `pinout.py` can be large but compresses efficiently, so the
|
||||
intent is that the byte string output from `compress.py` can then be copied to
|
||||
`../modules/board.py` so that the _compressed_ pinout will be included in the
|
||||
firmware.
|
||||
|
||||
To execute:
|
||||
|
||||
```bash
|
||||
python pinout.py | python compress.py
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
||||
[Build your own Command Line with ANSI escape
|
||||
codes](https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html)
|
||||
provides a good reference of how to use ANSI codes, including helpful colour
|
||||
lookups.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user