Merge branch 'main' into title_execution_status
This commit is contained in:
commit
207311b02a
|
@ -35,6 +35,12 @@ CIRCUITPY_BLE_NAME
|
|||
~~~~~~~~~~~~~~~~~~
|
||||
Default BLE name the board advertises as, including for the BLE workflow.
|
||||
|
||||
CIRCUITPY_RESERVED_PSRAM
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
On boards with Espressif microcontrollers with PSRAM (also called SPIRAM), permanently reserve a portion of PSRAM for use by esp-idf.
|
||||
This storage is removed from the CircuitPython "heap" and is available for allocation by esp-idf routines in the core instead.
|
||||
Generally, only set this to a non-zero value when it is required by a specific core module.
|
||||
|
||||
CIRCUITPY_WEB_API_PASSWORD
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Password required to make modifications to the board from the Web Workflow.
|
||||
|
|
|
@ -209,7 +209,7 @@ msgstr ""
|
|||
msgid "%q=%q"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#, c-format
|
||||
msgid "%s error 0x%x"
|
||||
msgstr ""
|
||||
|
@ -645,7 +645,7 @@ msgstr ""
|
|||
msgid "CIRCUITPY drive could not be found or created."
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "CRC or checksum was invalid"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ msgstr ""
|
|||
msgid "GNSS init"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Generic Failure"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1192,7 +1192,7 @@ msgstr ""
|
|||
msgid "Invalid MAC address"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: py/moduerrno.c
|
||||
msgid "Invalid argument"
|
||||
msgstr ""
|
||||
|
@ -1222,7 +1222,7 @@ msgstr ""
|
|||
msgid "Invalid pins"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Invalid size"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ msgstr ""
|
|||
msgid "Invalid socket for TLS"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Invalid state"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1254,7 +1254,7 @@ msgstr ""
|
|||
msgid "Layer must be a Group or TileGrid subclass"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "MAC address was invalid"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1612,15 +1612,15 @@ msgstr ""
|
|||
msgid "Operation not permitted"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Operation or feature not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Operation timed out"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Out of memory"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1795,7 +1795,7 @@ msgstr ""
|
|||
msgid "Read-only object"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Received response was invalid"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1815,7 +1815,7 @@ msgstr ""
|
|||
msgid "Requested AES mode is unsupported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Requested resource not found"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2237,7 +2237,7 @@ msgstr ""
|
|||
msgid "Value length > max_length"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
|
||||
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
|
||||
msgid "Version was invalid"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ msgstr ""
|
|||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
|
||||
"PO-Revision-Date: 2022-07-24 22:22+0000\n"
|
||||
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
|
||||
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: pt_BR\n"
|
||||
|
@ -3860,7 +3860,7 @@ msgstr "o pow() com 3 argumentos requer números inteiros"
|
|||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h
|
||||
msgid "pressing BOOT button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "pressionando o botão BOOT na inicialização.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
|
||||
msgid "pressing SW38 button at start up.\n"
|
||||
|
@ -3868,7 +3868,7 @@ msgstr "pressionando o botão SW38 na inicialização.\n"
|
|||
|
||||
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
|
||||
msgid "pressing VOLUME button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "pressionando o botão VOLUME na inicialização.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h
|
||||
#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h
|
||||
|
|
|
@ -6,7 +6,7 @@ msgstr ""
|
|||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
|
||||
"PO-Revision-Date: 2022-07-21 20:15+0000\n"
|
||||
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
|
||||
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: sv\n"
|
||||
|
@ -3819,7 +3819,7 @@ msgstr "pow() med 3 argument kräver heltal"
|
|||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h
|
||||
msgid "pressing BOOT button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "genom att trycka på BOOT-knappen vid start.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
|
||||
msgid "pressing SW38 button at start up.\n"
|
||||
|
@ -3827,7 +3827,7 @@ msgstr "genom att trycka på SW38-knappen vid start.\n"
|
|||
|
||||
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
|
||||
msgid "pressing VOLUME button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "genom att trycka på VOLUME-knappen vid start.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h
|
||||
#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h
|
||||
|
|
|
@ -7,15 +7,15 @@ msgstr ""
|
|||
"Project-Id-Version: circuitpython-cn\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
|
||||
"PO-Revision-Date: 2022-04-23 21:13+0000\n"
|
||||
"Last-Translator: hexthat <hexthat@gmail.com>\n"
|
||||
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
|
||||
"Last-Translator: River Wang <urfdvw@gmail.com>\n"
|
||||
"Language-Team: Chinese Hanyu Pinyin\n"
|
||||
"Language: zh_Latn_pinyin\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 4.12.1-dev\n"
|
||||
"X-Generator: Weblate 4.14-dev\n"
|
||||
|
||||
#: main.c
|
||||
msgid ""
|
||||
|
@ -634,9 +634,9 @@ msgid "Buffer must be a multiple of 512 bytes"
|
|||
msgstr "Huǎnchōngqū bìxū shì 512 zìjié de bèishù"
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr "Huǎn chōng qū tài duǎn , àn %d zì jié"
|
||||
msgstr "Huǎnchōngqū tàiduǎn , mùqián zhǐyǒu %d zìjié"
|
||||
|
||||
#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
|
||||
msgid "Buffers must be same size"
|
||||
|
@ -742,15 +742,15 @@ msgstr "tōng guò USB kě jiàn shí wú fǎ chóng xīn ān zhuāng '/'."
|
|||
#: ports/cxd56/common-hal/microcontroller/__init__.c
|
||||
#: ports/mimxrt10xx/common-hal/microcontroller/__init__.c
|
||||
msgid "Cannot reset into bootloader because no bootloader is present"
|
||||
msgstr ""
|
||||
msgstr "wúfǎ chóngxīn qǐdòng dào yǐdǎo chéngxù, yīnwéi yǐdǎo chéngxù bù cúnzài."
|
||||
|
||||
#: ports/espressif/common-hal/socketpool/Socket.c
|
||||
msgid "Cannot set socket options"
|
||||
msgstr "wú fǎ shè zhì tào jiē zì xuǎn xiàng"
|
||||
msgstr "wúfǎ shèzhì tàojiēzì xuǎnxiàng"
|
||||
|
||||
#: shared-bindings/digitalio/DigitalInOut.c
|
||||
msgid "Cannot set value when direction is input."
|
||||
msgstr "Dāng fāngxiàng xiàng nèi shí, bùnéng shèzhì gāi zhí."
|
||||
msgstr "Dāng fāngxiàng wéi shūrù shí, bùnéng shèzhì zhí."
|
||||
|
||||
#: ports/espressif/common-hal/busio/UART.c
|
||||
#: ports/mimxrt10xx/common-hal/busio/UART.c
|
||||
|
|
4
main.c
4
main.c
|
@ -818,8 +818,12 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
|
|||
usb_get_boot_py_data(usb_boot_py_data, size);
|
||||
#endif
|
||||
|
||||
port_post_boot_py(true);
|
||||
|
||||
cleanup_after_vm(heap, _exec_result.exception);
|
||||
|
||||
port_post_boot_py(false);
|
||||
|
||||
#if CIRCUITPY_USB
|
||||
// Now give back the data we saved from the heap going away.
|
||||
usb_return_boot_py_data(usb_boot_py_data, size);
|
||||
|
|
|
@ -281,6 +281,8 @@ ifneq ($(CIRCUITPY_BLEIO),0)
|
|||
SRC_C += common-hal/_bleio/ble_events.c
|
||||
endif
|
||||
|
||||
SRC_C += $(wildcard common-hal/espidf/*.c)
|
||||
|
||||
SRC_COMMON_HAL_EXPANDED = \
|
||||
$(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
||||
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
||||
|
|
|
@ -120,6 +120,20 @@ const mp_obj_type_t mp_type_espidf_MemoryError = {
|
|||
.parent = &mp_type_MemoryError,
|
||||
};
|
||||
|
||||
//| def get_total_psram() -> int:
|
||||
//| """Returns the number of bytes of psram detected, or 0 if psram is not present or not configured"""
|
||||
STATIC mp_obj_t espidf_get_total_psram(void) {
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_total_psram());
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(espidf_get_total_psram_obj, espidf_get_total_psram);
|
||||
|
||||
//| def get_reserved_psram() -> int:
|
||||
//| """Returns number of bytes of psram reserved for use by esp-idf, either a board-specific default value or the value defined in ``/.env``."""
|
||||
STATIC mp_obj_t espidf_get_reserved_psram(void) {
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_reserved_psram());
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(espidf_get_reserved_psram_obj, espidf_get_reserved_psram);
|
||||
|
||||
STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espidf) },
|
||||
|
||||
|
@ -129,6 +143,8 @@ STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = {
|
|||
|
||||
{ MP_ROM_QSTR(MP_QSTR_erase_nvs), MP_ROM_PTR(&espidf_erase_nvs_obj)},
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_get_total_psram), MP_ROM_PTR(&espidf_get_total_psram_obj)},
|
||||
{ MP_ROM_QSTR(MP_QSTR_get_reserved_psram), MP_ROM_PTR(&espidf_get_reserved_psram_obj)},
|
||||
{ MP_ROM_QSTR(MP_QSTR_IDFError), MP_ROM_PTR(&mp_type_espidf_IDFError) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_espidf_MemoryError) },
|
||||
};
|
||||
|
@ -139,66 +155,3 @@ const mp_obj_module_t espidf_module = {
|
|||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&espidf_module_globals,
|
||||
};
|
||||
|
||||
void raise_esp_error(esp_err_t err) {
|
||||
const compressed_string_t *msg = NULL;
|
||||
const mp_obj_type_t *exception_type = &mp_type_espidf_IDFError;
|
||||
switch (err) {
|
||||
case ESP_FAIL:
|
||||
msg = translate("Generic Failure");
|
||||
break;
|
||||
case ESP_ERR_NO_MEM:
|
||||
exception_type = &mp_type_espidf_MemoryError;
|
||||
msg = translate("Out of memory");
|
||||
break;
|
||||
case ESP_ERR_INVALID_ARG:
|
||||
msg = translate("Invalid argument");
|
||||
break;
|
||||
case ESP_ERR_INVALID_STATE:
|
||||
msg = translate("Invalid state");
|
||||
break;
|
||||
case ESP_ERR_INVALID_SIZE:
|
||||
msg = translate("Invalid size");
|
||||
break;
|
||||
case ESP_ERR_NOT_FOUND:
|
||||
msg = translate("Requested resource not found");
|
||||
break;
|
||||
case ESP_ERR_NOT_SUPPORTED:
|
||||
msg = translate("Operation or feature not supported");
|
||||
break;
|
||||
case ESP_ERR_TIMEOUT:
|
||||
msg = translate("Operation timed out");
|
||||
break;
|
||||
case ESP_ERR_INVALID_RESPONSE:
|
||||
msg = translate("Received response was invalid");
|
||||
break;
|
||||
case ESP_ERR_INVALID_CRC:
|
||||
msg = translate("CRC or checksum was invalid");
|
||||
break;
|
||||
case ESP_ERR_INVALID_VERSION:
|
||||
msg = translate("Version was invalid");
|
||||
break;
|
||||
case ESP_ERR_INVALID_MAC:
|
||||
msg = translate("MAC address was invalid");
|
||||
break;
|
||||
}
|
||||
if (msg) {
|
||||
mp_raise_msg(exception_type, msg);
|
||||
}
|
||||
|
||||
const char *group = "ESP-IDF";
|
||||
|
||||
// tests must be in descending order
|
||||
MP_STATIC_ASSERT(ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE);
|
||||
MP_STATIC_ASSERT(ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE);
|
||||
if (err >= ESP_ERR_FLASH_BASE) {
|
||||
group = "Flash";
|
||||
} else if (err >= ESP_ERR_MESH_BASE) {
|
||||
group = "Mesh";
|
||||
} else if (err >= ESP_ERR_WIFI_BASE) {
|
||||
group = "WiFi";
|
||||
}
|
||||
mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err);
|
||||
}
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module, CIRCUITPY_ESPIDF);
|
||||
|
|
|
@ -39,4 +39,11 @@ NORETURN void mp_raise_espidf_MemoryError(void);
|
|||
void raise_esp_error(esp_err_t err) NORETURN;
|
||||
#define CHECK_ESP_RESULT(x) do { int res = (x); if (res != ESP_OK) raise_esp_error(res); } while (0)
|
||||
|
||||
void common_hal_espidf_reserve_psram(void);
|
||||
bool common_hal_espidf_set_reserved_psram(size_t amount);
|
||||
size_t common_hal_espidf_get_reserved_psram(void);
|
||||
size_t common_hal_espidf_get_total_psram(void);
|
||||
intptr_t common_hal_espidf_get_psram_start(void);
|
||||
intptr_t common_hal_espidf_get_psram_end(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_ESPRESSIF_BINDINGS_ESPIDF___INIT___H
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "lib/oofatfs/ff.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
|
||||
void board_init(void) {
|
||||
// Debug UART
|
||||
|
@ -41,7 +42,7 @@ void board_init(void) {
|
|||
|
||||
mp_import_stat_t stat_b = mp_import_stat("boot.py");
|
||||
if (stat_b != MP_IMPORT_STAT_FILE) {
|
||||
FATFS *fatfs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fatfs = filesystem_circuitpy();
|
||||
FIL fs;
|
||||
UINT char_written = 0;
|
||||
const byte buffer[] = "#Serial port upload mode\nimport storage\nstorage.remount(\"/\", False)\nstorage.disable_usb_drive()\n";
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2022 Jeff Epler 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 "bindings/espidf/__init__.h"
|
||||
#include "supervisor/shared/translate/translate.h"
|
||||
#include "supervisor/memory.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
#define TAG "espidf"
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
#include "esp32/spiram.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_heap_caps_init.h"
|
||||
#include "soc/soc.h"
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/himem.h"
|
||||
#else
|
||||
#define esp_himem_reserved_area_size() (0)
|
||||
#endif
|
||||
bool ok_to_reserve_psram = true;
|
||||
size_t reserved_psram = DEFAULT_RESERVED_PSRAM;
|
||||
#endif
|
||||
|
||||
static size_t psram_size_usable(void) {
|
||||
#ifdef CONFIG_SPIRAM
|
||||
/* PSRAM chip may be larger than the size we can map into address space */
|
||||
size_t s = MIN(esp_spiram_get_size(), SOC_EXTRAM_DATA_SIZE);
|
||||
return s - esp_himem_reserved_area_size();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool common_hal_espidf_set_reserved_psram(size_t amount) {
|
||||
#ifdef CONFIG_SPIRAM
|
||||
if (!esp_spiram_is_initialized()) {
|
||||
return false;
|
||||
}
|
||||
if (!ok_to_reserve_psram) {
|
||||
return false;
|
||||
}
|
||||
if (amount > psram_size_usable()) {
|
||||
return false;
|
||||
}
|
||||
reserved_psram = amount;
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
supervisor_allocation *psram_for_idf;
|
||||
|
||||
void common_hal_espidf_reserve_psram(void) {
|
||||
#ifdef CONFIG_SPIRAM
|
||||
if (!psram_for_idf) {
|
||||
ESP_LOGI(TAG, "Reserving %d bytes of psram", reserved_psram);
|
||||
if (reserved_psram == 0) {
|
||||
return;
|
||||
}
|
||||
psram_for_idf = allocate_memory(reserved_psram, true, false);
|
||||
if (psram_for_idf) {
|
||||
intptr_t psram_for_idf_start = (intptr_t)psram_for_idf->ptr;
|
||||
intptr_t psram_for_idf_end = psram_for_idf_start + reserved_psram;
|
||||
ESP_LOGI(TAG, "Reserved %x..%x", psram_for_idf_start, psram_for_idf_end);
|
||||
heap_caps_add_region(psram_for_idf_start, psram_for_idf_end);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "supervisor allocation failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t common_hal_espidf_get_reserved_psram(void) {
|
||||
#ifdef CONFIG_SPIRAM
|
||||
return reserved_psram;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t common_hal_espidf_get_total_psram(void) {
|
||||
return psram_size_usable();
|
||||
}
|
||||
|
||||
intptr_t common_hal_espidf_get_psram_start(void) {
|
||||
#ifdef CONFIG_SPIRAM
|
||||
if (esp_spiram_is_initialized()) {
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
return SOC_EXTRAM_DATA_LOW;
|
||||
#else
|
||||
return SOC_EXTRAM_DATA_HIGH - psram_size_usable();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
intptr_t common_hal_espidf_get_psram_end(void) {
|
||||
#ifdef CONFIG_SPIRAM
|
||||
if (esp_spiram_is_initialized()) {
|
||||
return common_hal_espidf_get_psram_start() + psram_size_usable();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void raise_esp_error(esp_err_t err) {
|
||||
const compressed_string_t *msg = NULL;
|
||||
const mp_obj_type_t *exception_type = &mp_type_espidf_IDFError;
|
||||
switch (err) {
|
||||
case ESP_FAIL:
|
||||
msg = translate("Generic Failure");
|
||||
break;
|
||||
case ESP_ERR_NO_MEM:
|
||||
exception_type = &mp_type_espidf_MemoryError;
|
||||
msg = translate("Out of memory");
|
||||
break;
|
||||
case ESP_ERR_INVALID_ARG:
|
||||
msg = translate("Invalid argument");
|
||||
break;
|
||||
case ESP_ERR_INVALID_STATE:
|
||||
msg = translate("Invalid state");
|
||||
break;
|
||||
case ESP_ERR_INVALID_SIZE:
|
||||
msg = translate("Invalid size");
|
||||
break;
|
||||
case ESP_ERR_NOT_FOUND:
|
||||
msg = translate("Requested resource not found");
|
||||
break;
|
||||
case ESP_ERR_NOT_SUPPORTED:
|
||||
msg = translate("Operation or feature not supported");
|
||||
break;
|
||||
case ESP_ERR_TIMEOUT:
|
||||
msg = translate("Operation timed out");
|
||||
break;
|
||||
case ESP_ERR_INVALID_RESPONSE:
|
||||
msg = translate("Received response was invalid");
|
||||
break;
|
||||
case ESP_ERR_INVALID_CRC:
|
||||
msg = translate("CRC or checksum was invalid");
|
||||
break;
|
||||
case ESP_ERR_INVALID_VERSION:
|
||||
msg = translate("Version was invalid");
|
||||
break;
|
||||
case ESP_ERR_INVALID_MAC:
|
||||
msg = translate("MAC address was invalid");
|
||||
break;
|
||||
}
|
||||
if (msg) {
|
||||
mp_raise_msg(exception_type, msg);
|
||||
}
|
||||
|
||||
const char *group = "ESP-IDF";
|
||||
|
||||
// tests must be in descending order
|
||||
MP_STATIC_ASSERT(ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE);
|
||||
MP_STATIC_ASSERT(ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE);
|
||||
if (err >= ESP_ERR_FLASH_BASE) {
|
||||
group = "Flash";
|
||||
} else if (err >= ESP_ERR_MESH_BASE) {
|
||||
group = "Mesh";
|
||||
} else if (err >= ESP_ERR_WIFI_BASE) {
|
||||
group = "WiFi";
|
||||
}
|
||||
mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err);
|
||||
}
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module, CIRCUITPY_ESPIDF);
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2022 Jeff Epler 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bindings/espidf/__init__.h"
|
|
@ -90,4 +90,13 @@
|
|||
#define CIRCUITPY_ESP_USB_SERIAL_JTAG (0)
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_RESERVED_PSRAM
|
||||
#define DEFAULT_RESERVED_PSRAM (0)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SPIRAM)
|
||||
#undef CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS
|
||||
#define CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS (1)
|
||||
#endif
|
||||
|
||||
#endif // MICROPY_INCLUDED_ESPRESSIF_MPCONFIGPORT_H
|
||||
|
|
|
@ -29,11 +29,13 @@
|
|||
#include <sys/time.h>
|
||||
#include "supervisor/board.h"
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "bindings/espidf/__init__.h"
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "common-hal/analogio/AnalogOut.h"
|
||||
#include "common-hal/busio/I2C.h"
|
||||
|
@ -53,6 +55,7 @@
|
|||
#include "shared-bindings/microcontroller/RunMode.h"
|
||||
#include "shared-bindings/rtc/__init__.h"
|
||||
#include "shared-bindings/socketpool/__init__.h"
|
||||
#include "shared-module/dotenv/__init__.h"
|
||||
|
||||
#include "peripherals/rmt.h"
|
||||
#include "peripherals/timer.h"
|
||||
|
@ -95,20 +98,8 @@
|
|||
#include "esp32/rom/efuse.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
#include "esp32/spiram.h"
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/himem.h"
|
||||
#else
|
||||
#define esp_himem_reserved_area_size() (0)
|
||||
#endif
|
||||
|
||||
static size_t spiram_size_usable(void) {
|
||||
/* SPIRAM chip may be larger than the size we can map into address space */
|
||||
size_t s = MIN(esp_spiram_get_size(), SOC_EXTRAM_DATA_SIZE);
|
||||
return s - esp_himem_reserved_area_size();
|
||||
}
|
||||
#endif
|
||||
#include "esp_log.h"
|
||||
#define TAG "port"
|
||||
|
||||
uint32_t *heap;
|
||||
uint32_t heap_size;
|
||||
|
@ -302,14 +293,16 @@ safe_mode_t port_init(void) {
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
if (esp_spiram_is_initialized()) {
|
||||
size_t spiram_size = spiram_size_usable();
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
heap = (uint32_t *)SOC_EXTRAM_DATA_LOW;
|
||||
#else
|
||||
heap = (uint32_t *)(SOC_EXTRAM_DATA_HIGH - spiram_size);
|
||||
#endif
|
||||
heap_size = spiram_size / sizeof(uint32_t);
|
||||
{
|
||||
intptr_t heap_start = common_hal_espidf_get_psram_start();
|
||||
intptr_t heap_end = common_hal_espidf_get_psram_end();
|
||||
size_t spiram_size = heap_end - heap_start;
|
||||
if (spiram_size > 0) {
|
||||
heap = (uint32_t *)heap_start;
|
||||
heap_size = (heap_end - heap_start) / sizeof(uint32_t);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "CONFIG_SPIRAM enabled but no spiram heap available");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -518,6 +511,16 @@ void port_idle_until_interrupt(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void port_post_boot_py(bool heap_valid) {
|
||||
if (!heap_valid && filesystem_present()) {
|
||||
mp_int_t reserved;
|
||||
if (dotenv_get_key_int("/.env", "CIRCUITPY_RESERVED_PSRAM", &reserved)) {
|
||||
common_hal_espidf_set_reserved_psram(reserved);
|
||||
}
|
||||
common_hal_espidf_reserve_psram();
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap main in app_main that the IDF expects.
|
||||
extern void main(void);
|
||||
extern void app_main(void);
|
||||
|
|
|
@ -564,6 +564,10 @@ void supervisor_run_background_tasks_if_tick(void);
|
|||
#error "CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR must be at least 1"
|
||||
#endif
|
||||
|
||||
#ifndef CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS
|
||||
#define CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS (0)
|
||||
#endif
|
||||
|
||||
#ifndef USB_MIDI_EP_NUM_OUT
|
||||
#define USB_MIDI_EP_NUM_OUT (0)
|
||||
#endif
|
||||
|
|
|
@ -89,6 +89,8 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type
|
|||
|
||||
busio_spi_obj_t *spi = args[ARG_spi].u_obj;
|
||||
|
||||
mp_arg_validate_type(args[ARG_chip_select].u_obj, &digitalio_digitalinout_type, MP_QSTR_chip_select);
|
||||
|
||||
common_hal_adafruit_bus_device_spidevice_construct(MP_OBJ_TO_PTR(self), spi, args[ARG_chip_select].u_obj, args[ARG_cs_active_value].u_bool, args[ARG_baudrate].u_int, args[ARG_polarity].u_int,
|
||||
args[ARG_phase].u_int, args[ARG_extra_clocks].u_int);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "shared-bindings/dotenv/__init__.h"
|
||||
|
@ -32,6 +33,7 @@
|
|||
#include "extmod/vfs_fat.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "py/objstr.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
|
||||
STATIC uint8_t consume_spaces(FIL *active_file) {
|
||||
uint8_t character = ' ';
|
||||
|
@ -188,7 +190,7 @@ STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) {
|
|||
|
||||
mp_int_t dotenv_get_key(const char *path, const char *key, char *value, mp_int_t value_len) {
|
||||
FIL active_file;
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
FRESULT result = f_open(fs, &active_file, path, FA_READ);
|
||||
if (result != FR_OK) {
|
||||
return -1;
|
||||
|
@ -223,3 +225,26 @@ mp_obj_t common_hal_dotenv_get_key(const char *path, const char *key) {
|
|||
}
|
||||
return mp_obj_new_str(value, actual_len);
|
||||
}
|
||||
|
||||
bool dotenv_get_key_terminated(const char *path, const char *key, char *value, mp_int_t value_len) {
|
||||
mp_int_t actual_len = dotenv_get_key(path, key, value, value_len - 1);
|
||||
if (actual_len >= value_len) {
|
||||
return false;
|
||||
}
|
||||
value[actual_len] = '\0'; // terminate string
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dotenv_get_key_int(const char *path, const char *key, mp_int_t *value) {
|
||||
char buf[16];
|
||||
if (!dotenv_get_key_terminated(path, key, buf, (mp_int_t)sizeof(buf))) {
|
||||
return false;
|
||||
}
|
||||
char *end;
|
||||
long result = strtol(buf, &end, 0);
|
||||
if (end == buf || *end) { // If the whole buffer was not consumed it's an error
|
||||
return false;
|
||||
}
|
||||
*value = (mp_int_t)result;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,3 +26,11 @@
|
|||
|
||||
// Allocation free version that returns the full length of the value.
|
||||
mp_int_t dotenv_get_key(const char *path, const char *key, char *value, mp_int_t value_len);
|
||||
|
||||
// Returns true and sets value to a '\0'-terminated string if key is present
|
||||
// and the value (including the terminating '\0') fits strictly within
|
||||
// value_len bytes.
|
||||
bool dotenv_get_key_terminated(const char *path, const char *key, char *value, mp_int_t value_len);
|
||||
|
||||
// Returns true and sets value to the read value. Returns false if the value was not numeric.
|
||||
bool dotenv_get_key_int(const char *path, const char *key, mp_int_t *value);
|
||||
|
|
|
@ -45,4 +45,6 @@ void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concu
|
|||
bool filesystem_is_writable_by_python(fs_user_mount_t *vfs);
|
||||
bool filesystem_is_writable_by_usb(fs_user_mount_t *vfs);
|
||||
|
||||
FATFS *filesystem_circuitpy(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SUPERVISOR_FILESYSTEM_H
|
||||
|
|
|
@ -109,4 +109,10 @@ void port_wake_main_task(void);
|
|||
// default weak implementation is provided that does nothing.
|
||||
void port_wake_main_task_from_isr(void);
|
||||
|
||||
// Some ports need special handling just after completing boot.py execution.
|
||||
// This function is called once while boot.py's VM is still valid, and
|
||||
// then a second time after the VM is finalized.
|
||||
// A default weak implementation is provided that does nothing.
|
||||
void port_post_boot_py(bool heap_valid);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "common-hal/_bleio/__init__.h"
|
||||
|
||||
#include "supervisor/fatfs_port.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/reload.h"
|
||||
#include "supervisor/shared/bluetooth/file_transfer.h"
|
||||
#include "supervisor/shared/bluetooth/file_transfer_protocol.h"
|
||||
|
@ -172,7 +173,7 @@ STATIC uint8_t _process_read(const uint8_t *raw_buf, size_t command_len) {
|
|||
char *path = (char *)((uint8_t *)command) + header_size;
|
||||
path[command->path_length] = '\0';
|
||||
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
FRESULT result = f_open(fs, &active_file, path, FA_READ);
|
||||
if (result != FR_OK) {
|
||||
response.status = STATUS_ERROR;
|
||||
|
@ -289,7 +290,7 @@ STATIC uint8_t _process_write(const uint8_t *raw_buf, size_t command_len) {
|
|||
return ANY_COMMAND;
|
||||
}
|
||||
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
DWORD fattime;
|
||||
_truncated_time = truncate_time(command->modification_time, &fattime);
|
||||
override_fattime(fattime);
|
||||
|
@ -438,7 +439,7 @@ STATIC uint8_t _process_delete(const uint8_t *raw_buf, size_t command_len) {
|
|||
if (command_len < header_size + command->path_length) {
|
||||
return THIS_COMMAND;
|
||||
}
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *path = (char *)((uint8_t *)command) + header_size;
|
||||
path[command->path_length] = '\0';
|
||||
FILINFO file;
|
||||
|
@ -495,7 +496,7 @@ STATIC uint8_t _process_mkdir(const uint8_t *raw_buf, size_t command_len) {
|
|||
if (command_len < header_size + command->path_length) {
|
||||
return THIS_COMMAND;
|
||||
}
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *path = (char *)command->path;
|
||||
_terminate_path(path, command->path_length);
|
||||
|
||||
|
@ -552,7 +553,7 @@ STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) {
|
|||
return THIS_COMMAND;
|
||||
}
|
||||
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *path = (char *)&command->path;
|
||||
_terminate_path(path, command->path_length);
|
||||
// mp_printf(&mp_plat_print, "list %s\n", path);
|
||||
|
@ -640,7 +641,7 @@ STATIC uint8_t _process_move(const uint8_t *raw_buf, size_t command_len) {
|
|||
if (command_len < header_size + total_path_length) {
|
||||
return THIS_COMMAND;
|
||||
}
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *old_path = (char *)command->paths;
|
||||
old_path[command->old_path_length] = '\0';
|
||||
|
||||
|
|
|
@ -92,6 +92,9 @@ bool filesystem_init(bool create_allowed, bool force_create) {
|
|||
vfs_fat->blockdev.flags = 0;
|
||||
supervisor_flash_init_vfs(vfs_fat);
|
||||
|
||||
mp_vfs_mount_t *vfs = &_mp_vfs;
|
||||
vfs->len = 0;
|
||||
|
||||
// try to mount the flash
|
||||
FRESULT res = f_mount(&vfs_fat->fatfs);
|
||||
if ((res == FR_NO_FILESYSTEM && create_allowed) || force_create) {
|
||||
|
@ -140,7 +143,6 @@ bool filesystem_init(bool create_allowed, bool force_create) {
|
|||
} else if (res != FR_OK) {
|
||||
return false;
|
||||
}
|
||||
mp_vfs_mount_t *vfs = &_mp_vfs;
|
||||
vfs->str = "/";
|
||||
vfs->len = 1;
|
||||
vfs->obj = MP_OBJ_FROM_PTR(vfs_fat);
|
||||
|
@ -199,5 +201,12 @@ void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concu
|
|||
}
|
||||
|
||||
bool filesystem_present(void) {
|
||||
return true;
|
||||
return _mp_vfs.len > 0;
|
||||
}
|
||||
|
||||
FATFS *filesystem_circuitpy(void) {
|
||||
if (!filesystem_present()) {
|
||||
return NULL;
|
||||
}
|
||||
return &_internal_vfs.fatfs;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ enum {
|
|||
#if CIRCUITPY_USB_VENDOR
|
||||
+ 1 // usb_vendor_add_descriptor
|
||||
#endif
|
||||
|
||||
+ CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS
|
||||
,
|
||||
|
||||
CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT =
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "shared-module/storage/__init__.h"
|
||||
#include "shared/timeutils/timeutils.h"
|
||||
#include "supervisor/fatfs_port.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/reload.h"
|
||||
#include "supervisor/shared/translate/translate.h"
|
||||
#include "supervisor/shared/web_workflow/web_workflow.h"
|
||||
|
@ -580,7 +581,7 @@ static void _reply_redirect(socketpool_socket_obj_t *socket, _request *request,
|
|||
lwip_setsockopt(socket->num, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));
|
||||
const char *hostname = common_hal_mdns_server_get_hostname(&mdns);
|
||||
_send_strs(socket,
|
||||
"HTTP/1.1 301 Moved Permanently\r\n",
|
||||
"HTTP/1.1 307 Temporary Redirect\r\n",
|
||||
"Connection: close\r\n",
|
||||
"Content-Length: 0\r\n",
|
||||
"Location: ", NULL);
|
||||
|
@ -984,7 +985,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
|
|||
} else {
|
||||
char *path = request->path + 3;
|
||||
size_t pathlen = strlen(path);
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
// Trailing / is a directory.
|
||||
bool directory = false;
|
||||
if (path[pathlen - 1] == '/') {
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2022 Jeff Epler 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 "stdbool.h"
|
||||
|
||||
#include "supervisor/port.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
|
||||
MP_WEAK void port_post_boot_py(bool heap_valid) {
|
||||
}
|
|
@ -11,14 +11,15 @@ SRC_SUPERVISOR = \
|
|||
supervisor/shared/port.c \
|
||||
supervisor/shared/reload.c \
|
||||
supervisor/shared/safe_mode.c \
|
||||
supervisor/shared/serial.c \
|
||||
supervisor/shared/serial.c \
|
||||
supervisor/shared/stack.c \
|
||||
supervisor/shared/status_leds.c \
|
||||
supervisor/shared/tick.c \
|
||||
supervisor/shared/title_bar.c \
|
||||
supervisor/shared/traceback.c \
|
||||
supervisor/shared/translate/translate.c \
|
||||
supervisor/shared/workflow.c
|
||||
supervisor/shared/workflow.c \
|
||||
supervisor/stub/misc.c \
|
||||
|
||||
NO_USB ?= $(wildcard supervisor/usb.c)
|
||||
|
||||
|
|
Loading…
Reference in New Issue