Skip to content

Commit ce9504f

Browse files
authored
Merge branch 'adafruit:main' into main
2 parents e6a569a + 5d9129a commit ce9504f

File tree

8 files changed

+122
-51
lines changed

8 files changed

+122
-51
lines changed

ports/espressif/boards/espressif_esp8684_devkitc_02_n4/board.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,8 @@
1-
/*
2-
* This file is part of the MicroPython project, http://micropython.org/
3-
*
4-
* The MIT License (MIT)
5-
*
6-
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
7-
*
8-
* Permission is hereby granted, free of charge, to any person obtaining a copy
9-
* of this software and associated documentation files (the "Software"), to deal
10-
* in the Software without restriction, including without limitation the rights
11-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12-
* copies of the Software, and to permit persons to whom the Software is
13-
* furnished to do so, subject to the following conditions:
14-
*
15-
* The above copyright notice and this permission notice shall be included in
16-
* all copies or substantial portions of the Software.
17-
*
18-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24-
* THE SOFTWARE.
25-
*/
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
266

277
#include "supervisor/board.h"
288

ports/espressif/boards/espressif_esp8684_devkitc_02_n4/mpconfigboard.h

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,8 @@
1-
/*
2-
* This file is part of the MicroPython project, http://micropython.org/
3-
*
4-
* The MIT License (MIT)
5-
*
6-
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
7-
*
8-
* Permission is hereby granted, free of charge, to any person obtaining a copy
9-
* of this software and associated documentation files (the "Software"), to deal
10-
* in the Software without restriction, including without limitation the rights
11-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12-
* copies of the Software, and to permit persons to whom the Software is
13-
* furnished to do so, subject to the following conditions:
14-
*
15-
* The above copyright notice and this permission notice shall be included in
16-
* all copies or substantial portions of the Software.
17-
*
18-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24-
* THE SOFTWARE.
25-
*/
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
266

277
// Micropython setup
288

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2024 Bill Sideris, independently providing these changes.
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "supervisor/board.h"
8+
9+
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2024 Bill Sideris, independently providing these changes.
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
// Micropython setup
8+
9+
#define MICROPY_HW_BOARD_NAME "NodeMcu-ESP32-C2"
10+
#define MICROPY_HW_MCU_NAME "ESP32C2"
11+
12+
#define DEFAULT_UART_BUS_RX (&pin_GPIO19)
13+
#define DEFAULT_UART_BUS_TX (&pin_GPIO20)
14+
15+
#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX
16+
#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CIRCUITPY_CREATOR_ID = 0xD03E0000
2+
CIRCUITPY_CREATION_ID = 0x00C20001
3+
4+
IDF_TARGET = esp32c2
5+
6+
CIRCUITPY_ESP_FLASH_MODE = qio
7+
CIRCUITPY_ESP_FLASH_FREQ = 60m
8+
CIRCUITPY_ESP_FLASH_SIZE = 4MB
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "shared-bindings/board/__init__.h"
2+
3+
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
4+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
5+
6+
// Module on top, from top to bottom, left to right
7+
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
8+
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
9+
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
10+
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
11+
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
12+
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
13+
14+
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
15+
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
16+
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
17+
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
18+
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
19+
20+
// Dupe pin on board, labeled both as TX and TX0
21+
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
22+
{ MP_ROM_QSTR(MP_QSTR_TX0), MP_ROM_PTR(&pin_GPIO20) },
23+
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO20) },
24+
25+
// Dupe pin on board, labeled both as RX and RX0
26+
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
27+
{ MP_ROM_QSTR(MP_QSTR_RX0), MP_ROM_PTR(&pin_GPIO19) },
28+
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO19) },
29+
30+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
31+
};
32+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Espressif IoT Development Framework Configuration
3+
#
4+
#
5+
# Serial flasher config
6+
#
7+
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
8+
# end of Serial flasher config
9+
10+
#
11+
# Component config
12+
#
13+
#
14+
# Hardware Settings
15+
#
16+
#
17+
# Main XTAL Config
18+
#
19+
CONFIG_XTAL_FREQ_26=y
20+
# CONFIG_XTAL_FREQ_40 is not set
21+
CONFIG_XTAL_FREQ=26
22+
# end of Main XTAL Config
23+
24+
# end of Hardware Settings
25+
26+
#
27+
# ESP System Settings
28+
#
29+
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
30+
# end of ESP System Settings
31+
32+
#
33+
# LWIP
34+
#
35+
CONFIG_LWIP_LOCAL_HOSTNAME="nodemcu-esp32c2"
36+
# end of LWIP
37+
38+
# end of Component config
39+
40+
# end of Espressif IoT Development Framework Configuration

supervisor/shared/filesystem.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,13 @@ fs_user_mount_t *filesystem_for_path(const char *path_in, const char **path_unde
232232
fs_mount = filesystem_circuitpy();
233233
} else {
234234
fs_mount = MP_OBJ_TO_PTR(vfs->obj);
235-
*path_under_mount += strlen(vfs->str);
235+
// Check if the vfs name is one character long: it must be "/" in that case.
236+
// If so don't remove the mount point name. We must use an absolute path
237+
// because otherwise the path will be adjusted by os.getcwd() when it's looked up.
238+
if (strlen(vfs->str) != 1) {
239+
// Remove the mount point directory name, such as "/sd".
240+
path_under_mount += strlen(vfs->str);
241+
}
236242
}
237243
return fs_mount;
238244
}

0 commit comments

Comments
 (0)