fix(core): fix KERNEL MODE + missed dependency.
What changed, and why it matters
This commit fixes a build configuration problem in the RGB LED code for Trezor hardware wallets. It moves some shared color definitions outside a KERNEL_MODE guard and wraps an effects source file in the same guard, plus adds a missing dependency. There is no direct evidence this is a security vulnerability; it appears to be a build/dependency fix.
No security action required beyond normal code review and build verification. Treat as a build/maintenance fix unless additional context emerges.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adjusts preprocessor guards in the RGB LED driver. In rgb_led.h, color macros and the effect type enum are moved outside #ifdef KERNEL_MODE so they are visible in non-kernel builds, while the init/deinit declarations remain guarded. In rgb_led_effects.c, the entire file is wrapped in #ifdef KERNEL_MODE and the sys/systick.h include is replaced with trezor_rtl.h. The commit message frames this as fixing ‘KERNEL MODE + missed dependency’. No security impact is stated or directly inferable from the diff.
Changed components
core/embed/io/rgb_led/inc/io/rgb_led.hcore/embed/io/rgb_led/stm32u5/rgb_led_effects.cInspect captured patch +6 / −6
diff --git a/core/embed/io/rgb_led/inc/io/rgb_led.h b/core/embed/io/rgb_led/inc/io/rgb_led.h
index 6ce710e1..c0f16ccd 100644
--- a/core/embed/io/rgb_led/inc/io/rgb_led.h
+++ b/core/embed/io/rgb_led/inc/io/rgb_led.h
@@ -21,8 +21,6 @@
#include <trezor_types.h>
-#ifdef KERNEL_MODE
-
#define RGB_EXTRACT_RED(color) (((color) >> 16) & 0xFF)
#define RGB_EXTRACT_GREEN(color) (((color) >> 8) & 0xFF)
#define RGB_EXTRACT_BLUE(color) ((color) & 0xFF)
@@ -76,6 +74,8 @@ typedef enum {
RGB_LED_NUM_OF_EFFECTS,
} rgb_led_effect_type_t;
+#ifdef KERNEL_MODE
+
/**
* @brief Initialize RGB LED driver
*/
@@ -88,9 +88,6 @@ void rgb_led_deinit(void);
#endif // KERNEL_MODE
-// Set RGB LED color
-// color: 24-bit RGB color, 0x00RRGGBB
-
/**
* @brief Set the RGB led color.
*
diff --git a/core/embed/io/rgb_led/stm32u5/rgb_led_effects.c b/core/embed/io/rgb_led/stm32u5/rgb_led_effects.c
index b58011df..12d5714f 100644
--- a/core/embed/io/rgb_led/stm32u5/rgb_led_effects.c
+++ b/core/embed/io/rgb_led/stm32u5/rgb_led_effects.c
@@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <sys/systick.h>
+#ifdef KERNEL_MODE
+
#include <trezor_rtl.h>
#include "rgb_led_internal.h"
@@ -136,3 +137,5 @@ static uint32_t rgb_led_effect_charging(uint32_t elapsed_ms,
return RGBLED_OFF;
}
}
+
+#endif
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.