mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-18 09:25:06 +00:00
Add modules to SDK and improve SDK scripting
This commit is contained in:
parent
8400d37c07
commit
aa954da8a9
@ -2,18 +2,32 @@ idf_component_register(
|
||||
INCLUDE_DIRS
|
||||
"Libraries/TactilityC/include"
|
||||
"Libraries/TactilityKernel/include"
|
||||
"Libraries/TactilityFreeRtos/include"
|
||||
"Libraries/lvgl/include"
|
||||
"Libraries/lvgl-module/include"
|
||||
REQUIRES esp_timer
|
||||
)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
"Libraries/TactilityFreeRtos"
|
||||
"Modules"
|
||||
"Drivers"
|
||||
)
|
||||
|
||||
set(COMPONENTS
|
||||
TactilityFreeRtos
|
||||
bm8563-module
|
||||
bm8563-module
|
||||
bmi270-module
|
||||
mpu6886-module
|
||||
pi4ioe5v6408-module
|
||||
qmi8658-module
|
||||
rx8130ce-module
|
||||
)
|
||||
|
||||
# Regular and core features
|
||||
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)
|
||||
|
||||
@ -5,6 +5,7 @@ import shutil
|
||||
import glob
|
||||
import subprocess
|
||||
import sys
|
||||
from textwrap import dedent
|
||||
|
||||
def map_copy(mappings, target_base):
|
||||
"""
|
||||
@ -59,6 +60,45 @@ def map_copy(mappings, target_base):
|
||||
|
||||
os.makedirs(os.path.dirname(final_dst), exist_ok=True)
|
||||
shutil.copy2(src, final_dst)
|
||||
|
||||
def get_driver_mappings(driver_name):
|
||||
return [
|
||||
{'src': f'Drivers/{driver_name}/include/**', 'dst': f'Drivers/{driver_name}/include/'},
|
||||
{'src': f'Drivers/{driver_name}/*.md', 'dst': f'Drivers/{driver_name}/'},
|
||||
{'src': f'build/esp-idf/{driver_name}/lib{driver_name}.a', 'dst': f'Drivers/{driver_name}/binary/lib{driver_name}.a'},
|
||||
]
|
||||
|
||||
def get_module_mappings(module_name):
|
||||
return [
|
||||
{'src': f'Modules/{module_name}/include/**', 'dst': f'Modules/{module_name}/include/'},
|
||||
{'src': f'Modules/{module_name}/*.md', 'dst': f'Modules/{module_name}/'},
|
||||
{'src': f'build/esp-idf/{module_name}/lib{module_name}.a', 'dst': f'Drivers/{module_name}/binary/lib{module_name}.a'},
|
||||
]
|
||||
|
||||
def create_module_cmakelists(module_name):
|
||||
return dedent(f'''
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
idf_component_register(
|
||||
INCLUDE_DIRS "include"
|
||||
)
|
||||
add_prebuilt_library({module_name} "binary/lib{module_name}.a")
|
||||
'''.format(module_name=module_name))
|
||||
|
||||
def write_module_cmakelists(path, content):
|
||||
with open(path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
def add_driver(target_path, driver_name):
|
||||
mappings = get_driver_mappings(driver_name)
|
||||
map_copy(mappings, target_path)
|
||||
cmakelists_content = create_module_cmakelists(driver_name)
|
||||
write_module_cmakelists(os.path.join(target_path, f"Drivers/{driver_name}/CMakeLists.txt"), cmakelists_content)
|
||||
|
||||
def add_module(target_path, module_name):
|
||||
mappings = get_module_mappings(module_name)
|
||||
map_copy(mappings, target_path)
|
||||
cmakelists_content = create_module_cmakelists(module_name)
|
||||
write_module_cmakelists(os.path.join(target_path, f"Modules/{module_name}/CMakeLists.txt"), cmakelists_content)
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
@ -85,12 +125,7 @@ def main():
|
||||
{'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/'},
|
||||
{'src': 'TactilityKernel/*.md', 'dst': 'Libraries/TactilityKernel/'},
|
||||
# lvgl (basics)
|
||||
{'src': 'build/esp-idf/lvgl__lvgl/liblvgl__lvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'},
|
||||
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
@ -108,6 +143,18 @@ def main():
|
||||
|
||||
map_copy(mappings, target_path)
|
||||
|
||||
# Modules
|
||||
add_module(target_path, "lvgl-module")
|
||||
|
||||
# Drivers
|
||||
add_driver(target_path, "bm8563-module")
|
||||
add_driver(target_path, "bm8563-module")
|
||||
add_driver(target_path, "bmi270-module")
|
||||
add_driver(target_path, "mpu6886-module")
|
||||
add_driver(target_path, "pi4ioe5v6408-module")
|
||||
add_driver(target_path, "qmi8658-module")
|
||||
add_driver(target_path, "rx8130ce-module")
|
||||
|
||||
# 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:
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
dependencies:
|
||||
- Platforms/platform-esp32
|
||||
# Add all driver modules because the generic devices are used to build the SDK
|
||||
- Drivers/bm8563-module
|
||||
- Drivers/bmi270-module
|
||||
- Drivers/mpu6886-module
|
||||
- Drivers/pi4ioe5v6408-module
|
||||
- Drivers/qmi8658-module
|
||||
- Drivers/rx8130ce-module
|
||||
dts: generic,esp32.dts
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
dependencies:
|
||||
- Platforms/platform-esp32
|
||||
# Add all driver modules because the generic devices are used to build the SDK
|
||||
- Drivers/bm8563-module
|
||||
- Drivers/bmi270-module
|
||||
- Drivers/mpu6886-module
|
||||
- Drivers/pi4ioe5v6408-module
|
||||
- Drivers/qmi8658-module
|
||||
- Drivers/rx8130ce-module
|
||||
dts: generic,esp32c6.dts
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
dependencies:
|
||||
- Platforms/platform-esp32
|
||||
# Add all driver modules because the generic devices are used to build the SDK
|
||||
- Drivers/bm8563-module
|
||||
- Drivers/bmi270-module
|
||||
- Drivers/mpu6886-module
|
||||
- Drivers/pi4ioe5v6408-module
|
||||
- Drivers/qmi8658-module
|
||||
- Drivers/rx8130ce-module
|
||||
dts: generic,esp32p4.dts
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
dependencies:
|
||||
- Platforms/platform-esp32
|
||||
# Add all driver modules because the generic devices are used to build the SDK
|
||||
- Drivers/bm8563-module
|
||||
- Drivers/bmi270-module
|
||||
- Drivers/mpu6886-module
|
||||
- Drivers/pi4ioe5v6408-module
|
||||
- Drivers/qmi8658-module
|
||||
- Drivers/rx8130ce-module
|
||||
dts: generic,esp32s3.dts
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user