Skip to content

Commit 916ca9f

Browse files
authored
Merge pull request #2910 from tannewt/esp32s2
Add initial ESP32S2 support
2 parents bdc5a6b + acf4b1b commit 916ca9f

Some content is hidden

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

71 files changed

+3331
-24
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
@@ -138,6 +138,8 @@
138138
"ports/atmel-samd/tools",
139139
"ports/cxd56/mkspk",
140140
"ports/cxd56/spresense-exported-sdk",
141+
"ports/esp32s2/esp-idf",
142+
"ports/esp32s2/peripherals",
141143
"ports/litex/hw",
142144
"ports/minimal",
143145
"ports/mimxrt10xx/peripherals",

lib/tinyusb

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/boards/xinabox_cs11/mpconfigboard.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,34 @@
2222
// USB is always used internally so skip the pin objects for it.
2323
#define IGNORE_PIN_PA24 1
2424
#define IGNORE_PIN_PA25 1
25+
26+
// Turn off pins not in the board mapping to save space. They aren't broken out.
27+
#define IGNORE_PIN_PA00 1
28+
#define IGNORE_PIN_PA01 1
29+
#define IGNORE_PIN_PA02 1
30+
#define IGNORE_PIN_PA03 1
31+
32+
#define IGNORE_PIN_PB08 1
33+
#define IGNORE_PIN_PB09 1
34+
35+
#define IGNORE_PIN_PA04 1
36+
#define IGNORE_PIN_PA05 1
37+
#define IGNORE_PIN_PA06 1
38+
#define IGNORE_PIN_PA08 1
39+
40+
#define IGNORE_PIN_PA13 1
41+
#define IGNORE_PIN_PA14 1
42+
#define IGNORE_PIN_PA15 1
43+
#define IGNORE_PIN_PA18 1
44+
#define IGNORE_PIN_PA20 1
45+
#define IGNORE_PIN_PA21 1
46+
47+
#define IGNORE_PIN_PB22 1
48+
#define IGNORE_PIN_PB23 1
49+
50+
#define IGNORE_PIN_PA27 1
51+
#define IGNORE_PIN_PA28 1
52+
#define IGNORE_PIN_PA30 1
53+
#define IGNORE_PIN_PA31 1
54+
#define IGNORE_PIN_PB02 1
55+
#define IGNORE_PIN_PB03 1

ports/atmel-samd/mpconfigport.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
#define MICROPY_PY_FUNCTION_ATTRS (0)
4848
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
4949
#define MICROPY_PY_IO (0)
50-
#define MICROPY_PY_UJSON (0)
5150
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
51+
#define MICROPY_PY_UJSON (0)
5252
#define MICROPY_PY_UERRNO_LIST \
5353
X(EPERM) \
5454
X(ENOENT) \
@@ -79,7 +79,6 @@
7979
// MICROPY_PY_UJSON depends on MICROPY_PY_IO
8080
#define MICROPY_PY_IO (1)
8181
#define MICROPY_PY_UJSON (1)
82-
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
8382
// MICROPY_PY_UERRNO_LIST - Use the default
8483

8584
#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/cxd56/supervisor/port.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ void reset_port(void) {
7676
void reset_to_bootloader(void) {
7777
}
7878

79+
supervisor_allocation* port_fixed_stack(void) {
80+
return NULL;
81+
}
82+
7983
uint32_t *port_stack_get_limit(void) {
8084
struct tcb_s *rtcb = this_task();
8185

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

0 commit comments

Comments
 (0)