svd2rust
svd2rust copied to clipboard
Add Debug trait implementation
It would be very helpful to have a Debug
traits implemented for register structs. Currently if I am debugging some code or interested in how things work I simply add something like this to memory map crate. It will be mainly useful for read and memory block structs, but some may find it usefull for write structs too.
It would be very helpful to have a Debug traits implemented for register structs.
Are you serializing/printing the registers through UART/ITM? I wonder if this could be handled with GDB pretty printers, then:
(gdb) print block.register
{
fooen: true,
baren: false,
..
}
would Just Work.
In any case, I'm OK with adding Debug
implementations to RegisterR
s. The implementation should use the "formatting structs" though, then we get pretty printing ({#?}
) for free.
I am using ITM. If I am not mistaken this will not work nicely with projects compiled with --release
(at least with default options). Also it will be friendlier for user to just use several iprinln!
's to see how registers change without any additional typing in the console.
"formatting structs" will be a great way to do it.
I assume this issue refers to the RegisterBlock
structs. In addition, it would be useful to also have Debug
implementations for the peripheral structs that dereference to them (the one's with the ptr
method).
Fixed by #716