Skip to content

Conversation

@KenVanHoeylandt
Copy link
Contributor

@KenVanHoeylandt KenVanHoeylandt commented Feb 1, 2026

Summary by CodeRabbit

  • New Features
    • Adds module symbol support and runtime symbol resolution across modules, plus LVGL symbol exports for easier integration.
  • Bug Fixes / Chores
    • Explicitly initializes module symbol pointers across many device and platform modules to avoid uninitialized state.
  • API
    • Introduces public symbol-resolution APIs and a module-parent accessor to enable dynamic symbol lookup between modules.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

Adds symbol-resolution infrastructure and related APIs: a new ModuleSymbol struct and macros, Module and ModuleParent symbol-resolution functions (module_resolve_symbol, module_parent_resolve_symbol), and a getModuleParent() accessor. The lvgl module now supplies a symbol table (lvgl_module_symbols) and its Module instance references it. Many device/platform Module initializers and tests explicitly set the new .symbols field (mostly to nullptr). The global symbol resolver delegates to module_parent_resolve_symbol as a fallback.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Implement support for module symbols' clearly and concisely describes the primary change across the entire changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch module-symbol-support

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (5)
Tactility/Include/Tactility/Tactility.h (1)

41-42: Consider adding documentation for the new public API.

Other functions in this namespace (e.g., getConfiguration(), getMainDispatcher()) have Doxygen comments describing their purpose, return semantics, and any warnings. For consistency and API discoverability, consider adding similar documentation for getModuleParent().

📝 Suggested documentation
+/** Provides access to the module parent for symbol resolution.
+ * `@return` the ModuleParent instance
+ */
 ModuleParent& getModuleParent();
Modules/lvgl-module/Source/symbols.c (1)

16-18: Minor: lv_color_hex and lv_color_make are color functions.

These functions are categorized under // lv_obj but are actually color utility functions. Consider moving them to a separate // lv_color section for better organization, or renaming the comment to reflect the broader scope.

TactilityKernel/Include/tactility/module.h (1)

53-58: Consider using const for the symbols pointer.

The symbols field points to a constant array that should not be modified at runtime. Using const struct ModuleSymbol* would express this intent and prevent accidental modification.

♻️ Suggested change
     /**
      * A list of symbols exported by the module.
      * Should be terminated by MODULE_SYMBOL_TERMINATOR.
      * Can be a NULL value.
      */
-    struct ModuleSymbol* symbols;
+    const struct ModuleSymbol* symbols;
TactilityC/Source/tt_init.cpp (2)

363-365: Minor: Misplaced comment.

The // extern "C" comment appears after the closing brace rather than as a comment on the closing brace itself. Consider moving it to be inline with the brace.

♻️ Suggested formatting
-}
-
-// extern "C"
+} // extern "C"

56-57: Remove redundant forward declaration - module.h is already included transitively.

The forward declaration of module_parent_resolve_symbol is redundant. <Tactility/Tactility.h> (line 52) already includes <tactility/module.h> on its line 4, which declares this function.

♻️ Suggested change
 `#include` <Tactility/Tactility.h>

 `#include` <vector>

-bool module_parent_resolve_symbol(ModuleParent* pParent, const char* name, uintptr_t* pInt);
 extern "C" {

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
TactilityKernel/Source/module.cpp (1)

45-58: Race condition fix confirmed - mutex synchronization is now in place.

The mutex is correctly acquired before iterating over data->modules (line 47) and released on both the success path (line 52) and the fallback path (line 56). This addresses the previously identified data race.

However, there's no null check for data before dereferencing. If module_parent_construct was never called, module_parent_private could be null.

💡 Optional: Add defensive null check
 bool module_parent_resolve_symbol(ModuleParent* parent, const char* symbol_name, uintptr_t* symbol_address) {
     auto* data = static_cast<ModuleParentPrivate*>(parent->module_parent_private);
+    if (data == nullptr) return false;
     mutex_lock(&data->mutex);

DEFINE_MODULE_SYMBOL(lv_anim_start),
DEFINE_MODULE_SYMBOL(lv_anim_path_ease_in_out),
DEFINE_MODULE_SYMBOL(lv_anim_path_linear),
DEFINE_MODULE_SYMBOL(lv_obj_is_valid),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Duplicate symbol entry: lv_obj_is_valid is already defined on line 50.

This duplicate entry should be removed to avoid symbol table bloat and potential confusion during symbol resolution.

🔧 Proposed fix
     DEFINE_MODULE_SYMBOL(lv_anim_path_ease_in_out),
     DEFINE_MODULE_SYMBOL(lv_anim_path_linear),
-    DEFINE_MODULE_SYMBOL(lv_obj_is_valid),
     MODULE_SYMBOL_TERMINATOR
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
DEFINE_MODULE_SYMBOL(lv_obj_is_valid),
DEFINE_MODULE_SYMBOL(lv_anim_path_ease_in_out),
DEFINE_MODULE_SYMBOL(lv_anim_path_linear),
MODULE_SYMBOL_TERMINATOR
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants