Some work Modeling the MCU

Moderators: dhowells, RobertKleczek

Some work Modeling the MCU

Postby nraynaud » Sun Oct 12, 2014 3:20 am

Hi all,

I'm learning Ada, and I'm doing some work I couldn't find anywhere else on the internet (well, with google) with respect to the register implementation.

My code is on github, here is an example of what I did for now:
https://github.com/nraynaud/bldc_ada/bl ... f4-tim.ads

So I tried to correctly type the registers instead of using bit masks, and I started integrating the bit banding (but it's ugly for now, I need a better idea), the "peripheral" object has 3 fields, they are plugged to the RCC register, you can enable the peripheral without having to remember its bus:
Code: Select all
GPIOE.peripheral.RCC_ENABLE := True;



tell me what you see that could improve this code, I need to learn, and google is not really helpful in some aspects like style and code from the real world.

Nico.
nraynaud
 
Posts: 3
Joined: Sun Oct 12, 2014 3:02 am

Re: Some work Modeling the MCU

Postby RobertKleczek » Sun Oct 12, 2014 1:06 pm

Hi, If you want look at https://github.com/rowsail/AdaForMicroc ... f40xxx.ads. (a liitle using this in https://github.com/rowsail/AdaForMicroc ... tartup.adb, bigger example will included with clock code in a few days).
This is my implementation of of registers definitions with universal framework, oveloading of +,- operators to easy set, clear bits, group set&clear of bit pools (in newer version with list of bit pools too) to manipulate registers in natural way. The framework is expensive, but simply to automate. I think writing such a big definitions manually (for large set of MCU's) is almost unfeasible. For now (not all published yet) I've definitions for almoast all STM32 1X/3X/4X family's RCC, POWER, NVIC, FLASH subsystems). So if you are interested to expand this set please inform me, we will not double the work. If you have any suggestions to implement another feature concerned with register manipulation, please inform me too, so we can may extend framewok.
Best regards Robert Kleczek
RobertKleczek
 
Posts: 10
Joined: Tue Sep 02, 2014 7:28 pm

Re: Some work Modeling the MCU

Postby nraynaud » Sun Oct 12, 2014 7:40 pm

That's interesting.
I don't see any example of the use of this API. Could you point me to a usage of it please?
nraynaud
 
Posts: 3
Joined: Sun Oct 12, 2014 3:02 am

Re: Some work Modeling the MCU

Postby RobertKleczek » Mon Nov 17, 2014 10:21 pm

Hi nraynaud,

sorry for the late answer, but I modify register format definition file a little.

Actual decription of file format is in: viewtopic.php?f=3&t=11

Robert Kłeczek.
RobertKleczek
 
Posts: 10
Joined: Tue Sep 02, 2014 7:28 pm


Return to STM

Who is online

Users browsing this forum: No registered users and 1 guest

cron