-
Notifications
You must be signed in to change notification settings - Fork 164
Description
[Please suggest a better title. It feels very convoluted]
Problem Description
The file all.zig contains register-definitions for almost all STM32 microcontrollers. It's generated from data hosted by the embassy project.
The data-format that acts as the source for the code-generator models multiple instances of the same registers (e.g. multiple channels of a DMA peripheral) as arrays. These arrays are mostly arrays of registers of the same type (effectively []u32), but in some cases they are arrays of register-clusters (e.g. []{ u32, u32, u32, u32 }).
The current code-generator skips over all instances, where stride is != 4
microzig/port/stmicro/stm32/src/generate.zig
Lines 319 to 322 in cdc15df
| if (stride != 4) { | |
| std.log.warn("ignoring register array with unsupported stride: {} != 4 for register {s} in {s} in {s}", .{ stride, register_name, key["block/".len..], name }); | |
| break :blk null; | |
| } |
This leads to the omission of several registers, that the embassy-data models as arrays of clusters
Example:
Without this, DMA is effectively not usable on my Microcontroller.
Suggested Fix
I see two ways of fixing this issue:
- Implementing code-generation all stride values (changes to data-model required)
- Rewriting the code-generator to use vendor-provided SVDs + regz (same approach as stm32-rs)