Skip to content

Commit 1ee032a

Browse files
committed
Add support for CMake, ESP32-S2 and IDF master
1 parent fe8eeb0 commit 1ee032a

29 files changed

+5053
-1308
lines changed

.github/workflows/cron.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
idf_branch: [release/v3.3]
24-
#idf_branch: [release/v3.3, release/v4.0]
23+
idf_branch: [master, release/v3.3]
2524
steps:
2625
- uses: actions/checkout@v1
2726
- name: Install dependencies
28-
run: bash ./tools/prepare-ci.sh
27+
run: sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache
28+
- name: Install Python Wheel
29+
run: pip install wheel
2930
- name: Build
3031
env:
3132
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}

.github/workflows/push.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v1
1616
- name: Install dependencies
17-
run: bash ./tools/prepare-ci.sh
17+
run: sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache
18+
- name: Install Python Wheel
19+
run: pip install wheel
1820
- name: Build Arduino Libs
1921
run: bash ./build.sh
2022
- name: Upload archive

.github/workflows/repository_dispatch.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v1
1111
- name: Install dependencies
12-
run: bash ./tools/prepare-ci.sh
12+
run: sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache
13+
- name: Install Python Wheel
14+
run: pip install wheel
1315
- name: Handle Event
1416
env:
1517
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}

.gitignore

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
sdkconfig.old
21
.DS_Store
2+
.vscode
33
components/arduino/
44
components/esp-face/
55
components/esp32-camera/
6+
components/esp_littlefs/
7+
components/esp-rainmaker/
8+
components/esp-dsp/
69
esp-idf/
710
out/
811
build/
9-
xtensa-esp32-elf/
1012
dist/
13+
env.sh
14+
sdkconfig
15+
sdkconfig.old
16+
version.txt
17+
components/arduino_tinyusb/tinyusb/

CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# The following 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+
if(IDF_TARGET STREQUAL "esp32")
6+
set(EXTRA_COMPONENT_DIRS ${CMAKE_SOURCE_DIR}/components/esp-rainmaker/components)
7+
endif()
8+
9+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
10+
project(arduino-lib-builder)
11+
12+
add_custom_command(
13+
OUTPUT "idf_libs"
14+
COMMAND ${CMAKE_SOURCE_DIR}/tools/prepare-libs.sh ${IDF_TARGET}
15+
DEPENDS gen_project_binary bootloader partition_table
16+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
17+
VERBATIM
18+
)
19+
add_custom_target(idf-libs ALL DEPENDS "idf_libs")

Makefile

-17
This file was deleted.

build.sh

+17-42
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,6 @@ if ! [ -x "$(command -v git)" ]; then
1010
exit 1
1111
fi
1212

13-
if ! [ -x "$(command -v make)" ]; then
14-
echo "ERROR: Make is not installed! Please install Make first."
15-
exit 1
16-
fi
17-
18-
if ! [ -x "$(command -v flex)" ]; then
19-
echo "ERROR: flex is not installed! Please install flex first."
20-
exit 1
21-
fi
22-
23-
if ! [ -x "$(command -v bison)" ]; then
24-
echo "ERROR: bison is not installed! Please install bison first."
25-
exit 1
26-
fi
27-
28-
if ! [ -x "$(command -v gperf)" ]; then
29-
echo "ERROR: gperf is not installed! Please install gperf first."
30-
exit 1
31-
fi
32-
33-
if ! [ -x "$(command -v stat)" ]; then
34-
echo "ERROR: stat is not installed! Please install stat first."
35-
exit 1
36-
fi
37-
38-
awk="awk"
39-
if [[ "$OSTYPE" == "darwin"* ]]; then
40-
awk="gawk"
41-
fi
42-
43-
if ! [ -x "$(command -v $awk)" ]; then
44-
echo "ERROR: $awk is not installed! Please install $awk first."
45-
exit 1
46-
fi
47-
4813
mkdir -p dist
4914

5015
# update components from git
@@ -55,17 +20,27 @@ if [ $? -ne 0 ]; then exit 1; fi
5520
source ./tools/install-esp-idf.sh
5621
if [ $? -ne 0 ]; then exit 1; fi
5722

58-
# build and prepare libs
59-
./tools/build-libs.sh
60-
if [ $? -ne 0 ]; then exit 1; fi
23+
TARGETS="esp32s2 esp32"
6124

62-
# bootloader
63-
./tools/build-bootloaders.sh
64-
if [ $? -ne 0 ]; then exit 1; fi
25+
echo $(git -C $AR_COMPS/arduino describe --all --long) > version.txt
26+
27+
rm -rf out build sdkconfig sdkconfig.old
28+
29+
for target in $TARGETS; do
30+
# configure the build for the target
31+
rm -rf build sdkconfig sdkconfig.old
32+
cp "sdkconfig.$target" sdkconfig
33+
# build and prepare libs
34+
idf.py build
35+
if [ $? -ne 0 ]; then exit 1; fi
36+
cp sdkconfig "sdkconfig.$target"
37+
# build bootloaders
38+
./tools/build-bootloaders.sh
39+
if [ $? -ne 0 ]; then exit 1; fi
40+
done
6541

6642
# archive the build
6743
./tools/archive-build.sh
6844
if [ $? -ne 0 ]; then exit 1; fi
6945

70-
# POST Build
7146
#./tools/copy-to-arduino.sh
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
idf_component_register(REQUIRES esp_rom freertos soc PRIV_REQUIRES arduino main)
2+
3+
if(CONFIG_TINYUSB_ENABLED)
4+
5+
### variables ###
6+
#################
7+
set(compile_options
8+
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
9+
"-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}"
10+
"-Wno-type-limits" # needed for the vanila tinyusb with turned off classes
11+
)
12+
idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos
13+
ORIG_INCLUDE_PATH)
14+
set(includes_private
15+
# tusb:
16+
"${COMPONENT_DIR}/tinyusb/hw/bsp/"
17+
"${COMPONENT_DIR}/tinyusb/src/"
18+
"${COMPONENT_DIR}/tinyusb/src/device"
19+
)
20+
21+
set(includes_public
22+
# tusb:
23+
"${FREERTOS_ORIG_INCLUDE_PATH}"
24+
"${COMPONENT_DIR}/tinyusb/src/"
25+
# espressif:
26+
"${COMPONENT_DIR}/include")
27+
set(srcs
28+
# espressif:
29+
"${COMPONENT_DIR}/src/dcd_esp32s2.c"
30+
# tusb:
31+
#"${COMPONENT_DIR}/tinyusb/src/portable/espressif/esp32s2/dcd_esp32s2.c"
32+
"${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c"
33+
"${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c"
34+
"${COMPONENT_DIR}/tinyusb/src/class/midi/midi_device.c"
35+
"${COMPONENT_DIR}/tinyusb/src/class/msc/msc_device.c"
36+
"${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_rt_device.c"
37+
"${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c"
38+
"${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c"
39+
"${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c"
40+
"${COMPONENT_DIR}/tinyusb/src/device/usbd.c"
41+
"${COMPONENT_DIR}/tinyusb/src/tusb.c")
42+
43+
### tinyusb lib ###
44+
###################
45+
add_library(arduino_tinyusb STATIC ${srcs})
46+
target_include_directories(
47+
arduino_tinyusb
48+
PUBLIC ${includes_public}
49+
PRIVATE ${includes_private})
50+
target_compile_options(arduino_tinyusb PRIVATE ${compile_options})
51+
target_link_libraries(${COMPONENT_TARGET} INTERFACE arduino_tinyusb)
52+
53+
endif()

0 commit comments

Comments
 (0)