Kernel and buildscript improvements (#477)

* **New Features**
  * Centralized module management with global symbol resolution
  * Level-aware logging with colored prefixes and millisecond timestamps

* **Breaking Changes**
  * ModuleParent hierarchy and getModuleParent() removed
  * Logging API and adapter model replaced; LogLevel-driven log_generic signature changed

* **Improvements**
  * Unified, simplified module registration across build targets
  * Tests updated to reflect new module lifecycle and global symbol resolution
This commit is contained in:
Ken Van Hoeylandt
2026-02-03 08:35:29 +01:00
committed by GitHub
parent 1a61eac8e0
commit a935410f82
38 changed files with 432 additions and 665 deletions
+34 -41
View File
@@ -1,26 +1,32 @@
cmake_minimum_required(VERSION 3.20)
include("${CMAKE_CURRENT_LIST_DIR}/../Buildscripts/module.cmake")
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
list(APPEND REQUIRES_LIST
TactilityKernel
TactilityCore
TactilityFreeRtos
hal-device-module
lvgl-module
lv_screenshot
minitar
minmea
)
if (DEFINED ENV{ESP_IDF_VERSION})
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
list(APPEND REQUIRES_LIST
TactilityKernel
PlatformEsp32
TactilityCore
TactilityFreeRtos
hal-device-module
lvgl-module
driver
elf_loader
lv_screenshot
QRCode
esp_http_server
esp_http_client
esp-tls
esp_wifi
json
minitar
minmea
json # Effectively cJSON
nvs_flash
spiffs
vfs
@@ -33,13 +39,25 @@ if (DEFINED ENV{ESP_IDF_VERSION})
list(APPEND REQUIRES_LIST esp_tinyusb)
endif ()
idf_component_register(
SRCS ${SOURCE_FILES}
INCLUDE_DIRS "Include/"
PRIV_INCLUDE_DIRS "Private/"
REQUIRES ${REQUIRES_LIST}
else ()
list(APPEND REQUIRES_LIST
PlatformPosix
freertos_kernel
cJSON
lvgl
)
endif ()
tactility_add_module(Tactility
SRCS ${SOURCE_FILES}
INCLUDE_DIRS Include/
PRIV_INCLUDE_DIRS Private/
REQUIRES ${REQUIRES_LIST}
)
if (DEFINED ENV{ESP_IDF_VERSION})
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-unused-variable)
endif ()
@@ -50,31 +68,6 @@ if (DEFINED ENV{ESP_IDF_VERSION})
# Read-write
fatfs_create_spiflash_image(data "${CMAKE_CURRENT_SOURCE_DIR}/../Data/data" FLASH_IN_PROJECT PRESERVE_TIME)
endif ()
else()
file(GLOB_RECURSE SOURCES "Source/*.c*")
add_library(Tactility OBJECT)
target_sources(Tactility PRIVATE ${SOURCES})
target_include_directories(Tactility
PRIVATE Private/
PUBLIC Include/
)
target_link_libraries(Tactility PUBLIC
cJSON
TactilityFreeRtos
TactilityCore
TactilityKernel
PlatformPosix
hal-device-module
lvgl-module
freertos_kernel
lvgl
lv_screenshot
minmea
minitar
)
endif()
endif ()
-2
View File
@@ -38,8 +38,6 @@ const Configuration* getConfiguration();
*/
Dispatcher& getMainDispatcher();
ModuleParent& getModuleParent();
namespace hal {
/** While technically this configuration is nullable, it's never null after initHeadless() is called. */
+4 -13
View File
@@ -41,15 +41,6 @@ static auto LOGGER = Logger("Tactility");
static const Configuration* config_instance = nullptr;
static Dispatcher mainDispatcher;
static struct ModuleParent tactility_module_parent {
"tactility",
nullptr
};
ModuleParent& getModuleParent() {
return tactility_module_parent;
}
// region Default services
namespace service {
// Primary
@@ -342,10 +333,9 @@ void run(const Configuration& config, Module* platformModule, Module* deviceModu
return;
}
// Module parent
check(module_parent_construct(&tactility_module_parent) == ERROR_NONE);
// hal-device-module
check(module_set_parent(&hal_device_module, &tactility_module_parent) == ERROR_NONE);
check(module_construct(&hal_device_module) == ERROR_NONE);
check(module_add(&hal_device_module) == ERROR_NONE);
check(module_start(&hal_device_module) == ERROR_NONE);
const hal::Configuration& hardware = *config.hardware;
@@ -375,7 +365,8 @@ void run(const Configuration& config, Module* platformModule, Module* deviceModu
.task_affinity = getCpuAffinityConfiguration().graphics
#endif
});
check(module_set_parent(&lvgl_module, &tactility_module_parent) == ERROR_NONE);
check(module_construct(&lvgl_module) == ERROR_NONE);
check(module_add(&lvgl_module) == ERROR_NONE);
lvgl::start();
registerAndStartSecondaryServices();