Skip to content

Commit 207311b

Browse files
authored
Merge branch 'main' into title_execution_status
2 parents 167108a + 8c10e09 commit 207311b

File tree

26 files changed

+428
-126
lines changed

26 files changed

+428
-126
lines changed

docs/environment.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ CIRCUITPY_BLE_NAME
3535
~~~~~~~~~~~~~~~~~~
3636
Default BLE name the board advertises as, including for the BLE workflow.
3737

38+
CIRCUITPY_RESERVED_PSRAM
39+
~~~~~~~~~~~~~~~~~~~~~~~~
40+
On boards with Espressif microcontrollers with PSRAM (also called SPIRAM), permanently reserve a portion of PSRAM for use by esp-idf.
41+
This storage is removed from the CircuitPython "heap" and is available for allocation by esp-idf routines in the core instead.
42+
Generally, only set this to a non-zero value when it is required by a specific core module.
43+
3844
CIRCUITPY_WEB_API_PASSWORD
3945
~~~~~~~~~~~~~~~~~~~~~~~~~~
4046
Password required to make modifications to the board from the Web Workflow.

locale/circuitpython.pot

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ msgstr ""
209209
msgid "%q=%q"
210210
msgstr ""
211211

212-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
212+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
213213
#, c-format
214214
msgid "%s error 0x%x"
215215
msgstr ""
@@ -645,7 +645,7 @@ msgstr ""
645645
msgid "CIRCUITPY drive could not be found or created."
646646
msgstr ""
647647

648-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
648+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
649649
msgid "CRC or checksum was invalid"
650650
msgstr ""
651651

@@ -1023,7 +1023,7 @@ msgstr ""
10231023
msgid "GNSS init"
10241024
msgstr ""
10251025

1026-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1026+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
10271027
msgid "Generic Failure"
10281028
msgstr ""
10291029

@@ -1192,7 +1192,7 @@ msgstr ""
11921192
msgid "Invalid MAC address"
11931193
msgstr ""
11941194

1195-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1195+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
11961196
#: py/moduerrno.c
11971197
msgid "Invalid argument"
11981198
msgstr ""
@@ -1222,15 +1222,15 @@ msgstr ""
12221222
msgid "Invalid pins"
12231223
msgstr ""
12241224

1225-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1225+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
12261226
msgid "Invalid size"
12271227
msgstr ""
12281228

12291229
#: ports/espressif/common-hal/ssl/SSLContext.c
12301230
msgid "Invalid socket for TLS"
12311231
msgstr ""
12321232

1233-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1233+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
12341234
msgid "Invalid state"
12351235
msgstr ""
12361236

@@ -1254,7 +1254,7 @@ msgstr ""
12541254
msgid "Layer must be a Group or TileGrid subclass"
12551255
msgstr ""
12561256

1257-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1257+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
12581258
msgid "MAC address was invalid"
12591259
msgstr ""
12601260

@@ -1612,15 +1612,15 @@ msgstr ""
16121612
msgid "Operation not permitted"
16131613
msgstr ""
16141614

1615-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1615+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
16161616
msgid "Operation or feature not supported"
16171617
msgstr ""
16181618

1619-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1619+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
16201620
msgid "Operation timed out"
16211621
msgstr ""
16221622

1623-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1623+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
16241624
msgid "Out of memory"
16251625
msgstr ""
16261626

@@ -1795,7 +1795,7 @@ msgstr ""
17951795
msgid "Read-only object"
17961796
msgstr ""
17971797

1798-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1798+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
17991799
msgid "Received response was invalid"
18001800
msgstr ""
18011801

@@ -1815,7 +1815,7 @@ msgstr ""
18151815
msgid "Requested AES mode is unsupported"
18161816
msgstr ""
18171817

1818-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
1818+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
18191819
msgid "Requested resource not found"
18201820
msgstr ""
18211821

@@ -2237,7 +2237,7 @@ msgstr ""
22372237
msgid "Value length > max_length"
22382238
msgstr ""
22392239

2240-
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
2240+
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
22412241
msgid "Version was invalid"
22422242
msgstr ""
22432243

locale/pt_BR.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ msgstr ""
66
"Project-Id-Version: PACKAGE VERSION\n"
77
"Report-Msgid-Bugs-To: \n"
88
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
9-
"PO-Revision-Date: 2022-07-24 22:22+0000\n"
9+
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
1010
"Last-Translator: Wellington Terumi Uemura <[email protected]>\n"
1111
"Language-Team: \n"
1212
"Language: pt_BR\n"
@@ -3860,15 +3860,15 @@ msgstr "o pow() com 3 argumentos requer números inteiros"
38603860

38613861
#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h
38623862
msgid "pressing BOOT button at start up.\n"
3863-
msgstr ""
3863+
msgstr "pressionando o botão BOOT na inicialização.\n"
38643864

38653865
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
38663866
msgid "pressing SW38 button at start up.\n"
38673867
msgstr "pressionando o botão SW38 na inicialização.\n"
38683868

38693869
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
38703870
msgid "pressing VOLUME button at start up.\n"
3871-
msgstr ""
3871+
msgstr "pressionando o botão VOLUME na inicialização.\n"
38723872

38733873
#: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h
38743874
#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h

locale/sv.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ msgstr ""
66
"Project-Id-Version: PACKAGE VERSION\n"
77
"Report-Msgid-Bugs-To: \n"
88
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
9-
"PO-Revision-Date: 2022-07-21 20:15+0000\n"
9+
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
1010
"Last-Translator: Jonny Bergdahl <[email protected]>\n"
1111
"Language-Team: LANGUAGE <[email protected]>\n"
1212
"Language: sv\n"
@@ -3819,15 +3819,15 @@ msgstr "pow() med 3 argument kräver heltal"
38193819

38203820
#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h
38213821
msgid "pressing BOOT button at start up.\n"
3822-
msgstr ""
3822+
msgstr "genom att trycka på BOOT-knappen vid start.\n"
38233823

38243824
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
38253825
msgid "pressing SW38 button at start up.\n"
38263826
msgstr "genom att trycka på SW38-knappen vid start.\n"
38273827

38283828
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
38293829
msgid "pressing VOLUME button at start up.\n"
3830-
msgstr ""
3830+
msgstr "genom att trycka på VOLUME-knappen vid start.\n"
38313831

38323832
#: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h
38333833
#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h

locale/zh_Latn_pinyin.po

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ msgstr ""
77
"Project-Id-Version: circuitpython-cn\n"
88
"Report-Msgid-Bugs-To: \n"
99
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
10-
"PO-Revision-Date: 2022-04-23 21:13+0000\n"
11-
"Last-Translator: hexthat <hexthat@gmail.com>\n"
10+
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
11+
"Last-Translator: River Wang <urfdvw@gmail.com>\n"
1212
"Language-Team: Chinese Hanyu Pinyin\n"
1313
"Language: zh_Latn_pinyin\n"
1414
"MIME-Version: 1.0\n"
1515
"Content-Type: text/plain; charset=UTF-8\n"
1616
"Content-Transfer-Encoding: 8bit\n"
1717
"Plural-Forms: nplurals=1; plural=0;\n"
18-
"X-Generator: Weblate 4.12.1-dev\n"
18+
"X-Generator: Weblate 4.14-dev\n"
1919

2020
#: main.c
2121
msgid ""
@@ -634,9 +634,9 @@ msgid "Buffer must be a multiple of 512 bytes"
634634
msgstr "Huǎnchōngqū bìxū shì 512 zìjié de bèishù"
635635

636636
#: shared-bindings/_bleio/PacketBuffer.c
637-
#, fuzzy, c-format
637+
#, c-format
638638
msgid "Buffer too short by %d bytes"
639-
msgstr "Huǎn chōng qū tài duǎn , àn %d zì jié"
639+
msgstr "Huǎnchōngqū tàiduǎn , mùqián zhǐyǒu %d zìjié"
640640

641641
#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
642642
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 '/'."
742742
#: ports/cxd56/common-hal/microcontroller/__init__.c
743743
#: ports/mimxrt10xx/common-hal/microcontroller/__init__.c
744744
msgid "Cannot reset into bootloader because no bootloader is present"
745-
msgstr ""
745+
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."
746746

747747
#: ports/espressif/common-hal/socketpool/Socket.c
748748
msgid "Cannot set socket options"
749-
msgstr "wú fǎ shè zhì tào jiē zì xuǎn xiàng"
749+
msgstr "wúfǎ shèzhì tàojiēzì xuǎnxiàng"
750750

751751
#: shared-bindings/digitalio/DigitalInOut.c
752752
msgid "Cannot set value when direction is input."
753-
msgstr "Dāng fāngxiàng xiàng nèi shí, bùnéng shèzhì gāi zhí."
753+
msgstr "Dāng fāngxiàng wéi shūrù shí, bùnéng shèzhì zhí."
754754

755755
#: ports/espressif/common-hal/busio/UART.c
756756
#: ports/mimxrt10xx/common-hal/busio/UART.c

main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,12 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
818818
usb_get_boot_py_data(usb_boot_py_data, size);
819819
#endif
820820

821+
port_post_boot_py(true);
822+
821823
cleanup_after_vm(heap, _exec_result.exception);
822824

825+
port_post_boot_py(false);
826+
823827
#if CIRCUITPY_USB
824828
// Now give back the data we saved from the heap going away.
825829
usb_return_boot_py_data(usb_boot_py_data, size);

ports/espressif/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ ifneq ($(CIRCUITPY_BLEIO),0)
281281
SRC_C += common-hal/_bleio/ble_events.c
282282
endif
283283

284+
SRC_C += $(wildcard common-hal/espidf/*.c)
285+
284286
SRC_COMMON_HAL_EXPANDED = \
285287
$(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
286288
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \

ports/espressif/bindings/espidf/__init__.c

Lines changed: 16 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,20 @@ const mp_obj_type_t mp_type_espidf_MemoryError = {
120120
.parent = &mp_type_MemoryError,
121121
};
122122

123+
//| def get_total_psram() -> int:
124+
//| """Returns the number of bytes of psram detected, or 0 if psram is not present or not configured"""
125+
STATIC mp_obj_t espidf_get_total_psram(void) {
126+
return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_total_psram());
127+
}
128+
MP_DEFINE_CONST_FUN_OBJ_0(espidf_get_total_psram_obj, espidf_get_total_psram);
129+
130+
//| def get_reserved_psram() -> int:
131+
//| """Returns number of bytes of psram reserved for use by esp-idf, either a board-specific default value or the value defined in ``/.env``."""
132+
STATIC mp_obj_t espidf_get_reserved_psram(void) {
133+
return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_reserved_psram());
134+
}
135+
MP_DEFINE_CONST_FUN_OBJ_0(espidf_get_reserved_psram_obj, espidf_get_reserved_psram);
136+
123137
STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = {
124138
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espidf) },
125139

@@ -129,6 +143,8 @@ STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = {
129143

130144
{ MP_ROM_QSTR(MP_QSTR_erase_nvs), MP_ROM_PTR(&espidf_erase_nvs_obj)},
131145

146+
{ MP_ROM_QSTR(MP_QSTR_get_total_psram), MP_ROM_PTR(&espidf_get_total_psram_obj)},
147+
{ MP_ROM_QSTR(MP_QSTR_get_reserved_psram), MP_ROM_PTR(&espidf_get_reserved_psram_obj)},
132148
{ MP_ROM_QSTR(MP_QSTR_IDFError), MP_ROM_PTR(&mp_type_espidf_IDFError) },
133149
{ MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_espidf_MemoryError) },
134150
};
@@ -139,66 +155,3 @@ const mp_obj_module_t espidf_module = {
139155
.base = { &mp_type_module },
140156
.globals = (mp_obj_dict_t *)&espidf_module_globals,
141157
};
142-
143-
void raise_esp_error(esp_err_t err) {
144-
const compressed_string_t *msg = NULL;
145-
const mp_obj_type_t *exception_type = &mp_type_espidf_IDFError;
146-
switch (err) {
147-
case ESP_FAIL:
148-
msg = translate("Generic Failure");
149-
break;
150-
case ESP_ERR_NO_MEM:
151-
exception_type = &mp_type_espidf_MemoryError;
152-
msg = translate("Out of memory");
153-
break;
154-
case ESP_ERR_INVALID_ARG:
155-
msg = translate("Invalid argument");
156-
break;
157-
case ESP_ERR_INVALID_STATE:
158-
msg = translate("Invalid state");
159-
break;
160-
case ESP_ERR_INVALID_SIZE:
161-
msg = translate("Invalid size");
162-
break;
163-
case ESP_ERR_NOT_FOUND:
164-
msg = translate("Requested resource not found");
165-
break;
166-
case ESP_ERR_NOT_SUPPORTED:
167-
msg = translate("Operation or feature not supported");
168-
break;
169-
case ESP_ERR_TIMEOUT:
170-
msg = translate("Operation timed out");
171-
break;
172-
case ESP_ERR_INVALID_RESPONSE:
173-
msg = translate("Received response was invalid");
174-
break;
175-
case ESP_ERR_INVALID_CRC:
176-
msg = translate("CRC or checksum was invalid");
177-
break;
178-
case ESP_ERR_INVALID_VERSION:
179-
msg = translate("Version was invalid");
180-
break;
181-
case ESP_ERR_INVALID_MAC:
182-
msg = translate("MAC address was invalid");
183-
break;
184-
}
185-
if (msg) {
186-
mp_raise_msg(exception_type, msg);
187-
}
188-
189-
const char *group = "ESP-IDF";
190-
191-
// tests must be in descending order
192-
MP_STATIC_ASSERT(ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE);
193-
MP_STATIC_ASSERT(ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE);
194-
if (err >= ESP_ERR_FLASH_BASE) {
195-
group = "Flash";
196-
} else if (err >= ESP_ERR_MESH_BASE) {
197-
group = "Mesh";
198-
} else if (err >= ESP_ERR_WIFI_BASE) {
199-
group = "WiFi";
200-
}
201-
mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err);
202-
}
203-
204-
MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module, CIRCUITPY_ESPIDF);

ports/espressif/bindings/espidf/__init__.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,11 @@ NORETURN void mp_raise_espidf_MemoryError(void);
3939
void raise_esp_error(esp_err_t err) NORETURN;
4040
#define CHECK_ESP_RESULT(x) do { int res = (x); if (res != ESP_OK) raise_esp_error(res); } while (0)
4141

42+
void common_hal_espidf_reserve_psram(void);
43+
bool common_hal_espidf_set_reserved_psram(size_t amount);
44+
size_t common_hal_espidf_get_reserved_psram(void);
45+
size_t common_hal_espidf_get_total_psram(void);
46+
intptr_t common_hal_espidf_get_psram_start(void);
47+
intptr_t common_hal_espidf_get_psram_end(void);
48+
4249
#endif // MICROPY_INCLUDED_ESPRESSIF_BINDINGS_ESPIDF___INIT___H

ports/espressif/boards/mixgo_ce_serial/board.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "lib/oofatfs/ff.h"
3232
#include "extmod/vfs_fat.h"
3333
#include "py/mpstate.h"
34+
#include "supervisor/filesystem.h"
3435

3536
void board_init(void) {
3637
// Debug UART
@@ -41,7 +42,7 @@ void board_init(void) {
4142

4243
mp_import_stat_t stat_b = mp_import_stat("boot.py");
4344
if (stat_b != MP_IMPORT_STAT_FILE) {
44-
FATFS *fatfs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
45+
FATFS *fatfs = filesystem_circuitpy();
4546
FIL fs;
4647
UINT char_written = 0;
4748
const byte buffer[] = "#Serial port upload mode\nimport storage\nstorage.remount(\"/\", False)\nstorage.disable_usb_drive()\n";

0 commit comments

Comments
 (0)