diff options
| author | Yuuki NAGAO <wf.yn386@gmail.com> | 2025-09-21 15:01:19 +0900 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-09-23 14:34:58 +1000 |
| commit | 592affce3f7118bbfa814fe92f127e9a37194d79 (patch) | |
| tree | beedfa0c02cf99e64b6060593916f97ee33eafef | |
| parent | bf08f601fa67f005d5f21095b8fd455f7c7e7fab (diff) | |
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 <wf.yn386@gmail.com>
| -rw-r--r-- | ports/stm32/make-stmconst.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ports/stm32/make-stmconst.py b/ports/stm32/make-stmconst.py index 770033ef5..5601eb0af 100644 --- a/ports/stm32/make-stmconst.py +++ b/ports/stm32/make-stmconst.py @@ -41,7 +41,10 @@ class Lexer: r"#define +(?P<id>[A-Z0-9_]+) +\(?(\(uint32_t\))?(?P<hex>0x[0-9A-F]+)U?L?\)?($| */\*)" ), ), - ("#define X", re.compile(r"#define +(?P<id>[A-Z0-9_]+) +(?P<id2>[A-Z0-9_]+)($| +/\*)")), + ( + "#define X", + re.compile(r"#define +(?P<id>[A-Z0-9_]+) +\(?(?P<id2>[A-Z0-9_]+)\)?($| +/\*)"), + ), ( "#define X+hex", re.compile( |
