Skip to content

Add initial ESP32S2 support #2910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 83 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ jobs:
- name: New boards check
run: python3 -u ci_new_boards_check.py
working-directory: tools

- name: Build mpy-cross.static-raspbian
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
- uses: actions/[email protected]
Expand Down Expand Up @@ -359,3 +358,86 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
build-xtensa:
runs-on: ubuntu-latest
needs: test
strategy:
fail-fast: false
matrix:
board:
- "espressif_saola_1_wroom"
- "espressif_saola_1_wrover"

steps:
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
- run: git submodule sync
- run: git submodule foreach git remote -v
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
- name: CircuitPython version
run: git describe --dirty --tags
- uses: actions/cache@v1
name: Fetch IDF tool cache
id: idf-cache
with:
path: ${{ github.workspace }}/.idf_tools
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}
- name: Install IDF tools
if: steps.idf-cache.outputs.cache-hit != 'true'
run: |
$IDF_PATH/tools/idf_tools.py --non-interactive install required
$IDF_PATH/tools/idf_tools.py --non-interactive install cmake
$IDF_PATH/tools/idf_tools.py --non-interactive install-python-env
rm -rf $IDF_TOOLS_PATH/dist
env:
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
- name: Install CircuitPython deps
run: |
source $IDF_PATH/export.sh
pip install requests sh click setuptools awscli
sudo apt-get install -y gettext ninja-build
env:
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
- name: Versions
run: |
source $IDF_PATH/export.sh
gcc --version
xtensa-esp32s2-elf-gcc --version
python3 --version
ninja --version
cmake --version
shell: bash
env:
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
- name: mpy-cross
run: make -C mpy-cross -j2
- name: build
run: |
source $IDF_PATH/export.sh
python3 -u build_release_files.py
working-directory: tools
shell: bash
env:
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
BOARDS: ${{ matrix.board }}
- uses: actions/[email protected]
with:
name: ${{ matrix.board }}
path: bin/${{ matrix.board }}
- name: Upload to S3
run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@
[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"]
path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center
url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center
[submodule "ports/esp32s2/esp-idf"]
path = ports/esp32s2/esp-idf
url = https://github.com/tannewt/esp-idf.git
2 changes: 2 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
"ports/atmel-samd/tools",
"ports/cxd56/mkspk",
"ports/cxd56/spresense-exported-sdk",
"ports/esp32s2/esp-idf",
"ports/esp32s2/peripherals",
"ports/litex/hw",
"ports/minimal",
"ports/mimxrt10xx/peripherals",
Expand Down
2 changes: 1 addition & 1 deletion lib/tinyusb
Submodule tinyusb updated 40 files
+5 −2 .github/ISSUE_TEMPLATE/bug_report.md
+1 −0 docs/boards.md
+3 −0 examples/device/net_lwip_webserver/Makefile
+16 −4 examples/device/net_lwip_webserver/src/usb_descriptors.c
+3 −5 examples/make.mk
+2 −2 hw/bsp/adafruit_clue/board.mk
+2 −2 hw/bsp/arduino_nano33_ble/board.mk
+2 −2 hw/bsp/circuitplayground_bluefruit/board.mk
+2 −2 hw/bsp/feather_nrf52840_express/board.mk
+2 −2 hw/bsp/feather_nrf52840_sense/board.mk
+3 −0 hw/bsp/feather_stm32f405/board.mk
+2 −2 hw/bsp/nrf52840_mdk_dongle/board.mk
+0 −2 hw/bsp/nutiny_sdk_nuc505/board.mk
+2 −2 hw/bsp/pca10056/board.mk
+2 −2 hw/bsp/pca10059/board.mk
+2 −2 hw/bsp/pca10100/board.mk
+2 −2 hw/bsp/raytac_mdbt50q_rx/board.mk
+2 −2 hw/bsp/stm32f070rbnucleo/board.mk
+2 −2 hw/bsp/stm32f072disco/board.mk
+3 −0 hw/bsp/stm32f407disco/board.mk
+3 −0 hw/bsp/stm32f411disco/board.mk
+2 −2 hw/bsp/stm32f412disco/board.mk
+167 −0 hw/bsp/stm32f746nucleo/STM32F746ZGTx_FLASH.ld
+48 −0 hw/bsp/stm32f746nucleo/board.mk
+255 −0 hw/bsp/stm32f746nucleo/stm32f746nucleo.c
+472 −0 hw/bsp/stm32f746nucleo/stm32f7xx_hal_conf.h
+2 −2 hw/bsp/stm32f767nucleo/board.mk
+0 −1 hw/bsp/stm32h743nucleo/board.mk
+6 −1 hw/bsp/stm32l476disco/stm32l476disco.c
+5 −0 pkg.yml
+6 −3 src/common/tusb_common.h
+20 −1 src/common/tusb_compiler.h
+72 −39 src/common/tusb_fifo.c
+4 −1 src/device/usbd_control.c
+56 −70 src/portable/microchip/samg/dcd_samg.c
+19 −9 src/portable/nordic/nrf5x/dcd_nrf5x.c
+4 −1 src/portable/nuvoton/nuc505/dcd_nuc505.c
+4 −2 src/portable/nxp/transdimension/dcd_transdimension.c
+41 −38 src/portable/st/synopsys/dcd_synopsys.c
+84 −0 test/test/test_fifo.c
12 changes: 9 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,18 @@ void start_mp(supervisor_allocation* heap) {
// Stack limit should be less than real stack size, so we have a chance
// to recover from limit hit. (Limit is measured in bytes.)
mp_stack_ctrl_init();
mp_stack_set_limit(stack_alloc->length - 1024);

if (stack_alloc != NULL) {
mp_stack_set_limit(stack_alloc->length - 1024);
}


#if MICROPY_MAX_STACK_USAGE
// _ezero (same as _ebss) is an int, so start 4 bytes above it.
mp_stack_set_bottom(stack_alloc->ptr);
mp_stack_fill_with_sentinel();
if (stack_alloc != NULL) {
mp_stack_set_bottom(stack_alloc->ptr);
mp_stack_fill_with_sentinel();
}
#endif

// Sync the file systems in case any used RAM from the GC to cache. As soon
Expand Down
31 changes: 31 additions & 0 deletions ports/atmel-samd/boards/xinabox_cs11/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,34 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

// Turn off pins not in the board mapping to save space. They aren't broken out.
#define IGNORE_PIN_PA00 1
#define IGNORE_PIN_PA01 1
#define IGNORE_PIN_PA02 1
#define IGNORE_PIN_PA03 1

#define IGNORE_PIN_PB08 1
#define IGNORE_PIN_PB09 1

#define IGNORE_PIN_PA04 1
#define IGNORE_PIN_PA05 1
#define IGNORE_PIN_PA06 1
#define IGNORE_PIN_PA08 1

#define IGNORE_PIN_PA13 1
#define IGNORE_PIN_PA14 1
#define IGNORE_PIN_PA15 1
#define IGNORE_PIN_PA18 1
#define IGNORE_PIN_PA20 1
#define IGNORE_PIN_PA21 1

#define IGNORE_PIN_PB22 1
#define IGNORE_PIN_PB23 1

#define IGNORE_PIN_PA27 1
#define IGNORE_PIN_PA28 1
#define IGNORE_PIN_PA30 1
#define IGNORE_PIN_PA31 1
#define IGNORE_PIN_PB02 1
#define IGNORE_PIN_PB03 1
3 changes: 1 addition & 2 deletions ports/atmel-samd/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
#define MICROPY_PY_FUNCTION_ATTRS (0)
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
#define MICROPY_PY_IO (0)
#define MICROPY_PY_UJSON (0)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
#define MICROPY_PY_UJSON (0)
#define MICROPY_PY_UERRNO_LIST \
X(EPERM) \
X(ENOENT) \
Expand Down Expand Up @@ -79,7 +79,6 @@
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
#define MICROPY_PY_IO (1)
#define MICROPY_PY_UJSON (1)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
// MICROPY_PY_UERRNO_LIST - Use the default

#endif // SAMD51
Expand Down
4 changes: 4 additions & 0 deletions ports/atmel-samd/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ void reset_cpu(void) {
reset();
}

supervisor_allocation* port_fixed_stack(void) {
return NULL;
}

uint32_t *port_stack_get_limit(void) {
return &_ebss;
}
Expand Down
4 changes: 4 additions & 0 deletions ports/cxd56/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ void reset_port(void) {
void reset_to_bootloader(void) {
}

supervisor_allocation* port_fixed_stack(void) {
return NULL;
}

uint32_t *port_stack_get_limit(void) {
struct tcb_s *rtcb = this_task();

Expand Down
2 changes: 2 additions & 0 deletions ports/esp32s2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build*
sdkconfig.old
11 changes: 11 additions & 0 deletions ports/esp32s2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)
set(COMPONENTS esptool_py soc driver log main)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(circuitpython)

idf_build_set_property(__OUTPUT_SDKCONFIG 0)
Loading