Merge remote-tracking branch 'adafruit/main' into native_wifi
This commit is contained in:
commit
767ca5c3dc
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -410,6 +410,7 @@ jobs:
|
||||
board:
|
||||
- "espressif_saola_1_wroom"
|
||||
- "espressif_saola_1_wrover"
|
||||
- "microdev_micro_s2"
|
||||
- "unexpectedmaker_feathers2"
|
||||
|
||||
steps:
|
||||
|
4
conf.py
4
conf.py
@ -42,6 +42,9 @@ master_doc = 'docs/index'
|
||||
# Grab the JSON values to use while building the module support matrix
|
||||
# in 'shared-bindings/index.rst'
|
||||
|
||||
# The stubs must be built before we calculate the shared bindings matrix
|
||||
subprocess.check_output(["make", "stubs"])
|
||||
|
||||
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
|
||||
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
|
||||
|
||||
@ -77,7 +80,6 @@ source_suffix = {
|
||||
'.md': 'markdown',
|
||||
}
|
||||
|
||||
subprocess.check_output(["make", "stubs"])
|
||||
extensions.append('autoapi.extension')
|
||||
|
||||
autoapi_type = 'python'
|
||||
|
@ -51,10 +51,15 @@ as a natural "TODO" list. An example minimal build list is shown below:
|
||||
.. code-block:: makefile
|
||||
|
||||
# These modules are implemented in ports/<port>/common-hal:
|
||||
CIRCUITPY_MICROCONTROLLER = 0 # Typically the first module to create
|
||||
CIRCUITPY_DIGITALIO = 0 # Typically the second module to create
|
||||
|
||||
# Typically the first module to create
|
||||
CIRCUITPY_MICROCONTROLLER = 0
|
||||
# Typically the second module to create
|
||||
CIRCUITPY_DIGITALIO = 0
|
||||
# Other modules:
|
||||
CIRCUITPY_ANALOGIO = 0
|
||||
CIRCUITPY_BUSIO = 0
|
||||
CIRCUITPY_COUNTIO = 0
|
||||
CIRCUITPY_NEOPIXEL_WRITE = 0
|
||||
CIRCUITPY_PULSEIO = 0
|
||||
CIRCUITPY_OS = 0
|
||||
@ -63,22 +68,34 @@ as a natural "TODO" list. An example minimal build list is shown below:
|
||||
CIRCUITPY_AUDIOIO = 0
|
||||
CIRCUITPY_ROTARYIO = 0
|
||||
CIRCUITPY_RTC = 0
|
||||
CIRCUITPY_SDCARDIO = 0
|
||||
CIRCUITPY_FRAMEBUFFERIO = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CPERIPHERAL = 0
|
||||
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO (stub ok)
|
||||
# Requires SPI, PulseIO (stub ok):
|
||||
CIRCUITPY_DISPLAYIO = 0
|
||||
|
||||
# These modules are implemented in shared-module/ - they can be included in
|
||||
# any port once their prerequisites in common-hal are complete.
|
||||
CIRCUITPY_BITBANGIO = 0 # Requires DigitalIO
|
||||
CIRCUITPY_GAMEPAD = 0 # Requires DigitalIO
|
||||
CIRCUITPY_PIXELBUF = 0 # Requires neopixel_write or SPI (dotstar)
|
||||
CIRCUITPY_RANDOM = 0 # Requires OS
|
||||
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
|
||||
CIRCUITPY_TOUCHIO = 0 # Requires Microcontroller
|
||||
CIRCUITPY_USB_HID = 0 # Requires USB
|
||||
CIRCUITPY_USB_MIDI = 0 # Requires USB
|
||||
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0 # Does nothing without I2C
|
||||
CIRCUITPY_ULAB = 0 # No requirements, but takes extra flash
|
||||
# Requires DigitalIO:
|
||||
CIRCUITPY_BITBANGIO = 0
|
||||
# Requires DigitalIO
|
||||
CIRCUITPY_GAMEPAD = 0
|
||||
# Requires neopixel_write or SPI (dotstar)
|
||||
CIRCUITPY_PIXELBUF = 0
|
||||
# Requires OS
|
||||
CIRCUITPY_RANDOM = 0
|
||||
# Requires OS, filesystem
|
||||
CIRCUITPY_STORAGE = 0
|
||||
# Requires Microcontroller
|
||||
CIRCUITPY_TOUCHIO = 0
|
||||
# Requires USB
|
||||
CIRCUITPY_USB_HID = 0
|
||||
CIRCUITPY_USB_MIDI = 0
|
||||
# Does nothing without I2C
|
||||
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0
|
||||
# No requirements, but takes extra flash
|
||||
CIRCUITPY_ULAB = 0
|
||||
|
||||
Step 2: Init
|
||||
--------------
|
||||
|
@ -28,6 +28,7 @@ import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']
|
||||
|
||||
@ -42,7 +43,7 @@ def get_circuitpython_root_dir():
|
||||
def get_shared_bindings():
|
||||
""" Get a list of modules in shared-bindings based on folder names
|
||||
"""
|
||||
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
|
||||
shared_bindings_dir = get_circuitpython_root_dir() / "circuitpython-stubs"
|
||||
return [item.name for item in shared_bindings_dir.iterdir()]
|
||||
|
||||
|
||||
@ -131,38 +132,44 @@ def lookup_setting(settings, key, default=''):
|
||||
key = value[2:-1]
|
||||
return value
|
||||
|
||||
def all_ports_all_boards(ports=SUPPORTED_PORTS):
|
||||
for port in ports:
|
||||
|
||||
port_dir = get_circuitpython_root_dir() / "ports" / port
|
||||
for entry in (port_dir / "boards").iterdir():
|
||||
if not entry.is_dir():
|
||||
continue
|
||||
yield (port, entry)
|
||||
|
||||
def support_matrix_by_board(use_branded_name=True):
|
||||
""" Compiles a list of the available core modules available for each
|
||||
board.
|
||||
"""
|
||||
base = build_module_map()
|
||||
|
||||
boards = dict()
|
||||
for port in SUPPORTED_PORTS:
|
||||
|
||||
def support_matrix(arg):
|
||||
port, entry = arg
|
||||
port_dir = get_circuitpython_root_dir() / "ports" / port
|
||||
for entry in (port_dir / "boards").iterdir():
|
||||
if not entry.is_dir():
|
||||
continue
|
||||
board_modules = []
|
||||
board_name = entry.name
|
||||
settings = get_settings_from_makefile(str(port_dir), entry.name)
|
||||
|
||||
settings = get_settings_from_makefile(str(port_dir), entry.name)
|
||||
if use_branded_name:
|
||||
with open(entry / "mpconfigboard.h") as get_name:
|
||||
board_contents = get_name.read()
|
||||
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
|
||||
board_contents)
|
||||
if board_name_re:
|
||||
board_name = board_name_re.group(1).strip('"')
|
||||
|
||||
if use_branded_name:
|
||||
with open(entry / "mpconfigboard.h") as get_name:
|
||||
board_contents = get_name.read()
|
||||
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
|
||||
board_contents)
|
||||
if board_name_re:
|
||||
board_name = board_name_re.group(1).strip('"')
|
||||
board_modules = []
|
||||
for module in base:
|
||||
key = f'CIRCUITPY_{module.upper()}'
|
||||
if int(lookup_setting(settings, key, '0')):
|
||||
board_modules.append(base[module]['name'])
|
||||
|
||||
board_modules = []
|
||||
for module in base:
|
||||
key = f'CIRCUITPY_{module.upper()}'
|
||||
if int(lookup_setting(settings, key, '0')):
|
||||
board_modules.append(base[module]['name'])
|
||||
boards[board_name] = sorted(board_modules)
|
||||
return (board_name, sorted(board_modules))
|
||||
|
||||
executor = ThreadPoolExecutor(max_workers=os.cpu_count())
|
||||
boards = dict(sorted(executor.map(support_matrix, all_ports_all_boards())))
|
||||
|
||||
#print(json.dumps(boards, indent=2))
|
||||
return boards
|
||||
|
@ -113,6 +113,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
|
||||
start = mp_hal_ticks_ms();
|
||||
mp_call_function_0(module_fun);
|
||||
mp_hal_set_interrupt_char(-1); // disable interrupt
|
||||
// Handle any ctrl-c interrupt that arrived just in time
|
||||
mp_handle_pending();
|
||||
nlr_pop();
|
||||
ret = 0;
|
||||
if (exec_flags & EXEC_FLAG_PRINT_EOF) {
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-08-25 16:39-0700\n"
|
||||
"POT-Creation-Date: 2020-08-27 11:21-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -1349,8 +1349,8 @@ msgstr ""
|
||||
#: ports/nrf/common-hal/pulseio/PulseOut.c
|
||||
#: ports/stm/common-hal/pulseio/PulseOut.c
|
||||
msgid ""
|
||||
"Port does not accept pins or frequency. "
|
||||
"Construct and pass a PWMOut Carrier instead"
|
||||
"Port does not accept pins or frequency. Construct and pass a PWMOut Carrier "
|
||||
"instead"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/Adapter.c
|
||||
@ -1365,6 +1365,10 @@ msgstr ""
|
||||
msgid "Pull not used when direction is output."
|
||||
msgstr ""
|
||||
|
||||
#: ports/stm/ref/pulseout-pre-timeralloc.c
|
||||
msgid "PulseOut not supported on this chip"
|
||||
msgstr ""
|
||||
|
||||
#: ports/stm/common-hal/os/__init__.c
|
||||
msgid "RNG DeInit Error"
|
||||
msgstr ""
|
||||
|
@ -101,8 +101,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
|
||||
uint32_t frequency,
|
||||
uint16_t duty_cycle) {
|
||||
if (!carrier || pin || frequency) {
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
|
||||
Construct and pass a PWMOut Carrier instead"));
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. Construct and pass a PWMOut Carrier instead"));
|
||||
}
|
||||
|
||||
if (refcount == 0) {
|
||||
|
@ -64,8 +64,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
|
||||
uint32_t frequency,
|
||||
uint16_t duty_cycle) {
|
||||
if (!carrier || pin || frequency) {
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
|
||||
Construct and pass a PWMOut Carrier instead"));
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. Construct and pass a PWMOut Carrier instead"));
|
||||
}
|
||||
|
||||
if (pulse_fd < 0) {
|
||||
|
@ -0,0 +1,33 @@
|
||||
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM16=y
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||
CONFIG_SPIRAM_SIZE=2097152
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32S2
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM clock and cs IO for ESP32S2
|
||||
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
# CONFIG_SPIRAM_SPEED_80M is not set
|
||||
CONFIG_SPIRAM_SPEED_40M=y
|
||||
# CONFIG_SPIRAM_SPEED_26M is not set
|
||||
# CONFIG_SPIRAM_SPEED_20M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
|
||||
# end of SPI RAM config
|
56
ports/esp32s2/boards/microdev_micro_s2/board.c
Normal file
56
ports/esp32s2/boards/microdev_micro_s2/board.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
void board_init(void) {
|
||||
// USB
|
||||
common_hal_never_reset_pin(&pin_GPIO19);
|
||||
common_hal_never_reset_pin(&pin_GPIO20);
|
||||
|
||||
// Debug UART
|
||||
common_hal_never_reset_pin(&pin_GPIO43);
|
||||
common_hal_never_reset_pin(&pin_GPIO44);
|
||||
|
||||
// SPI Flash and RAM
|
||||
common_hal_never_reset_pin(&pin_GPIO26);
|
||||
common_hal_never_reset_pin(&pin_GPIO27);
|
||||
common_hal_never_reset_pin(&pin_GPIO28);
|
||||
common_hal_never_reset_pin(&pin_GPIO29);
|
||||
common_hal_never_reset_pin(&pin_GPIO30);
|
||||
common_hal_never_reset_pin(&pin_GPIO31);
|
||||
common_hal_never_reset_pin(&pin_GPIO32);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
35
ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
Normal file
35
ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
//Micropython setup
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "microDev microS2"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S2"
|
||||
|
||||
#define MICROPY_HW_LED (&pin_GPIO21)
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO33)
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
15
ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.mk
Normal file
15
ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.mk
Normal file
@ -0,0 +1,15 @@
|
||||
USB_VID = 0x239A
|
||||
USB_PID = 0x80C6
|
||||
USB_PRODUCT = "microS2"
|
||||
USB_MANUFACTURER = "microDev"
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=qio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=40m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=16MB
|
49
ports/esp32s2/boards/microdev_micro_s2/pins.c
Normal file
49
ports/esp32s2/boards/microdev_micro_s2/pins.c
Normal file
@ -0,0 +1,49 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
35
ports/esp32s2/boards/microdev_micro_s2/sdkconfig
Normal file
35
ports/esp32s2/boards/microdev_micro_s2/sdkconfig
Normal file
@ -0,0 +1,35 @@
|
||||
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
|
||||
CONFIG_SPIRAM_SIZE=8388608
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32S2
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM clock and cs IO for ESP32S2
|
||||
|
||||
CONFIG_SPIRAM_SPIWP_SD3_PIN=28
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
# CONFIG_SPIRAM_USE_AHB_DBUS3 is not set
|
||||
# CONFIG_SPIRAM_SPEED_80M is not set
|
||||
CONFIG_SPIRAM_SPEED_40M=y
|
||||
# CONFIG_SPIRAM_SPEED_26M is not set
|
||||
# CONFIG_SPIRAM_SPEED_20M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
|
||||
# end of SPI RAM config
|
@ -0,0 +1,35 @@
|
||||
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
|
||||
CONFIG_SPIRAM_SIZE=8388608
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32S2
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM clock and cs IO for ESP32S2
|
||||
|
||||
CONFIG_SPIRAM_SPIWP_SD3_PIN=28
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
# CONFIG_SPIRAM_USE_AHB_DBUS3 is not set
|
||||
# CONFIG_SPIRAM_SPEED_80M is not set
|
||||
CONFIG_SPIRAM_SPEED_40M=y
|
||||
# CONFIG_SPIRAM_SPEED_26M is not set
|
||||
# CONFIG_SPIRAM_SPEED_20M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
|
||||
# end of SPI RAM config
|
@ -30,6 +30,8 @@
|
||||
#include "py/objtuple.h"
|
||||
#include "py/qstr.h"
|
||||
|
||||
#include "esp_system.h"
|
||||
|
||||
STATIC const qstr os_uname_info_fields[] = {
|
||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
||||
@ -57,5 +59,15 @@ mp_obj_t common_hal_os_uname(void) {
|
||||
}
|
||||
|
||||
bool common_hal_os_urandom(uint8_t* buffer, uint32_t length) {
|
||||
return false;
|
||||
uint32_t i = 0;
|
||||
while (i < length) {
|
||||
uint32_t new_random = esp_random();
|
||||
for (int j = 0; j < 4 && i < length; j++) {
|
||||
buffer[i] = new_random & 0xff;
|
||||
i++;
|
||||
new_random >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -37,8 +37,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
|
||||
uint32_t frequency,
|
||||
uint16_t duty_cycle) {
|
||||
if (carrier || !pin || !frequency) {
|
||||
mp_raise_NotImplementedError(translate("Port does not accept PWM carrier. \
|
||||
Pass a pin, frequency and duty cycle instead"));
|
||||
mp_raise_NotImplementedError(translate("Port does not accept PWM carrier. Pass a pin, frequency and duty cycle instead"));
|
||||
}
|
||||
|
||||
rmt_channel_t channel = esp32s2_peripherals_find_and_reserve_rmt();
|
||||
|
@ -44,11 +44,15 @@
|
||||
#include "supervisor/memory.h"
|
||||
#include "supervisor/shared/tick.h"
|
||||
|
||||
#include "peripherals/rmt.h"
|
||||
#include "esp-idf/components/heap/include/esp_heap_caps.h"
|
||||
#include "rmt.h"
|
||||
#include "esp-idf/components/soc/soc/esp32s2/include/soc/cache_memory.h"
|
||||
|
||||
#define HEAP_SIZE (48 * 1024)
|
||||
|
||||
uint32_t* heap;
|
||||
uint32_t heap_size;
|
||||
|
||||
STATIC esp_timer_handle_t _tick_timer;
|
||||
|
||||
void tick_timer_cb(void* arg) {
|
||||
@ -67,6 +71,16 @@ safe_mode_t port_init(void) {
|
||||
|
||||
heap = malloc(HEAP_SIZE);
|
||||
never_reset_module_internal_pins();
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
heap = (uint32_t*) (DRAM0_CACHE_ADDRESS_HIGH - CONFIG_SPIRAM_SIZE);
|
||||
heap_size = CONFIG_SPIRAM_SIZE / sizeof(uint32_t);
|
||||
#endif
|
||||
|
||||
if (heap == NULL) {
|
||||
heap = malloc(HEAP_SIZE);
|
||||
heap_size = HEAP_SIZE / sizeof(uint32_t);
|
||||
}
|
||||
return NO_SAFE_MODE;
|
||||
}
|
||||
|
||||
@ -106,7 +120,7 @@ uint32_t *port_heap_get_bottom(void) {
|
||||
}
|
||||
|
||||
uint32_t *port_heap_get_top(void) {
|
||||
return heap + (HEAP_SIZE / sizeof(uint32_t));
|
||||
return heap + heap_size;
|
||||
}
|
||||
|
||||
uint32_t *port_stack_get_limit(void) {
|
||||
|
@ -105,8 +105,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
|
||||
uint32_t frequency,
|
||||
uint16_t duty_cycle) {
|
||||
if (!carrier || pin || frequency) {
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
|
||||
Construct and pass a PWMOut Carrier instead"));
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. Construct and pass a PWMOut Carrier instead"));
|
||||
}
|
||||
|
||||
if (refcount == 0) {
|
||||
|
@ -10,7 +10,8 @@ MCU_VARIANT = STM32F401xE
|
||||
MCU_PACKAGE = UFQFPN48
|
||||
|
||||
LD_COMMON = boards/common_default.ld
|
||||
LD_FILE = boards/STM32F401xd_fs.ld # use for internal flash
|
||||
# use for internal flash
|
||||
LD_FILE = boards/STM32F401xd_fs.ld
|
||||
|
||||
# Disable ulab as we're nearly out of space on this board due to
|
||||
# INTERNAL_FLASH_FILESYSTEM. It can probably be reenabled if we enable
|
||||
|
@ -13,5 +13,6 @@ MCU_PACKAGE = LQFP64
|
||||
|
||||
LD_COMMON = boards/common_default.ld
|
||||
LD_DEFAULT = boards/STM32F405_default.ld
|
||||
LD_BOOT = boards/STM32F405_boot.ld # UF2 boot option
|
||||
# UF2 boot option
|
||||
LD_BOOT = boards/STM32F405_boot.ld
|
||||
UF2_OFFSET = 0x8010000
|
||||
|
@ -18,4 +18,5 @@ OPTIMIZATION_FLAGS = -Os
|
||||
|
||||
LD_COMMON = boards/common_default.ld
|
||||
LD_FILE = boards/STM32F401xe_boot.ld
|
||||
# LD_FILE = boards/STM32F401xe_fs.ld # use for internal flash
|
||||
# use for internal flash
|
||||
# LD_FILE = boards/STM32F401xe_fs.ld
|
||||
|
@ -72,16 +72,20 @@ bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
||||
if (HAL_RNG_Init(&handle) != HAL_OK) mp_raise_ValueError(translate("RNG Init Error"));
|
||||
|
||||
//Assign bytes
|
||||
for (uint i = 0; i < length; i++) {
|
||||
uint32_t temp;
|
||||
uint32_t i = 0;
|
||||
while (i < length) {
|
||||
uint32_t new_random;
|
||||
uint32_t start = HAL_GetTick();
|
||||
//the HAL function has a timeout, but it isn't long enough, and isn't adjustable
|
||||
while(!(__HAL_RNG_GET_FLAG(&handle,RNG_FLAG_DRDY)) && ((HAL_GetTick() - start) < RNG_TIMEOUT));
|
||||
//
|
||||
if (HAL_RNG_GenerateRandomNumber(&handle, &temp) != HAL_OK) {
|
||||
if (HAL_RNG_GenerateRandomNumber(&handle, &new_random) != HAL_OK) {
|
||||
mp_raise_ValueError(translate("Random number generation error"));
|
||||
}
|
||||
*buffer = (uint8_t)temp;
|
||||
for (int j = 0; j < 4 && i < length; j++) {
|
||||
buffer[i] = new_random & 0xff;
|
||||
i++;
|
||||
new_random >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
//shut down the peripheral
|
||||
|
@ -118,8 +118,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
|
||||
uint32_t frequency,
|
||||
uint16_t duty_cycle) {
|
||||
if (!carrier || pin || frequency) {
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
|
||||
Construct and pass a PWMOut Carrier instead"));
|
||||
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. Construct and pass a PWMOut Carrier instead"));
|
||||
}
|
||||
|
||||
// Add to active PulseOuts
|
||||
|
2
py/obj.c
2
py/obj.c
@ -67,6 +67,8 @@ void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
|
||||
#ifdef RUN_BACKGROUND_TASKS
|
||||
RUN_BACKGROUND_TASKS;
|
||||
#endif
|
||||
mp_handle_pending();
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (o_in == MP_OBJ_NULL) {
|
||||
mp_print_str(print, "(nil)");
|
||||
|
@ -29,14 +29,24 @@
|
||||
#include "supervisor/serial.h"
|
||||
#include "lib/oofatfs/ff.h"
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "supervisor/shared/status_leds.h"
|
||||
|
||||
#if CIRCUITPY_WATCHDOG
|
||||
#include "shared-bindings/watchdog/__init__.h"
|
||||
#define WATCHDOG_EXCEPTION_CHECK() (MP_STATE_VM(mp_pending_exception) == &mp_watchdog_timeout_exception)
|
||||
#else
|
||||
#define WATCHDOG_EXCEPTION_CHECK() 0
|
||||
#endif
|
||||
|
||||
int mp_hal_stdin_rx_chr(void) {
|
||||
for (;;) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
mp_handle_pending();
|
||||
if (serial_bytes_available()) {
|
||||
toggle_rx_led();
|
||||
return serial_read();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "supervisor/shared/tick.h"
|
||||
|
||||
#include "py/mpstate.h"
|
||||
#include "py/runtime.h"
|
||||
#include "supervisor/linker.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/background_callback.h"
|
||||
@ -149,17 +150,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
|
||||
while (remaining > 0) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
// Check to see if we've been CTRL-Ced by autoreload or the user.
|
||||
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)))
|
||||
{
|
||||
// clear exception and generate stacktrace
|
||||
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
|
||||
nlr_raise(&MP_STATE_VM(mp_kbd_exception));
|
||||
}
|
||||
if( MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) ||
|
||||
WATCHDOG_EXCEPTION_CHECK()) {
|
||||
// stop sleeping immediately
|
||||
break;
|
||||
}
|
||||
mp_handle_pending();
|
||||
remaining = end_tick - port_get_raw_ticks(NULL);
|
||||
// We break a bit early so we don't risk setting the alarm before the time when we call
|
||||
// sleep.
|
||||
|
31
tools/mpconfig_category_reader.py
Normal file
31
tools/mpconfig_category_reader.py
Normal file
@ -0,0 +1,31 @@
|
||||
filepath = '../py/circuitpy_mpconfig.mk'
|
||||
with open(filepath) as fp:
|
||||
line = fp.readline()
|
||||
cnt = 1
|
||||
fullbuild = []
|
||||
defon = []
|
||||
defoff = []
|
||||
while line:
|
||||
wordlist = line.split()
|
||||
if wordlist:
|
||||
if wordlist[-1] == "$(CIRCUITPY_FULL_BUILD)":
|
||||
fullbuild.append(wordlist[0])
|
||||
elif wordlist[-1] == "0":
|
||||
defoff.append(wordlist[0])
|
||||
elif wordlist[-1] == "1":
|
||||
defon.append(wordlist[0])
|
||||
line = fp.readline()
|
||||
cnt += 1
|
||||
|
||||
print(str(cnt) + " Lines Read\n")
|
||||
print("\nFULL BUILDS ------------------------")
|
||||
for string in fullbuild:
|
||||
print(string)
|
||||
|
||||
print("\nON BUILDS ------------------------")
|
||||
for string in defon:
|
||||
print(string)
|
||||
|
||||
print("\nOFF BUILDS ------------------------")
|
||||
for string in defoff:
|
||||
print(string)
|
Loading…
Reference in New Issue
Block a user