From 592affce3f7118bbfa814fe92f127e9a37194d79 Mon Sep 17 00:00:00 2001 From: Yuuki NAGAO Date: Sun, 21 Sep 2025 15:01:19 +0900 Subject: [PATCH] stm32/make-stmconst.py: Fix missing peripheral consts in stm module. Lines like the following were not handled by `make-stmconst.py`: #define APBPERIPH_BASE (PERIPH_BASE) This leads to missing definitions on stm module. For example, `stm.RTC` is not defined if `RTC_BASE` is defined as #define RTC_BASE (APBPERIPH_BASE + 0x00002800UL) because `APBPERIPH_BASE` is not handled as a valid id. This patch modifies the RegExp so it can handle the above. Signed-off-by: Yuuki NAGAO --- ports/stm32/make-stmconst.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/stm32/make-stmconst.py b/ports/stm32/make-stmconst.py index 770033ef59..5601eb0af4 100644 --- a/ports/stm32/make-stmconst.py +++ b/ports/stm32/make-stmconst.py @@ -41,7 +41,10 @@ class Lexer: r"#define +(?P[A-Z0-9_]+) +\(?(\(uint32_t\))?(?P0x[0-9A-F]+)U?L?\)?($| */\*)" ), ), - ("#define X", re.compile(r"#define +(?P[A-Z0-9_]+) +(?P[A-Z0-9_]+)($| +/\*)")), + ( + "#define X", + re.compile(r"#define +(?P[A-Z0-9_]+) +\(?(?P[A-Z0-9_]+)\)?($| +/\*)"), + ), ( "#define X+hex", re.compile(