Tactility SDK and release build scripting (#122)
* Implement release scripting and SDK building process * Fix for CYD display colors * Various improvements and fixes * Made build scripts more modular
This commit is contained in:
committed by
GitHub
parent
43714b2355
commit
a18221db08
@@ -0,0 +1,17 @@
|
||||
idf_component_register(
|
||||
INCLUDE_DIRS "Libraries/Tactility/Include" "Libraries/lvgl/Include"
|
||||
)
|
||||
|
||||
add_prebuilt_library(Tactility Libraries/Tactility/Binary/libTactility.a)
|
||||
add_prebuilt_library(TactilityC Libraries/Tactility/Binary/libTactilityC.a)
|
||||
add_prebuilt_library(TactilityCore Libraries/Tactility/Binary/libTactilityCore.a)
|
||||
add_prebuilt_library(TactilityHeadless Libraries/Tactility/Binary/libTactilityHeadless.a)
|
||||
add_prebuilt_library(elf_loader Libraries/elf_loader/Binary/libelf_loader.a)
|
||||
add_prebuilt_library(lvgl Libraries/lvgl/Binary/liblvgl.a)
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC)
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE Tactility)
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityHeadless)
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityCore)
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl)
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE elf_loader)
|
||||
@@ -0,0 +1,19 @@
|
||||
function(tactility_project)
|
||||
endfunction()
|
||||
|
||||
function(_tactility_project)
|
||||
endfunction()
|
||||
|
||||
macro(tactility_project project_name)
|
||||
set(TACTILITY_SKIP_SPIFFS 1)
|
||||
add_definitions(-DESP_TARGET)
|
||||
add_compile_definitions(ESP_TARGET)
|
||||
|
||||
include("${TACTILITY_SDK_PATH}/Libraries/elf_loader/elf_loader.cmake")
|
||||
project_elf($project_name)
|
||||
|
||||
file(READ ${TACTILITY_SDK_PATH}/idf-version.txt TACTILITY_SDK_IDF_VERSION)
|
||||
if (NOT "$ENV{ESP_IDF_VERSION}" STREQUAL "${TACTILITY_SDK_IDF_VERSION}")
|
||||
message(FATAL_ERROR "ESP-IDF version of Tactility SDK (${TACTILITY_SDK_IDF_VERSION}) does not match current ESP-IDF version ($ENV{ESP_IDF_VERSION})")
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -0,0 +1,20 @@
|
||||
param(
|
||||
$port
|
||||
)
|
||||
|
||||
if ((Get-Command "esptool.py" -ErrorAction SilentlyContinue) -eq $null)
|
||||
{
|
||||
Write-Host "Unable to find esptool.py in your path. Make sure you have Python installed and on your path. Then run `pip install esptool`."
|
||||
}
|
||||
|
||||
|
||||
# Create flash command based on partitions
|
||||
$json = Get-Content .\build\flasher_args.json -Raw | ConvertFrom-Json
|
||||
$jsonClean = $json.flash_files -replace '[\{\}\@\;]', ''
|
||||
$jsonClean = $jsonClean -replace '[\=]', ' '
|
||||
|
||||
cd Binaries
|
||||
$command = "esptool.py --connect-attemps 10 --port $port -b 460800 write_flash $jsonClean"
|
||||
Invoke-Expression $command
|
||||
cd ..
|
||||
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage:
|
||||
# flash.sh [port]
|
||||
#
|
||||
# Arguments:
|
||||
# port - the port of the device (e.g. /dev/ttyUSB0, ...)
|
||||
#
|
||||
# Requirements:
|
||||
# jq - run 'pip install jq'
|
||||
# esptool.py - run 'pip install esptool'
|
||||
#
|
||||
# Documentation:
|
||||
# https://docs.espressif.com/projects/esptool/en/latest/esp32/
|
||||
#
|
||||
|
||||
# Source: https://stackoverflow.com/a/53798785
|
||||
function is_bin_in_path {
|
||||
builtin type -P "$1" &> /dev/null
|
||||
}
|
||||
|
||||
function require_bin {
|
||||
program=$1
|
||||
tip=$2
|
||||
if ! is_bin_in_path $program; then
|
||||
echo -e "\e[31m⚠️ $program not found!\n\t$tip\e[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
require_bin esptool.py "install esptool from your package manager or install python and run 'pip install esptool'"
|
||||
require_bin jq "install jq from your package manager or install python and run 'pip install jq'"
|
||||
|
||||
if [[ $1 -eq 0 ]]; then
|
||||
echo -e "\e[31m⚠️ Must Specify port as argument. For example:\n\tflash.sh /dev/ttyACM0\n\tflash.sh /dev/ttyUSB0\e[0m"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
cd Binaries
|
||||
# Create flash command based on partitions
|
||||
KEY_VALUES=`jq -r '.flash_files | keys[] as $k | "\($k) \(.[$k])"' flasher_args.json | tr "\n" " "`
|
||||
esptool.py --port $1 --connect-attempts 10 -b 460800 write_flash $KEY_VALUES
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
function build() {
|
||||
Buildscripts/build.sh $1
|
||||
}
|
||||
|
||||
function release() {
|
||||
Buildscripts/release.sh $1
|
||||
}
|
||||
|
||||
function releaseSdk() {
|
||||
Buildscripts/release-sdk.sh $1
|
||||
}
|
||||
|
||||
SECONDS=0
|
||||
|
||||
build lilygo_tdeck
|
||||
release lilygo_tdeck
|
||||
|
||||
releaseSdk release/Tactility-ESP32S3-SDK/TactilitySDK
|
||||
|
||||
build yellow_board
|
||||
release yellow_board
|
||||
|
||||
releaseSdk release/Tactility-ESP32-SDK/TactilitySDK
|
||||
|
||||
build m5stack_core2
|
||||
release m5stack_core2
|
||||
|
||||
build m5stack_cores3
|
||||
release m5stack_cores3
|
||||
|
||||
duration=$SECONDS
|
||||
|
||||
echo "Finished in $((duration / 60)) minutes and $((duration % 60)) seconds."
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Usage: build.sh [boardname]
|
||||
# Example: build.sh lilygo_tdeck
|
||||
# Description: Makes a clean build for the specified board.
|
||||
#
|
||||
|
||||
echoNewPhase() {
|
||||
echo -e "⏳ \e[36m${1}\e[0m"
|
||||
}
|
||||
|
||||
fatalError() {
|
||||
echo -e "⚠️ \e[31m${1}\e[0m"
|
||||
exit 0
|
||||
}
|
||||
|
||||
sdkconfig_file="sdkconfig.board.${1}"
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
fatalError "Must pass board name as first argument. (e.g. lilygo_tdeck)"
|
||||
fi
|
||||
|
||||
if [ ! -f $sdkconfig_file ]; then
|
||||
fatalError "Board not found: ${sdkconfig_file}"
|
||||
fi
|
||||
|
||||
echoNewPhase "Cleaning build folder"
|
||||
|
||||
rm -rf build
|
||||
|
||||
echoNewPhase "Building $sdkconfig_file"
|
||||
|
||||
cp $sdkconfig_file sdkconfig
|
||||
if not idf.py build; then
|
||||
fatalError "Failed to build esp32s3 SDK"
|
||||
fi
|
||||
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -rf build
|
||||
rm -rf build-sim
|
||||
rm -rf cmake-*
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Description: Releases the current build files as an SDK in the specified folder.
|
||||
# This deployment is used when compiling apps in ./ExternalApps
|
||||
#
|
||||
|
||||
./Buildscripts/release-sdk.sh release/TactilitySDK
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
#
|
||||
# Usage: release-sdk.sh [target_path]
|
||||
# Example: release.sh release/TactilitySDK
|
||||
# Description: Releases the current build files as an SDK in the specified folder.
|
||||
#
|
||||
|
||||
target_path=$1
|
||||
|
||||
mkdir -p $target_path
|
||||
|
||||
build_dir=`pwd`
|
||||
library_path=$target_path/Libraries
|
||||
|
||||
cp version.txt $target_path
|
||||
|
||||
# Tactility
|
||||
tactility_library_path=$library_path/Tactility
|
||||
mkdir -p $tactility_library_path/Binary
|
||||
cp build/esp-idf/Tactility/libTactility.a $tactility_library_path/Binary/
|
||||
cp build/esp-idf/TactilityCore/libTactilityCore.a $tactility_library_path/Binary/
|
||||
cp build/esp-idf/TactilityHeadless/libTactilityHeadless.a $tactility_library_path/Binary/
|
||||
cp build/esp-idf/TactilityC/libTactilityC.a $tactility_library_path/Binary/
|
||||
mkdir -p $tactility_library_path/Include
|
||||
find_target_dir=$build_dir/$tactility_library_path/Include/
|
||||
cd TactilityC/Source
|
||||
echo To $find_target_dir
|
||||
find -name '*.h' | cpio -pdm $find_target_dir
|
||||
cd -
|
||||
|
||||
# lvgl
|
||||
lvgl_library_path=$library_path/lvgl
|
||||
mkdir -p $lvgl_library_path/Binary
|
||||
mkdir -p $lvgl_library_path/Include
|
||||
cp build/esp-idf/lvgl/liblvgl.a $lvgl_library_path/Binary/
|
||||
find_target_dir=$build_dir/$lvgl_library_path/Include/
|
||||
cd Libraries/lvgl
|
||||
find src/ -name '*.h' | cpio -pdm $find_target_dir
|
||||
cd -
|
||||
cp Libraries/lvgl/lvgl.h $find_target_dir
|
||||
cp Libraries/lvgl_conf/lv_conf_kconfig.h $lvgl_library_path/Include/lv_conf.h
|
||||
|
||||
# elf_loader
|
||||
elf_loader_library_path=$library_path/elf_loader
|
||||
mkdir -p $elf_loader_library_path/Binary
|
||||
cp -r Libraries/elf_loader/elf_loader.cmake $elf_loader_library_path
|
||||
cp -r build/esp-idf/elf_loader/libelf_loader.a $elf_loader_library_path/Binary
|
||||
|
||||
cp Buildscripts/CMake/TactilitySDK.cmake $target_path/
|
||||
cp Buildscripts/CMake/CMakeLists.txt $target_path/
|
||||
echo -n $ESP_IDF_VERSION >> $target_path/idf-version.txt
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Usage: release.sh [boardname]
|
||||
# Example: release.sh lilygo_tdeck
|
||||
# Description: Releases the current build labeled as a release for the specified board name.
|
||||
#
|
||||
|
||||
echoNewPhase() {
|
||||
echo -e "⏳ \e[36m${1}\e[0m"
|
||||
}
|
||||
|
||||
fatalError() {
|
||||
echo -e "⚠️ \e[31m${1}\e[0m"
|
||||
exit 0
|
||||
}
|
||||
|
||||
releaseSymbols() {
|
||||
target_path=$1
|
||||
echoNewPhase "Making symbols release at '$target_path'"
|
||||
mkdir $target_path
|
||||
cp build/*.elf $target_path/
|
||||
}
|
||||
|
||||
release() {
|
||||
target_path=$1
|
||||
echoNewPhase "Making release at '$target_path'"
|
||||
|
||||
bin_path=$target_path/Binaries
|
||||
mkdir -p $bin_path
|
||||
mkdir -p $bin_path/partition_table
|
||||
mkdir -p $bin_path/bootloader
|
||||
cp build/*.bin $bin_path/
|
||||
cp build/bootloader/*.bin $bin_path/bootloader/
|
||||
cp build/partition_table/*.bin $bin_path/partition_table/
|
||||
cp build/flash_args $bin_path/
|
||||
cp build/flasher_args.json $bin_path/
|
||||
|
||||
cp Buildscripts/Flashing/* $target_path
|
||||
}
|
||||
|
||||
board=$1
|
||||
board_clean=${board/_/-}
|
||||
release_path=release
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
fatalError "Must pass board name as first argument. (e.g. lilygo_tdeck)"
|
||||
fi
|
||||
|
||||
if [ ! -f $sdkconfig_file ]; then
|
||||
fatalError "Board not found: ${sdkconfig_file}"
|
||||
fi
|
||||
|
||||
release "${release_path}/Tactility-${board_clean}"
|
||||
releaseSymbols "${release_path}/Tactility-${board_clean}-symbols"
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cmake -S ./ -B build-sim
|
||||
cmake --build build-sim --target build-tests -j 14
|
||||
build-sim/Tests/TactilityCore/TactilityCoreTests --exit
|
||||
|
||||
Reference in New Issue
Block a user