Skip to content

Commit e3df9e9

Browse files
authored
Merge pull request #2541 from rgomezwap/Add-ESP32_S3
Add esp32 s3
2 parents 2cb2bf3 + d6d9fa9 commit e3df9e9

File tree

8 files changed

+2204
-34
lines changed

8 files changed

+2204
-34
lines changed

boards/ESP32S3_IDF4.py

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
#!/bin/false
2+
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
3+
#
4+
# Copyright (C) 2013 Gordon Williams <[email protected]>
5+
#
6+
# This Source Code Form is subject to the terms of the Mozilla Public
7+
# License, v. 2.0. If a copy of the MPL was not distributed with this
8+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
9+
#
10+
# ----------------------------------------------------------------------------------------
11+
# This file contains information for a specific board - the available pins, and where LEDs,
12+
# Buttons, and other in-built peripherals are. It is used to build documentation as well
13+
# as various source and header files for Espruino.
14+
# ----------------------------------------------------------------------------------------
15+
16+
# ###########################################################
17+
# # THIS IS BETA - IDF4 SUPPORT IS NOT READY YET #
18+
# ###########################################################
19+
20+
# A Note about the 'variables' parameter on ESP32 Builds
21+
# ------------------------------------------------------
22+
#
23+
# For the ESP32 build, the number of JsVars is governed by two factors:
24+
# * Available memory
25+
# * Maximum number of JsVars for the used JsVar format
26+
#
27+
# This setting will chose the optimum JsVar format for a given number
28+
# of JsVars.
29+
30+
# If you add PSRAM to your ESP32 or compile with modules removed, you
31+
# may wish to select a value using this table:
32+
#
33+
# Value | Max JsVars | Bytes per JsVar | Maximum References |
34+
# ------+--------------+-----------------+--------------------+
35+
# 4095 | 4095 | 13 | 255 |
36+
# 8191 | 8191 | 13 | 15 |
37+
# 16383 | 16383 | 14 | 255 |
38+
# 65535 | 65535 | 16 | 255 |
39+
# ------+--------------+-----------------+--------------------+
40+
41+
# CAUTION: Chosing 8191 only allows 15 references to a variable. This
42+
# may be too restrictive to run some code.
43+
44+
# Using too large a JsVar format may limit how many JsVars can fit into
45+
# available memory. Using too small a JsVar format will under utilise
46+
# available memory.
47+
48+
49+
import pinutils;
50+
info = {
51+
'name' : "ESP32S3",
52+
'espruino_page_link' : 'ESP32',
53+
'default_console' : "EV_SERIAL1",
54+
'default_console_baudrate' : "115200",
55+
'variables' : 16383, # See note above
56+
'io_buffer_size' : 1024, # How big is the input buffer (in 4 byte words). Default is 256, but this makes us less likely to drop data
57+
'binary_name' : 'espruino_%v_esp32s3.bin',
58+
'build' : {
59+
'optimizeflags' : '-Og',
60+
'libraries' : [
61+
'ESP32',
62+
'NET',
63+
'GRAPHICS',
64+
'CRYPTO','SHA256','SHA512',
65+
'TLS',
66+
'TELNET',
67+
'NEOPIXEL',
68+
'FILESYSTEM',
69+
# 'FLASHFS',
70+
'BLUETOOTH'
71+
],
72+
'makefile' : [
73+
'DEFINES+=-DESP_PLATFORM -DESP32=1',
74+
'DEFINES+=-DESP_STACK_SIZE=25000',
75+
'DEFINES+=-DJSVAR_MALLOC', # Allocate space for variables at jsvInit time
76+
'DEFINES+=-DUSE_FONT_6X8',
77+
'ESP32_FLASH_MAX=1572864'
78+
]
79+
}
80+
};
81+
82+
chip = {
83+
'part' : "ESP32S3",
84+
'family' : "ESP32_IDF4",
85+
'package' : "",
86+
'ram' : 512,
87+
'flash' : 0,
88+
'speed' : 240,
89+
'usart' : 3,
90+
'spi' : 2,
91+
'i2c' : 2,
92+
'adc' : 2,
93+
'dac' : 0,
94+
'saved_code' : {
95+
'address' : 0x320000,
96+
'page_size' : 4096,
97+
'pages' : 64,
98+
'flash_available' : 1344, # firmware can be up to this size - see partitions_espruino.csv
99+
},
100+
};
101+
devices = {
102+
'LED1' : { 'pin' : 'D2' },
103+
'BTN1' : { 'pin' : 'D0', "inverted":1, 'pinstate' : 'IN_PULLUP' }
104+
};
105+
106+
# left-right, or top-bottom order
107+
board_esp32 = {
108+
'top' : ['GND','D23','D22','D1','D3','D21','D20','D19','D18','D5','D17','D16','D4','D0'],
109+
'bottom' : ['D12','D14','D27','D26','D25','D33','D32','D35','D34','D39','D36','EN','3V3','GND'],
110+
'right' : [ 'GND','D13','D9','D10','D11','D6','D7','D8','D15','D2']
111+
};
112+
board_esp32["bottom"].reverse()
113+
board_esp32["right"].reverse()
114+
board_esp32["_css"] = """
115+
#board {
116+
width: 600px;
117+
height: 435px;
118+
left: 50px;
119+
top: 170px;
120+
background-image: url(img/ESP32.jpg);
121+
}
122+
#boardcontainer {
123+
height: 700px;
124+
}
125+
#board #right {
126+
top: 80px;
127+
left: 600px;
128+
}
129+
#board #top {
130+
bottom: 440px;
131+
left: 155px;
132+
}
133+
#board #bottom {
134+
top: 435px;
135+
left: 155px;
136+
}
137+
#board .rightpin {
138+
height: 28px;
139+
}
140+
#board .toppin, #board .bottompin {
141+
width: 24px;
142+
}
143+
""";
144+
145+
boards = [ board_esp32 ];
146+
147+
def get_pins():
148+
pins = pinutils.generate_pins(0,39) # 40 General Purpose I/O Pins.
149+
150+
# everything is non-5v tolerant
151+
#for pin in pins:
152+
# pin["functions"]["3.3"]=0;
153+
return pins

make/targets/ESP32_IDF4.make

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@ CMAKEFILE = $(BINDIR)/main/CMakeLists.txt
55
INCLUDE_WITHOUT_GEN = $(subst -Igen,,$(INCLUDE)) -I$(ROOT)/gen
66

77
ifeq ($(CHIP),ESP32C3)
8-
SDKCONFIG = sdkconfig_c3
9-
PORT ?= /dev/ttyACM0
8+
SDKCONFIG = sdkconfig_c3
9+
FMW_BIN_NAME = espruino-esp32c3
10+
PORT ?= /dev/ttyACM0
1011
else
11-
ifeq ($(CHIP),ESP32)
12-
SDKCONFIG = sdkconfig
13-
PORT ?= /dev/ttyUSB0
14-
else
15-
$(error Unknown ESP32 chip)
16-
endif
12+
ifeq ($(CHIP),ESP32)
13+
SDKCONFIG = sdkconfig
14+
FMW_BIN_NAME = espruino-esp32
15+
PORT ?= /dev/ttyUSB0
16+
else
17+
ifeq ($(CHIP),ESP32S3)
18+
SDKCONFIG = sdkconfig_s3
19+
FMW_BIN_NAME = espruino-esp32s3
20+
PORT ?= /dev/ttyUSB0
21+
else
22+
$(error Unknown ESP32 chip)
23+
endif
24+
endif
1725
endif
1826

1927
$(CMAKEFILE):
@@ -52,10 +60,12 @@ $(PROJ_NAME).bin: $(CMAKEFILE) $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h $(PININF
5260
$(ESP_ZIP): $(PROJ_NAME).bin
5361
$(Q)rm -rf $(PROJ_NAME)
5462
$(Q)mkdir -p $(PROJ_NAME)
55-
$(Q)cp $(PROJ_NAME).bin $(PROJ_NAME)/espruino-esp32c3.bin
63+
$(Q)cp $(PROJ_NAME).bin $(PROJ_NAME)/$(FMW_BIN_NAME).bin
5664
$(Q)cp $(BINDIR)/build/partition_table/partition-table.bin $(PROJ_NAME)/partition-table.bin
5765
$(Q)cp $(BINDIR)/build/bootloader/bootloader.bin $(PROJ_NAME)/bootloader.bin
66+
$(Q)cp targets/esp32/README_flash.txt $(PROJ_NAME)
5867
$(Q)cp targets/esp32/README_flash_C3.txt $(PROJ_NAME)
68+
$(Q)cp targets/esp32/README_flash_S3.txt $(PROJ_NAME)
5969
$(Q)$(TAR) -zcf $(ESP_ZIP) $(PROJ_NAME) --transform='s/$(BINDIR)\///g'
6070
@echo "Created $(ESP_ZIP)"
6171

scripts/provision.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ if [ "$PROVISION_ESP32_IDF4" = "1" ]; then
118118
echo installing esp-idf folder
119119
mkdir esp-idf-4
120120
cd esp-idf-4
121-
git clone -b v4.4.7 --recursive https://github.com/espressif/esp-idf.git
122-
esp-idf/install.sh
121+
git clone -b v4.4.8 --recursive https://github.com/espressif/esp-idf.git
122+
esp-idf/install.sh # RIC if not specifying the target, it installs all of them for now, selected targets are: esp32c3, esp32, esp32s2, esp32h2, esp32s3
123123
cd ..
124124
fi
125125
source esp-idf-4/esp-idf/export.sh

0 commit comments

Comments
 (0)