Skip to content

Commit

Permalink
Merge pull request #2541 from rgomezwap/Add-ESP32_S3
Browse files Browse the repository at this point in the history
Add esp32 s3
  • Loading branch information
gfwilliams authored Aug 27, 2024
2 parents 2cb2bf3 + d6d9fa9 commit e3df9e9
Show file tree
Hide file tree
Showing 8 changed files with 2,204 additions and 34 deletions.
153 changes: 153 additions & 0 deletions boards/ESP32S3_IDF4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <[email protected]>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# ----------------------------------------------------------------------------------------
# This file contains information for a specific board - the available pins, and where LEDs,
# Buttons, and other in-built peripherals are. It is used to build documentation as well
# as various source and header files for Espruino.
# ----------------------------------------------------------------------------------------

# ###########################################################
# # THIS IS BETA - IDF4 SUPPORT IS NOT READY YET #
# ###########################################################

# A Note about the 'variables' parameter on ESP32 Builds
# ------------------------------------------------------
#
# For the ESP32 build, the number of JsVars is governed by two factors:
# * Available memory
# * Maximum number of JsVars for the used JsVar format
#
# This setting will chose the optimum JsVar format for a given number
# of JsVars.

# If you add PSRAM to your ESP32 or compile with modules removed, you
# may wish to select a value using this table:
#
# Value | Max JsVars | Bytes per JsVar | Maximum References |
# ------+--------------+-----------------+--------------------+
# 4095 | 4095 | 13 | 255 |
# 8191 | 8191 | 13 | 15 |
# 16383 | 16383 | 14 | 255 |
# 65535 | 65535 | 16 | 255 |
# ------+--------------+-----------------+--------------------+

# CAUTION: Chosing 8191 only allows 15 references to a variable. This
# may be too restrictive to run some code.

# Using too large a JsVar format may limit how many JsVars can fit into
# available memory. Using too small a JsVar format will under utilise
# available memory.


import pinutils;
info = {
'name' : "ESP32S3",
'espruino_page_link' : 'ESP32',
'default_console' : "EV_SERIAL1",
'default_console_baudrate' : "115200",
'variables' : 16383, # See note above
'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
'binary_name' : 'espruino_%v_esp32s3.bin',
'build' : {
'optimizeflags' : '-Og',
'libraries' : [
'ESP32',
'NET',
'GRAPHICS',
'CRYPTO','SHA256','SHA512',
'TLS',
'TELNET',
'NEOPIXEL',
'FILESYSTEM',
# 'FLASHFS',
'BLUETOOTH'
],
'makefile' : [
'DEFINES+=-DESP_PLATFORM -DESP32=1',
'DEFINES+=-DESP_STACK_SIZE=25000',
'DEFINES+=-DJSVAR_MALLOC', # Allocate space for variables at jsvInit time
'DEFINES+=-DUSE_FONT_6X8',
'ESP32_FLASH_MAX=1572864'
]
}
};

chip = {
'part' : "ESP32S3",
'family' : "ESP32_IDF4",
'package' : "",
'ram' : 512,
'flash' : 0,
'speed' : 240,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 2,
'dac' : 0,
'saved_code' : {
'address' : 0x320000,
'page_size' : 4096,
'pages' : 64,
'flash_available' : 1344, # firmware can be up to this size - see partitions_espruino.csv
},
};
devices = {
'LED1' : { 'pin' : 'D2' },
'BTN1' : { 'pin' : 'D0', "inverted":1, 'pinstate' : 'IN_PULLUP' }
};

# left-right, or top-bottom order
board_esp32 = {
'top' : ['GND','D23','D22','D1','D3','D21','D20','D19','D18','D5','D17','D16','D4','D0'],
'bottom' : ['D12','D14','D27','D26','D25','D33','D32','D35','D34','D39','D36','EN','3V3','GND'],
'right' : [ 'GND','D13','D9','D10','D11','D6','D7','D8','D15','D2']
};
board_esp32["bottom"].reverse()
board_esp32["right"].reverse()
board_esp32["_css"] = """
#board {
width: 600px;
height: 435px;
left: 50px;
top: 170px;
background-image: url(img/ESP32.jpg);
}
#boardcontainer {
height: 700px;
}
#board #right {
top: 80px;
left: 600px;
}
#board #top {
bottom: 440px;
left: 155px;
}
#board #bottom {
top: 435px;
left: 155px;
}
#board .rightpin {
height: 28px;
}
#board .toppin, #board .bottompin {
width: 24px;
}
""";

boards = [ board_esp32 ];

def get_pins():
pins = pinutils.generate_pins(0,39) # 40 General Purpose I/O Pins.

# everything is non-5v tolerant
#for pin in pins:
# pin["functions"]["3.3"]=0;
return pins
28 changes: 19 additions & 9 deletions make/targets/ESP32_IDF4.make
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@ CMAKEFILE = $(BINDIR)/main/CMakeLists.txt
INCLUDE_WITHOUT_GEN = $(subst -Igen,,$(INCLUDE)) -I$(ROOT)/gen

ifeq ($(CHIP),ESP32C3)
SDKCONFIG = sdkconfig_c3
PORT ?= /dev/ttyACM0
SDKCONFIG = sdkconfig_c3
FMW_BIN_NAME = espruino-esp32c3
PORT ?= /dev/ttyACM0
else
ifeq ($(CHIP),ESP32)
SDKCONFIG = sdkconfig
PORT ?= /dev/ttyUSB0
else
$(error Unknown ESP32 chip)
endif
ifeq ($(CHIP),ESP32)
SDKCONFIG = sdkconfig
FMW_BIN_NAME = espruino-esp32
PORT ?= /dev/ttyUSB0
else
ifeq ($(CHIP),ESP32S3)
SDKCONFIG = sdkconfig_s3
FMW_BIN_NAME = espruino-esp32s3
PORT ?= /dev/ttyUSB0
else
$(error Unknown ESP32 chip)
endif
endif
endif

$(CMAKEFILE):
Expand Down Expand Up @@ -52,10 +60,12 @@ $(PROJ_NAME).bin: $(CMAKEFILE) $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h $(PININF
$(ESP_ZIP): $(PROJ_NAME).bin
$(Q)rm -rf $(PROJ_NAME)
$(Q)mkdir -p $(PROJ_NAME)
$(Q)cp $(PROJ_NAME).bin $(PROJ_NAME)/espruino-esp32c3.bin
$(Q)cp $(PROJ_NAME).bin $(PROJ_NAME)/$(FMW_BIN_NAME).bin
$(Q)cp $(BINDIR)/build/partition_table/partition-table.bin $(PROJ_NAME)/partition-table.bin
$(Q)cp $(BINDIR)/build/bootloader/bootloader.bin $(PROJ_NAME)/bootloader.bin
$(Q)cp targets/esp32/README_flash.txt $(PROJ_NAME)
$(Q)cp targets/esp32/README_flash_C3.txt $(PROJ_NAME)
$(Q)cp targets/esp32/README_flash_S3.txt $(PROJ_NAME)
$(Q)$(TAR) -zcf $(ESP_ZIP) $(PROJ_NAME) --transform='s/$(BINDIR)\///g'
@echo "Created $(ESP_ZIP)"

Expand Down
4 changes: 2 additions & 2 deletions scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ if [ "$PROVISION_ESP32_IDF4" = "1" ]; then
echo installing esp-idf folder
mkdir esp-idf-4
cd esp-idf-4
git clone -b v4.4.7 --recursive https://github.com/espressif/esp-idf.git
esp-idf/install.sh
git clone -b v4.4.8 --recursive https://github.com/espressif/esp-idf.git
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
cd ..
fi
source esp-idf-4/esp-idf/export.sh
Expand Down
Loading

0 comments on commit e3df9e9

Please sign in to comment.