modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
749 stars 132 forks source link

Restructure examples #359

Closed rleh closed 3 years ago

rleh commented 4 years ago

Problems / possibilities for improvement

Restructuring modm examples

rleh commented 4 years ago

List of Nucleo Boards

ST Discovery boards

This list seems not to be complete, is there a good overview on STs website?

salkinium commented 4 years ago

In addition, we should have at least the Nucleo Pinouts available as machine readable data, so we can generate both BSPs and unittests for them like this GPIO test.

salkinium commented 4 years ago

Generated (automated from CI) all examples into https://github.com/modm-io/modm-examples to keep the first steps with modm easy.

That's a great idea! Perhaps we can also generate https://github.com/modm-io/modm-template at the same time cos it would be basically have a mostly similiar structure?

rleh commented 4 years ago

For the nucleo boards the only unavoidable difference is the SystemClock struct with all static constexpr frequencies and the enable() method.

Can we somehow get machine-readable data (from CubeMX?) to generate the code?

salkinium commented 4 years ago

Can we somehow get machine-readable data (from CubeMX?) to generate the code?

Yes, I found this: https://salkinium.com/stm32/clock/

But it's both matches too much and too little, because ST has some logic conditions inside their XML that I do evaluate, so there may be duplicates or missing nodes. It's pretty horrifying.

salkinium commented 4 years ago

Ah, found the code: it's quite simple: https://github.com/salkinium/modm-devices/commit/5381b4bb71e49cedd19c2da06af32e10510bfc6d

(Simple in the sense that ST's data is basically just a graph dump, but the difficulty is getting the actual limitations, like clock rate resolved, which are part of the IP file)