Open mbuesch opened 2 years ago
As we need support from the svd2rust
tool to properly implement this, the macro should probably also be moved into the generated code.
The svd2rust
could get a new option to select between static and dynamic peripherals struct checking. avr-device
could then always request generation of the static macro.
Hi, sorry, I completely lost track of this. I agree with you, I think this should be discussed with the svd2rust project and integrated there.
The
Peripherals::take()
function has two disadvantages:This change uses the linker to statically ensure that only one Peripherals instance is constructed globally. It introduces a new macro to avr_device that is used just like:
In case of multiple macro invocations, the linker will abort with
TODO:
DEVICE_PERIPHERALS
access has to be removed from the generatedPeripherals::steal()
function.Peripherals::take()
function have to be removed from the generated code.