Skip to content

Commit 55784c9

Browse files
committed
wip; compiles
1 parent 02069eb commit 55784c9

40 files changed

+1450
-148
lines changed

ports/espressif/Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,12 @@ LDFLAGS += \
194194
-Wl,--build-id=none \
195195
-fno-rtti
196196

197-
ifeq ($(IDF_TARGET),esp32c3)
197+
ifeq ($(IDF_TARGET),esp32)
198+
LDFLAGS += \
199+
-T$(IDF_TARGET).rom.newlib-data.ld \
200+
-T$(IDF_TARGET).rom.newlib-funcs.ld \
201+
-T$(IDF_TARGET).rom.spiflash.ld
202+
else ifeq ($(IDF_TARGET),esp32c3)
198203
LDFLAGS += \
199204
-Tesp32c3.rom.newlib.ld \
200205
-Tesp32c3.rom.version.ld \
@@ -362,6 +367,9 @@ $(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h
362367

363368
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
364369
BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS))
370+
ifeq ($(IDF_TARGET),esp32)
371+
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a
372+
endif
365373

366374
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
367375
ifneq ($(CIRCUITPY_BLEIO),0)
@@ -380,12 +388,16 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
380388
ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
381389
endif
382390

383-
ifeq ($(IDF_TARGET),esp32c3)
391+
ifeq ($(IDF_TARGET),esp32)
392+
BOOTLOADER_OFFSET = 0x0
393+
else ifeq ($(IDF_TARGET),esp32c3)
384394
BOOTLOADER_OFFSET = 0x0
385395
else ifeq ($(IDF_TARGET),esp32s3)
386396
BOOTLOADER_OFFSET = 0x0
387-
else
397+
else ifeq ($(IDF_TARGET),esp32s2)
388398
BOOTLOADER_OFFSET = 0x1000
399+
else
400+
$(error unknown IDF_TARGET $(IDF_TARGET))
389401
endif
390402

391403
IDF_CMAKE_TARGETS = \
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
*/
26+
27+
#include "supervisor/board.h"
28+
#include "mpconfigboard.h"
29+
#include "shared-bindings/microcontroller/Pin.h"
30+
#include "components/driver/include/driver/gpio.h"
31+
#include "components/hal/include/hal/gpio_hal.h"
32+
#include "common-hal/microcontroller/Pin.h"
33+
34+
void board_init(void) {
35+
reset_board();
36+
}
37+
38+
bool board_requests_safe_mode(void) {
39+
return false;
40+
}
41+
42+
void reset_board(void) {
43+
// Turn on NeoPixel and I2C power by default.
44+
gpio_set_direction(2, GPIO_MODE_DEF_OUTPUT);
45+
gpio_set_level(2, true);
46+
}
47+
48+
void board_deinit(void) {
49+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2022 Dan Halbert 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+
*/
26+
27+
// Micropython setup
28+
29+
#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32 V2"
30+
#define MICROPY_HW_MCU_NAME "ESP32"
31+
32+
#define MICROPY_HW_NEOPIXEL (&pin_GPIO0)
33+
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO2)
34+
35+
#define CIRCUITPY_BOARD_I2C (1)
36+
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO20, .sda = &pin_GPIO22}}
37+
38+
#define CIRCUITPY_BOARD_SPI (1)
39+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO5, .mosi = &pin_GPIO19, .miso = &pin_GPIO21}}
40+
41+
#define CIRCUITPY_BOARD_UART (1)
42+
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO8, .rx = &pin_GPIO7}}
43+
44+
// For entering safe mode, use SW38 button
45+
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO38)
46+
47+
// Explanation of how a user got into safe mode
48+
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing SW38 button at start up.\n")
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CIRCUITPY_CREATOR_ID = 0x0000239A
2+
CIRCUITPY_CREATION_ID = 0x00320001
3+
4+
IDF_TARGET = esp32
5+
6+
INTERNAL_FLASH_FILESYSTEM = 1
7+
LONGINT_IMPL = MPZ
8+
9+
# The default queue depth of 16 overflows on release builds,
10+
# so increase it to 32.
11+
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
12+
13+
CIRCUITPY_ESP_FLASH_MODE = dio
14+
CIRCUITPY_ESP_FLASH_FREQ = 40m
15+
CIRCUITPY_ESP_FLASH_SIZE = 8MB
16+
17+
CIRCUITPY_MODULE = esp32_pico_mini_02
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
// External pins are in silkscreen order, from top to bottom, left side, then right side
7+
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },
8+
{ MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) },
9+
10+
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO25) },
11+
{ MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) },
12+
13+
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO34) },
14+
{ MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) },
15+
16+
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO39) },
17+
{ MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) },
18+
19+
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO36) },
20+
{ MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) },
21+
22+
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) },
23+
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) },
24+
25+
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO5) },
26+
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
27+
28+
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) },
29+
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) },
30+
31+
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO21) },
32+
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) },
33+
34+
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO7) },
35+
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },
36+
37+
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO8) },
38+
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) },
39+
40+
{ MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) },
41+
42+
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) },
43+
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) },
44+
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) },
45+
{ MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) },
46+
47+
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) },
48+
{ MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) },
49+
50+
{ MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) },
51+
{ MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO27) },
52+
53+
{ MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) },
54+
{ MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO33) },
55+
56+
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) },
57+
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO15) },
58+
59+
{ MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) },
60+
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO32) },
61+
62+
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) },
63+
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO14) },
64+
65+
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO20) },
66+
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) },
67+
68+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO22) },
69+
{ MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) },
70+
71+
{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) },
72+
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO35) },
73+
74+
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO38) },
75+
{ MP_ROM_QSTR(MP_QSTR_SW38), MP_ROM_PTR(&pin_GPIO38) },
76+
77+
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO0) },
78+
79+
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_I2C_POWER), MP_ROM_PTR(&pin_GPIO2) },
80+
81+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
82+
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) },
83+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
84+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }
85+
};
86+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
3+
#
4+
# Bootloader config
5+
#
6+
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
7+
# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set
8+
CONFIG_BOOTLOADER_LOG_LEVEL=0
9+
# end of Bootloader config
10+
11+
#
12+
# Serial flasher config
13+
#
14+
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
15+
# end of Serial flasher config
16+
17+
#
18+
# Partition Table
19+
#
20+
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
21+
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
22+
# end of Partition Table
23+
24+
#
25+
# Compiler options
26+
#
27+
# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set
28+
# end of Compiler options
29+
30+
#
31+
# Component config
32+
#
33+
#
34+
# ESP32-specific
35+
#
36+
# CONFIG_ESP32_SPIRAM_SUPPORT is not set
37+
# end of ESP32-specific
38+
39+
#
40+
# LWIP
41+
#
42+
CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-Feather-ESP32-V2"
43+
# end of LWIP
44+
45+
# end of Component config
46+
47+
#
48+
# Deprecated options for backward compatibility
49+
#
50+
# CONFIG_SPIRAM_SUPPORT is not set
51+
# end of Deprecated options for backward compatibility

ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# Component config
3+
#
4+
#
5+
# ESP32S2-specific
6+
#
17
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
28
#
39
# SPI RAM config
@@ -7,12 +13,10 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y
713
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
814
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
915
CONFIG_SPIRAM_SIZE=2097152
10-
# end of SPI RAM config
11-
12-
CONFIG_DEFAULT_PSRAM_CLK_IO=30
1316
#
1417
# PSRAM clock and cs IO for ESP32S2
1518
#
19+
CONFIG_DEFAULT_PSRAM_CLK_IO=30
1620
CONFIG_DEFAULT_PSRAM_CS_IO=26
1721
# end of PSRAM clock and cs IO for ESP32S2
1822

@@ -30,8 +34,14 @@ CONFIG_SPIRAM_USE_MEMMAP=y
3034
# CONFIG_SPIRAM_USE_MALLOC is not set
3135
CONFIG_SPIRAM_MEMTEST=y
3236
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
37+
# end of SPI RAM config
38+
39+
# end of ESP32S2-specific
40+
3341
#
3442
# LWIP
3543
#
3644
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
3745
# end of LWIP
46+
47+
# end of Component config

0 commit comments

Comments
 (0)