On Monday, 9 November 2015 at 11:39:16 UTC, Kagamin wrote:
On Monday, 9 November 2015 at 10:14:17 UTC, Timo Sintonen wrote:
There are some register definitions but it is far from complete.
Suggestions and contributions are welcome.

https://github.com/JinShil/stm32f42_discovery_demo/tree/master/source/stm32f42 
like these ones? Not sure about usage of classes though.

A little overkill to me but may very well be what op wants.
But this is not the whole thing.

I think this is what op and many others are looking for:
- D compiler that is able to compile code for the target processor
- Build system that uses the compiler, linker etc
- Register and bit definitions
- Library code to do basic operations

It is too much work if everybody writes an own version. We should make one complete set and publish that as the official Cortex-m toolset. It could be possible to translate existing C headers and use the C library but it is also lots of work and the library is quite complex.

What made me to look at D in the first place was the ability to put register definitions in a struct and then make member or property functions to do the basic operations. At this level I think it is important to know the actual hex codes of bitfields anyway and the bit names are not so important. If this is well done, there is little need to use individual bits outside of the struct. For example, to use an uart, usually we need only select 7 or 8 bits and with or without parity. The property functions can handle this. If something else is needed, it is possible to access the registers directly. The bit names can be defined even in another file and imported when needed. I think enums are suitable for that.

What I currently want to add to my library is register definitions and basic use of the most common peripherals of the most common processor types. A newcomer would then just select the processor and build the example and send it to the board.

Reply via email to