Skip to content
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
2 changes: 1 addition & 1 deletion .github/actions/build-sdk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:
env:
# NOTE: Update with ESP-IDF!
ESP_IDF_VERSION: '5.5'
run: Buildscripts/release-sdk.sh release/TactilitySDK
run: python Buildscripts/release-sdk.py release/TactilitySDK
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
Expand Down
10 changes: 0 additions & 10 deletions Buildscripts/CMake/CMakeLists.txt

This file was deleted.

19 changes: 19 additions & 0 deletions Buildscripts/TactilitySDK/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
idf_component_register(
INCLUDE_DIRS
"Libraries/TactilityC/Include"
"Libraries/TactilityKernel/Include"
"Libraries/TactilityFreeRtos/Include"
"Libraries/lvgl/Include"
"Libraries/lvgl-module/Include"
REQUIRES esp_timer
)

add_prebuilt_library(TactilityC Libraries/TactilityC/Binary/libTactilityC.a)
add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/Binary/libTactilityKernel.a)
add_prebuilt_library(lvgl Libraries/lvgl/Binary/liblvgl.a)
add_prebuilt_library(lvgl-module Libraries/lvgl-module/Binary/liblvgl-module.a)

target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC)
target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel)
target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl)
target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl-module)
Binary file not shown.
4 changes: 0 additions & 4 deletions Buildscripts/get-idf-target.sh

This file was deleted.

58 changes: 58 additions & 0 deletions Buildscripts/release-sdk-current.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3

import os
import shutil
import subprocess
import sys

def get_idf_target():
try:
with open("sdkconfig", "r") as f:
for line in f:
if line.startswith("CONFIG_IDF_TARGET="):
# CONFIG_IDF_TARGET="esp32s3" -> esp32s3
return line.split('=')[1].strip().strip('"')
except FileNotFoundError:
print("sdkconfig not found")
return None
return None

def main():
# 1. Get idf_target
idf_target = get_idf_target()
if not idf_target:
print("Could not determine IDF target from sdkconfig")
sys.exit(1)

# 2. Get version
try:
with open("version.txt", "r") as f:
version = f.read().strip()
except FileNotFoundError:
print("version.txt not found")
sys.exit(1)

# 3. Construct sdk_path
# release/TactilitySDK/${version}-${idf_target}/TactilitySDK
sdk_path = os.path.join("release", "TactilitySDK", f"{version}-{idf_target}", "TactilitySDK")

# 4. Cleanup sdk_path
if os.path.exists(sdk_path):
print(f"Cleaning up {sdk_path}")
shutil.rmtree(sdk_path)

os.makedirs(sdk_path, exist_ok=True)

# 5. Call release-sdk.py
# Note: Using sys.executable to ensure we use the same python interpreter
script_path = os.path.join("Buildscripts", "release-sdk.py")
print(f"Running {script_path} {sdk_path}")

result = subprocess.run([sys.executable, script_path, sdk_path])

if result.returncode != 0:
print(f"Error: {script_path} failed with return code {result.returncode}")
sys.exit(result.returncode)

if __name__ == "__main__":
main()
14 changes: 0 additions & 14 deletions Buildscripts/release-sdk-current.sh

This file was deleted.

117 changes: 117 additions & 0 deletions Buildscripts/release-sdk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/usr/bin/env python3

import os
import shutil
import glob
import subprocess
import sys

def map_copy(mappings, target_base):
"""
Helper function to map input files/directories to output files/directories.
mappings: list of dicts with 'src' (glob pattern) and 'dst' (relative to target_base or absolute)
'src' can be a single file or a directory (if it ends with /).
"""
for mapping in mappings:
src_pattern = mapping['src']
dst_rel = mapping['dst']
dst_path = os.path.join(target_base, dst_rel)

# To preserve directory structure, we need to know where the wildcard starts
# or have a way to determine the "base" of the search.
# We'll split the pattern into a fixed base and a pattern part.

# Simple heuristic: find the first occurrence of '*' or '?'
wildcard_idx = -1
for i, char in enumerate(src_pattern):
if char in '*?':
wildcard_idx = i
break

if wildcard_idx != -1:
# Found a wildcard. The base is the directory containing it.
pattern_base = os.path.dirname(src_pattern[:wildcard_idx])
else:
# No wildcard. If it's a directory, we might want to preserve its name?
# For now, let's treat no-wildcard as no relative structure needed.
pattern_base = None

src_files = glob.glob(src_pattern, recursive=True)
if not src_files:
continue

for src in src_files:
if os.path.isdir(src):
continue

if pattern_base and src.startswith(pattern_base):
# Calculate relative path from the base of the glob pattern
rel_src = os.path.relpath(src, pattern_base)
# If dst_rel ends with /, it's a target directory
if dst_rel.endswith('/') or os.path.isdir(dst_path):
final_dst = os.path.join(dst_path, rel_src)
else:
# If dst_rel is a file, we can't really preserve structure
# unless we join it. But usually it's a dir if structure is preserved.
final_dst = dst_path
else:
final_dst = dst_path if not (dst_rel.endswith('/') or os.path.isdir(dst_path)) else os.path.join(dst_path, os.path.basename(src))

os.makedirs(os.path.dirname(final_dst), exist_ok=True)
shutil.copy2(src, final_dst)

def main():
if len(sys.argv) < 2:
print("Usage: release-sdk.py [target_path]")
print("Example: release-sdk.py release/TactilitySDK")
sys.exit(1)

target_path = os.path.abspath(sys.argv[1])
os.makedirs(target_path, exist_ok=True)

# Mapping logic
mappings = [
{'src': 'version.txt', 'dst': ''},
# TactilityC
{'src': 'build/esp-idf/TactilityC/libTactilityC.a', 'dst': 'Libraries/TactilityC/Binary/'},
{'src': 'TactilityC/Include/*', 'dst': 'Libraries/TactilityC/Include/'},
{'src': 'TactilityC/CMakeLists.txt', 'dst': 'Libraries/TactilityC/'},
{'src': 'TactilityC/LICENSE*.*', 'dst': 'Libraries/TactilityC/'},
# TactilityFreeRtos
{'src': 'TactilityFreeRtos/Include/**', 'dst': 'Libraries/TactilityFreeRtos/Include/'},
{'src': 'TactilityFreeRtos/CMakeLists.txt', 'dst': 'Libraries/TactilityFreeRtos/'},
{'src': 'TactilityFreeRtos/LICENSE*.*', 'dst': 'Libraries/TactilityFreeRtos/'},
# TactilityKernel
{'src': 'build/esp-idf/TactilityKernel/libTactilityKernel.a', 'dst': 'Libraries/TactilityKernel/Binary/'},
{'src': 'TactilityKernel/Include/**', 'dst': 'Libraries/TactilityKernel/Include/'},
{'src': 'TactilityKernel/CMakeLists.txt', 'dst': 'Libraries/TactilityKernel/'},
{'src': 'TactilityKernel/LICENSE*.*', 'dst': 'Libraries/TactilityKernel/'},
# lvgl-module
{'src': 'build/esp-idf/lvgl-module/liblvgl-module.a', 'dst': 'Libraries/lvgl-module/Binary/'},
{'src': 'Modules/lvgl-module/Include/**', 'dst': 'Libraries/lvgl-module/Include/'},
{'src': 'Modules/lvgl-module/CMakeLists.txt', 'dst': 'Libraries/lvgl-module/'},
{'src': 'Modules/lvgl-module/LICENSE*.*', 'dst': 'Libraries/lvgl-module/'},
# lvgl (basics)
{'src': 'build/esp-idf/lvgl/liblvgl.a', 'dst': 'Libraries/lvgl/Binary/'},
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/Include/'},
{'src': 'Libraries/lvgl/lv_version.h', 'dst': 'Libraries/lvgl/Include/'},
{'src': 'Libraries/lvgl/LICENCE.txt', 'dst': 'Libraries/lvgl/LICENSE.txt'},
{'src': 'Libraries/lvgl/src/lv_conf_kconfig.h', 'dst': 'Libraries/lvgl/Include/lv_conf.h'},
{'src': 'Libraries/lvgl/src/**/*.h', 'dst': 'Libraries/lvgl/Include/src/'},
# elf_loader
{'src': 'Libraries/elf_loader/elf_loader.cmake', 'dst': 'Libraries/elf_loader/'},
{'src': 'Libraries/elf_loader/license.txt', 'dst': 'Libraries/elf_loader/'},
# Final scripts
{'src': 'Buildscripts/TactilitySDK/TactilitySDK.cmake', 'dst': ''},
{'src': 'Buildscripts/TactilitySDK/CMakeLists.txt', 'dst': ''},
]

map_copy(mappings, target_path)

# Output ESP-IDF SDK version to file
esp_idf_version = os.environ.get("ESP_IDF_VERSION", "")
with open(os.path.join(target_path, "idf-version.txt"), "a") as f:
f.write(esp_idf_version)

if __name__ == "__main__":
main()
58 changes: 0 additions & 58 deletions Buildscripts/release-sdk.sh

This file was deleted.

2 changes: 1 addition & 1 deletion Modules/hal-device-module/Source/drivers/hal_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void hal_device_for_each_of_type(HalDeviceType type, void* context, bool(*onDevi
.onDeviceParam = onDevice
};

for_each_device_of_type(&HAL_DEVICE_TYPE, &internal_context, [](Device* device, void* context){
device_for_each_of_type(&HAL_DEVICE_TYPE, &internal_context, [](Device* device, void* context){
auto* hal_device_private = GET_DATA(device);
auto* internal_context = static_cast<InternalContext*>(context);
auto hal_device_type = getHalDeviceType(hal_device_private->halDevice->getType());
Expand Down
2 changes: 1 addition & 1 deletion Modules/hal-device-module/Source/hal/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ std::vector<std::shared_ptr<Device>> findDevices(Device::Type type) {

std::vector<std::shared_ptr<Device>> getDevices() {
std::vector<std::shared_ptr<Device>> devices;
for_each_device_of_type(&HAL_DEVICE_TYPE, &devices ,[](auto* kernelDevice, auto* context) {
device_for_each_of_type(&HAL_DEVICE_TYPE, &devices ,[](auto* kernelDevice, auto* context) {
auto devices_ptr = static_cast<std::vector<std::shared_ptr<Device>>*>(context);
auto hal_device = hal_device_get_device(kernelDevice);
(*devices_ptr).push_back(hal_device);
Expand Down
4 changes: 4 additions & 0 deletions Modules/lvgl-module/Source/symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
DEFINE_MODULE_SYMBOL(lv_buttonmatrix_set_selected_button),
// lv_canvas
DEFINE_MODULE_SYMBOL(lv_canvas_create),
DEFINE_MODULE_SYMBOL(lv_canvas_fill_bg),
DEFINE_MODULE_SYMBOL(lv_canvas_set_draw_buf),
DEFINE_MODULE_SYMBOL(lv_canvas_set_buffer),
DEFINE_MODULE_SYMBOL(lv_canvas_set_px),
// lv_label
DEFINE_MODULE_SYMBOL(lv_label_create),
Expand Down Expand Up @@ -314,6 +316,8 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
DEFINE_MODULE_SYMBOL(lv_line_create),
DEFINE_MODULE_SYMBOL(lv_line_set_points),
DEFINE_MODULE_SYMBOL(lv_line_set_points_mutable),
DEFINE_MODULE_SYMBOL(lv_tick_get),
DEFINE_MODULE_SYMBOL(lv_tick_elaps),
// lv_slider
DEFINE_MODULE_SYMBOL(lv_slider_create),
DEFINE_MODULE_SYMBOL(lv_slider_get_value),
Expand Down
2 changes: 1 addition & 1 deletion Tactility/Source/hal/i2c/I2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Device* findDevice(i2c_port_t port) {
.device = nullptr
};

for_each_device_of_type(&I2C_CONTROLLER_TYPE, &params, [](auto* device, auto* context) {
device_for_each_of_type(&I2C_CONTROLLER_TYPE, &params, [](auto* device, auto* context) {
auto* params_ptr = (Params*)context;
auto* driver = device_get_driver(device);
if (driver == nullptr) return true;
Expand Down
2 changes: 2 additions & 0 deletions TactilityC/Source/symbols/cplusplus.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <private/elf_symbol.h>
#include <cstddef>
#include <new>

#include <symbols/cplusplus.h>

Expand All @@ -17,6 +18,7 @@ extern "C" {
const esp_elfsym cplusplus_symbols[] = {
ESP_ELFSYM_EXPORT(_Znwj), // operator new(unsigned int)
ESP_ELFSYM_EXPORT(_ZdlPvj), // operator delete(void*, unsigned int)
{ "_ZSt7nothrow", (void*)&std::nothrow },
// cxx_guards
ESP_ELFSYM_EXPORT(__cxa_pure_virtual), // class-related, see https://arobenko.github.io/bare_metal_cpp/
ESP_ELFSYM_EXPORT(__cxa_guard_acquire),
Expand Down
2 changes: 1 addition & 1 deletion TactilityC/Source/tt_hal_gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using namespace tt::hal;

static Device* find_first_gpio_controller() {
Device* device_result = nullptr;
for_each_device_of_type(&GPIO_CONTROLLER_TYPE, &device_result, [](Device* device, void* context) {
device_for_each_of_type(&GPIO_CONTROLLER_TYPE, &device_result, [](Device* device, void* context) {
if (device_is_ready(device)) {
auto** device_result_ptr = static_cast<Device**>(context);
*device_result_ptr = device;
Expand Down
Loading
Loading