Skip to content

Commit 6aaab00

Browse files
committed
Initial ESP32S2 port.
Basic blinky works but doesn't check pins.
1 parent 0d8bca9 commit 6aaab00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3279
-22
lines changed

.github/workflows/build.yml

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ jobs:
7373
- name: New boards check
7474
run: python3 -u ci_new_boards_check.py
7575
working-directory: tools
76-
7776
- name: Build mpy-cross.static-raspbian
7877
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
7978
- uses: actions/[email protected]
@@ -359,3 +358,86 @@ jobs:
359358
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
360359
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
361360
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
361+
build-xtensa:
362+
runs-on: ubuntu-latest
363+
needs: test
364+
strategy:
365+
fail-fast: false
366+
matrix:
367+
board:
368+
- "espressif_saola_1_wroom"
369+
- "espressif_saola_1_wrover"
370+
371+
steps:
372+
- name: Set up Python 3.8
373+
uses: actions/setup-python@v1
374+
with:
375+
python-version: 3.8
376+
- uses: actions/checkout@v2
377+
with:
378+
submodules: true
379+
fetch-depth: 0
380+
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
381+
- run: git submodule sync
382+
- run: git submodule foreach git remote -v
383+
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
384+
- name: CircuitPython version
385+
run: git describe --dirty --tags
386+
- uses: actions/cache@v1
387+
name: Fetch IDF tool cache
388+
id: idf-cache
389+
with:
390+
path: ${{ github.workspace }}/.idf_tools
391+
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}
392+
- name: Install IDF tools
393+
if: steps.idf-cache.outputs.cache-hit != 'true'
394+
run: |
395+
$IDF_PATH/tools/idf_tools.py --non-interactive install required
396+
$IDF_PATH/tools/idf_tools.py --non-interactive install cmake
397+
$IDF_PATH/tools/idf_tools.py --non-interactive install-python-env
398+
rm -rf $IDF_TOOLS_PATH/dist
399+
env:
400+
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
401+
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
402+
- name: Install CircuitPython deps
403+
run: |
404+
source $IDF_PATH/export.sh
405+
pip install requests sh click setuptools awscli
406+
sudo apt-get install -y gettext ninja-build
407+
env:
408+
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
409+
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
410+
- name: Versions
411+
run: |
412+
source $IDF_PATH/export.sh
413+
gcc --version
414+
xtensa-esp32s2-elf-gcc --version
415+
python3 --version
416+
ninja --version
417+
cmake --version
418+
shell: bash
419+
env:
420+
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
421+
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
422+
- name: mpy-cross
423+
run: make -C mpy-cross -j2
424+
- name: build
425+
run: |
426+
source $IDF_PATH/export.sh
427+
python3 -u build_release_files.py
428+
working-directory: tools
429+
shell: bash
430+
env:
431+
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
432+
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
433+
BOARDS: ${{ matrix.board }}
434+
- uses: actions/[email protected]
435+
with:
436+
name: ${{ matrix.board }}
437+
path: bin/${{ matrix.board }}
438+
- name: Upload to S3
439+
run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1"
440+
env:
441+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
442+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
443+
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,6 @@
140140
[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"]
141141
path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center
142142
url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center
143+
[submodule "ports/esp32s2/esp-idf"]
144+
path = ports/esp32s2/esp-idf
145+
url = https://github.com/tannewt/esp-idf.git

conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@
136136
"ports/atmel-samd/tools",
137137
"ports/cxd56/mkspk",
138138
"ports/cxd56/spresense-exported-sdk",
139+
"ports/esp32s2/esp-idf",
140+
"ports/esp32s2/peripherals",
139141
"ports/litex/hw",
140142
"ports/minimal",
141143
"ports/mimxrt10xx/peripherals",

main.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,18 @@ void start_mp(supervisor_allocation* heap) {
105105
// Stack limit should be less than real stack size, so we have a chance
106106
// to recover from limit hit. (Limit is measured in bytes.)
107107
mp_stack_ctrl_init();
108-
mp_stack_set_limit(stack_alloc->length - 1024);
108+
109+
if (stack_alloc != NULL) {
110+
mp_stack_set_limit(stack_alloc->length - 1024);
111+
}
112+
109113

110114
#if MICROPY_MAX_STACK_USAGE
111115
// _ezero (same as _ebss) is an int, so start 4 bytes above it.
112-
mp_stack_set_bottom(stack_alloc->ptr);
113-
mp_stack_fill_with_sentinel();
116+
if (stack_alloc != NULL) {
117+
mp_stack_set_bottom(stack_alloc->ptr);
118+
mp_stack_fill_with_sentinel();
119+
}
114120
#endif
115121

116122
// Sync the file systems in case any used RAM from the GC to cache. As soon

ports/atmel-samd/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
4949
#define MICROPY_PY_IO (0)
5050
#define MICROPY_PY_UJSON (0)
51-
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
5251
#define MICROPY_PY_UERRNO_LIST \
5352
X(EPERM) \
5453
X(ENOENT) \
@@ -79,7 +78,6 @@
7978
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
8079
#define MICROPY_PY_IO (1)
8180
#define MICROPY_PY_UJSON (1)
82-
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
8381
// MICROPY_PY_UERRNO_LIST - Use the default
8482

8583
#endif // SAMD51

ports/atmel-samd/supervisor/port.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ void reset_cpu(void) {
361361
reset();
362362
}
363363

364+
supervisor_allocation* port_fixed_stack(void) {
365+
return NULL;
366+
}
367+
364368
uint32_t *port_stack_get_limit(void) {
365369
return &_ebss;
366370
}

ports/esp32s2/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build*
2+
sdkconfig.old

ports/esp32s2/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# The following five lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
5+
set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)
6+
set(COMPONENTS esptool_py soc driver log main)
7+
8+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
9+
project(circuitpython)
10+
11+
idf_build_set_property(__OUTPUT_SDKCONFIG 0)

0 commit comments

Comments
 (0)