I'm sure that I've seen where specific registers were defined (name and address), but i cannot figure out where they are. Perhaps the code that i remember when I was just looking ( like..months ago) there was an stm????.h and stm???.c file that contained all register addresses... was that removed or am I blind ?
Register Definition - where are they ?
(2 posts) (2 voices)-
Posted 5 years ago #
-
It used to be that way, with a single regs file defining everything. The stm32 firmware lib (from ST, we dont use it) also does things that way with a MASSIVE monolithic file wrapping a structs and bifields around every register.
In maple-bootloader, we still do it that way inside of hardware.h. In libmaple, however, the registers are defined in the files that drive them. For example, the GPIO_CRH,CRL, etc etc (gpio control registers) are no defined in libmaple-repo/libmaple/gpio.h
Since the registers on the stm32 for the most part map to tight and independent peripheral blocks, it was easy to make this organizational structure. In fact, if youre thinking of extending libmaple, this is a good way to start.
1) wrap the regs for the peripheral you want to drive (like timers, for example) into a timers.h file
2) write a bunch of c code that does reasonable things... (like turns them on, enables interrupts, sets their overflow value...whatever)
3) add a really lean simple interface to those C function via a monolithic C++ class (timer.cpp) and add it to wirish. You have to make some hard decisions about how to turn 128 bits of configuration into some default Timer.start(). Its daunting and hard to realize if you got it right. I think that perhaps this is one of the principle reasons an arm arduino library hadnt been done before (to any great extent).Posted 5 years ago #
Reply
You must log in to post.