Bestand wählen
Merken

The xpcc microcontroller framework

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Beta
Erkannte Entitäten
Sprachtranskript
yeah without a cell
without is if this then this is they have in and rare this how you and say I'm just to
make sure the well on the right page brand name mn the well then end end of well yeah here from the Robotics Association nd beautiful said if I end which is very rainy sometimes and endo here to do this time theL this love and and Niamh data this sublinear men this is he he he tho Sal now this 1st chapter the little bit above my life and
thats cell and January on embedded at the end of the cell from my dope so this extremely low level and then this is essentially my story so I had a new microcontroller it's are some nice thing then I can now I'm ready to take the next step and sell at the other end tasting and high yeah threatened of and then this new microcontroller comes along with new features and the same thing happens again have crawl through all this documentation and am I write some code and essentially what I've done is I've express the same task in different code and this is obviously that stupid because as a computer scientist you're like to not work at all preferrably and so the motivation here is to put preferrably right identical code for multiple microcontrollers and if you've read through a lot of microcontroller documentation you find out that there are a lot of similarities between microcontrollers and essentially compiled all of this into a an ice library and added
some goodies like object oriented features and you know it's written in C + + and you can write almost identical code on multiple targets so let's talk about the structure of that were 1st going to pH where we're not gonna go and tell you the API because that's really boring instead I'm going to talk a little bit about concepts and explain in someone line code examples how we actually implemented that and 1st of all we're going to talk about concepts and the interfaces of extra PCC and then we're going to talk about how we use these interfaces to write drivers for external hardware this is low level so it's not so don't confuse this with Linux kernel we're actually talking about low-level stuff here and then Kevin is going to take over to talk a little bit about the magic behind all of this horrible system and about the current state and the future work so there is a lot in next piece C and that we're not gonna talk about I personally think of it in 3 parts as so we have very generic that can run on pretty much any platform without any change to the code as such as root-finding algorithms matrix multiplications uh by the workflow stuff them and then protocols as well communication protocols and then we have uh things where you need to kind of know what tend to connect to What other pin so it's more hardware uh near and obviously our peripheral interfaces which we're going to talk about and then there's the part for low-level axis we actually have to look in the data sheet and the access of registers and we're going to talk about these 3 lower layers In particular the independent peripheral interfaces so
let's talk a little about about how microcontroller looks like that so it looks like it's a black box with lots and lots of friends and for some reason he spends must be there so I could assume that they're used for some sense of intelligent input output and yes that's true so all in general we can say that every
microcontroller has at least this functionality you have some form of input you can read it will return a 1 or 0 depending on how you configure whether it's level low level and you can do the same by setting an output and this should actually be satisfied that every thing's target out there and this is the 1st example of such an interface which you can do on every microcontroller so the traditional way of implementing this this using a function call where you do all this functionality
serial and module a microcontroller you need to connect to the outside world and you can do that in the in class so we have this nice connect method which we get free checking at compile time so you know it works even before you apply that to your code of course you never know if it if you if it works because you're not a good programmer in general but there cool bonuses you know what you did because it's there new code you don't need to write a comment is there in your code it works there's no other way so this
is this GPO interface is available on all these targets the ecstasy framework works on the outer tiny 1890 atom index measure of love love and also on a that might controls and on 32 bit microcontrollers which is actually quite neat and if you apply the same logic of finding the most common interface is the most common code for all these interfaces you can see that there are a lot of interfaces which all these microcontroller support so i squared see that the serial interface obviously you have SPI and something that we use to communicate inside a robots control area network which is also used in cars and the let's talk a bit about
our relationship here for a 2nd so I a computer scientist but I study Computer Science and the studies Electrical Engineering and I come back I come from in human-computer interaction background and I'm always bickering about usability and he's always about going on about efficiency and that's essentially what we end up with so I want to tell the system what I want and I don't want to look up the datasheet and find out exactly how to do it because I am lazy and I'm going to explain to you what I mean by that this don't do this just please for god sakes don't do as ever like I have no clue what the botrytis in fact you force me to do this to go through all of these documents to find out what the system clock rate is that much of currently running find out how the algorithm works and I still have no guarantee that this actually works so this is a bad idea in general the solution to the sisters to compile is to to calculate the settings at run time and that's OK but you have no way of knowing whether the value that actually results in this is actually the value that you put in there so for example in this example it's not about trade that's in your code it also waste time you know because and space it so instead what we do in pieces C we move the calculation to compile time using template magic and France expression functions and that still doesn't exactly solve the issue of the of the of knowing whether that value x she is the value that you get out but at least it's efficient because the only thing that is stored in your program court of of the actual register values that you can copy into the register at runtime the and it does some basic checking and like whether it's even possible if you have a very low bar rates the prescaler might even under were very high population might be and on on on the independent and you don't need to open a datasheet because the intelligence is actually in the function call and it's as I said it's doesn't solve exactly the issue of of knowing whether this is the value that's why we added a tolerance so you can discuss back to the to what I said you can be clear I want the spot rate and I want this exact tolerance and if this is not achievable on the compiler will throw you a warning when error action there and you can see that in the compiler calculates the nearest possible about reducing the current configuration of the clock tree of the the prescalers and it will give you to it's not as beautiful unfortunately because in general template errors in C + + compilers are not beautiful and that it's better than nothing that's what we get and so that's that was an
example of of how we think about these interfaces and so I might be asking yourself why do we use these interfaces in any case and obviously as I said my controllers have a lot of pins and you generally want to connect something to these pants and in this case it's an inertial measurement unit and the question is can I write this driver to be platform-independent through view of things yes raise your hand OK that's too little people so yes you can because you you must think in protocols this is the this is defined protocol it's a distinct chip and you can write it platform-dependent driver because we already have these interfaces they
speak these protocols and um you can build your harder drivers on top of each other and that's exactly what is done in next sissy this is essentially what we've done so you have your there you have 3 devices on the ice bus and they only talk through this interface and the driver doesn't care whether on what platform it is because the interface is always satisfy the same way in fact you can even write a softer emulator which then uses the G bio classes to be truly platform-independent so that's what we've done so we don't have time to talk about this but there's a at a checkpoint bonus the entire API is 1 of the entire the piecewise C is non-blocking on public based so it's really fun to write these drivers and now
can and will talk a little bit about the real system the smarter than I am it was Minnesota let me go on and just take it from work in the class last year and while we are
on the ballot back to the black box again and as an electrical engineer and make some of observations I can see that they're all those patterns and those things don't change once the chip but use so that's what I call static nothing changes during runtime or in your product and also the global under the
surface you see this is what diagram of nest retrieved and you can see the most different at interfaces so of connected to a bus and they don't change you don't get at interfaces or they don't do it I'll they believed the chip during runtime so what I'm getting at is that we want you can model this in our software and what comes to mind when reusing the passes using static classes so classes that only have studied methods that had only in that only have studied members have and what this gets us is that the world but we're getting at with this is that you have all those that
peripherals and we want to generate a
class from any 1 of those so now I say well this is a lot of things to do and I can just not just have 1 your class and then give a deep index and say that you create a new word you 1 and what this is the limit of a problem because you got that you're running my control so there's no way to report on a regular system you can just under like doing so program crashes and there's no message or whatever but in my control you have no no good way of telling the user what there's something wrong so the user creates a you or with wrong idea that it will just not work and you don't know why it we have a class for every you or you can only use the classes that are provided and also is a little more efficient to use the classes because you will never have to calculate any offsets in memory so
now and we know that we want to cluster at the periphery that there are certain problems 1 is that we need to know for each device that we support for it every my controller has different peripherals so we need to know a lot of proposals supported in our device and that's what we're that's why we came
up with the maximal device files and what you can see here is that we get the file for an entity of literature of those 7 is the variations and attentional as what kind of memory the device has and working peripherals that use we actually creating those that's not files through a process of for us script that we wrote from the manufacture information so that's pretty easy to get that and you can also just by hand if there's a problem of that and then she received that we had the peripheral it it has you are and that tells the whole system to search for you a driver and the you driver has an additional XML file that tells you unintelligible system what the files it needs so now we gotta run another problem
but we're all developers role lazy and we don't want to write a duplicate code like I said we would like to have like 1 basic plate and use that to regenerate all the you or classes for example and that's what we do we
get all those in 5 with our template files and we generate all the U. of yours that we need and to do this using the
gender to template and which come from the development but it fits our of the thing that we need quite quite neatly and also 1 could think that we can do is we can check that kind of target rebuilding describe for so for example if 1 manufactured only uses the same peripherals for every controlled adipose out but they change a certain that was sort of things that for example they renamed the data adjusted to transfer data sort the editor transfer data adjusted for the as 0 and f 3 which actually the newer ones as you can do checking and see which can renewed so we don't need to write a whole new driver for then we can just do some basic in in in the template and so
on the system is based on strong switches the business and the runs file with Python as so it's easy to extend we have a lot of custom python scripts that the dual of this that the do look out for you that the generator drivers for you and it got it text-dependency tendencies if you change a template file and you have the stance this construct you program again you you know we mated with that is constructed or whatever and so when you do that it it did realize realize all the template that has changed so I to regenerate all this header and see the and compile them again so that was quite neatly and so
when we want to do that for a long term we wanna like further and generate the whole list this you library hot right now we're just generating the peripheral drivers but we want like made it possible to have a lively description then select all the drugs that you want to see in there like all those different layers that recovery of our library and you might wanna have all of this new library and you can get a constant library and it also fits in better development right neatly because with my controllers what's that what you want to have this for some companies they have their custom-built system so the way
using these you the possible system was during all this simply stuff of all those thousands of line of Python we cannot do you can just use our own library but if you do this they generate the everyone's and then the action user with their possible system and also as you can just put is apologetic in internally and I think that that's the way and that the energy from my control so it's a little bit more and nicely but in the meantime there's some
more of that in new triangles that would be great if any 1 of you ever like once a look at the sissy maybe use your project and related that started is to get 1 of them was assumed 32 of in all 3 discovery records theory that you can get a pretty from from its T and we have good support for them you can just check out sbcc examples that go into folders up you war many of the examples that you can just use and you can just use guns program and just look at the current you water as it is about we need to improve our documentation if ever ever in 1 you ever had a look at a library and says well OK that's neat but it took me a long time to find out if you want a write was about it or whatever we can always include that in our documentation also if you're getting started with their expertise you don't know what to do anything to do with me right NIC driver and and uh maybe do pull request for final meaningless and say that a decisive allocation you integrate and we always have to do that also if you wanna and you that you have 1 of the simplest example you want and advanced feature just go ahead and have a look at the other peripheral drivers and the fact that you yourself but you can also just as much as a limiting the the that's the problem of the problems and also there is this is you can be ported to new platforms almost like on any platform that has the GCC compiler you can get around in the easy or g because of course compiler and another there's some support prediction 28 any 1 of you working that we have a branch of called like back that it's not in the good state but there is a little bit of support for the k 20 and also support for L of C is the diluted but there's not much for the apple on devices and for energy for their should all be possible so if anyone is interested but said well I don't like the the STD vices or whatever is not that hard to forward and you will be happy to support you last
that's what we have right now we supported limits and that was successful so so as you wanna try another strategy you run on Windows but nothing anyone you here's really no and you look words that will yeah introduced got reports work best and that see we that we have 1 of the subordinated just ignore examples and see what kind of course remain there is 1 that the wars were pretty well and we don't have any any of we know about that this opportunity also should be pretty easy to run an ongoing aboard the idea you can check us logic as other reliably on get out or just right in the middle or a development list always happy to answer any questions you have right this thing here has 2 questions that they use the 1 in
already had the 1 used in the 1st year of now and then and then if some of the manufacturers reset itself so you want see so we can have so that the ideal and achieve the the idea was to write these divide these device fonts by hand and that's why they're very simple but if you have two hundred devices this gets kind of tiring so I found some obscure and files on the internet that describe these things in memory mapping and stuff and then I just wrote a Python script that gets all this information out compresses the little time and then you can have these compressed nice device was not compressed in the sense of compression but it aggravates the information and puts displays of nicely so be it how is it called so we're that's nice because you don't have to know because we give you the device for us so there's no licensing problem and an yeah mean we generated them you know you have we use the the the file of from the with the the the layout of this so if there if there is something in the header file on a in the in final use schools that doesn't exist it is all so you just know this yes it was in this uh to the class 3 class to class you see you realize so using this this you yes and it was yes of the yes and I guess I anticipate that question and you can buy so what do we compare different ways of of doing stuff on for example what I do when I start with a new driver I just wrote that in an edge in a drive for instance and I would did forces I wrote everything to register so that that sector this knowledge that you can get to encode size and stuff that all precalculated just right and what I did then is I added like 3 methods to configure DNA because of would be useful to have that general configured then connect to sort saucepan interesting so what it does then it did it would uh that every method that is on his own so what has to do that you 1 configuration register so every other than that of course offered 1st population you guys aren't you gotta read back to configuration adjusted then just change about demand and by back so there's a little bit of a random process and for example and I would add a 65 bytes that limited by what you have is that is that and the critical surface where the things that are called by a lot of time for example if you and set in but nodes to go to the set and the set and that actually just composer but it's it's uh we would love stuff and files which does not necessary benefit compile-time but it's not that much so it doesn't really matter uh and and so what you get for example and 80 you just get a simple assembler command the just the sets you're more high so it's this is this is a little bit of overhead compared to value which your himself but which is a ridiculous for those big devices but if you compare for example true as it was that that we that doesn't use the term optimization our stuff is mostly not most of the time spent the user letter of static stuff like templates and we we try to use all of that will like our code and it will or not people and to translate that essentially we we use static stuff so there are we try and think about function calls so so as it has a set of most of the code and header files and we do aggressively inline manually so for example if you only set up a bit and the register the entire function is in line because there you can do a function call in less than it doesn't work so we we we have to manually optimize this sufficiently so that we do use certain features in C + + that's our an overhead for example virtual function calls which are to I think to do references on an ARM core but on an AB or there more calls because the boss is smaller than the addressing so there are certain things that you need to know in order but it's still it's still a a compromise between suffer engineering and efficiency but compared to traditional C programming it is actually quite efficient so we don't do like over we don't do new you don't allocate memory just because we need a new class it is there that's I think the most important stuff so we have to have the right a of yes
Framework <Informatik>
Mikrocontroller
Zellularer Automat
Computeranimation
Software
Bit
Framework <Informatik>
Rechter Winkel
Mikrocontroller
Computeranimation
Homepage
Bit
Schreiben <Datenverarbeitung>
Kartesische Koordinaten
Computeranimation
Übergang
Kernel <Informatik>
Algorithmus
Code
Nichtunterscheidbarkeit
Protokoll <Datenverarbeitungssystem>
Druckertreiber
Schnittstelle
Hardware
Prozess <Informatik>
Ähnlichkeitsgeometrie
Mikrocontroller
Framework <Informatik>
Datenstruktur
Rechter Winkel
Programmbibliothek
Aggregatzustand
Schnittstelle
Subtraktion
Mathematisierung
Zellularer Automat
Systemplattform
Code
Task
Physikalisches System
Multiplikation
Task
Leitungscodierung
Fokalpunkt
Programmbibliothek
Datenstruktur
Informatik
Stochastische Abhängigkeit
Hardware
Peripheres Gerät
Algorithmus
Protokoll <Datenverarbeitungssystem>
Spider <Programm>
Mikrocontroller
Telekommunikation
Persönliche Identifikationsnummer
Objekt <Kategorie>
Druckertreiber
Mereologie
Nichtunterscheidbarkeit
Kommunikationsprotokoll
Lineares Funktional
Schnittstelle
Blackbox
Systemaufruf
Mikrocontroller
Oval
Mikrocontroller
Ein-Ausgabe
Systemaufruf
Computeranimation
Übergang
Bildschirmmaske
Funktion <Mathematik>
Ein-Ausgabe
Implementierung
Funktion <Mathematik>
Schnittstelle
Peripheres Gerät
Schnittstelle
Bit
Datentyp
Datennetz
Freeware
Compiler
Klasse <Mathematik>
Mikrocontroller
Mathematische Logik
Code
Framework <Informatik>
Serielle Datenübertragung
Computeranimation
Roboter
Funktion <Mathematik>
Flächeninhalt
Automatische Indexierung
Code
ATM
Ein-Ausgabe
Einflussgröße
Schnittstelle
Schnittstelle
Compiler
Gruppenoperation
Interaktives Fernsehen
Oval
Rechenbuch
Raum-Zeit
Code
Computeranimation
Netzwerktopologie
Physikalisches System
Arithmetischer Ausdruck
Einheit <Mathematik>
Algorithmus
Code
Protokoll <Datenverarbeitungssystem>
Druckertreiber
Informatik
Konfigurationsraum
Stochastische Abhängigkeit
Hardware
Schnittstelle
Beobachtungsstudie
Lineares Funktional
Sichtenkonzept
Protokoll <Datenverarbeitungssystem>
Benutzerfreundlichkeit
Raum-Zeit
Template
Systemplattform
Rechenzeit
Systemaufruf
Softwareentwicklung
Physikalisches System
Bitrate
Rechnen
Inertialsystem
Green-IT
Persönliche Identifikationsnummer
Druckertreiber
Menge
Grundsätze ordnungsmäßiger Datenverarbeitung
Gamecontroller
Compiler
Bitrate
Fehlermeldung
Schnittstelle
Bit
Klasse <Mathematik>
Systemplattform
Physikalisches System
Systemplattform
Computeranimation
Software
Druckertreiber
ATM
Protokoll <Datenverarbeitungssystem>
Bus <Informatik>
Emulator
Druckertreiber
Stochastische Abhängigkeit
Schnittstelle
Hardware
Hydrostatik
Blackbox
Flächentheorie
Mathematisierung
Klasse <Mathematik>
Rechenzeit
Biprodukt
Computeranimation
Hydrostatik
Diagramm
Flächentheorie
Software
Mustersprache
Luenberger-Beobachter
Bus <Informatik>
Sehne <Geometrie>
Message-Passing
Schnittstelle
Peripheres Gerät
Festspeicher
Klasse <Mathematik>
Gamecontroller
Inverser Limes
Systemzusammenbruch
Wort <Informatik>
Physikalisches System
Peripheres Gerät
Message-Passing
Computeranimation
Peripheres Gerät
Addition
Hydrostatik
Elektronische Publikation
Extrempunkt
Physikalisches System
Elektronische Publikation
Objektklasse
Treiber <Programm>
Computeranimation
Druckertreiber
Analog-Digital-Umsetzer
Festspeicher
Flash-Speicher
Gamecontroller
Skript <Programm>
Information
Peripheres Gerät
Peripheres Gerät
Hydrostatik
Code
Klasse <Mathematik>
Objektklasse
Elektronische Publikation
Softwareentwickler
Template
Code
Computeranimation
Peripheres Gerät
Template
Gebäude <Mathematik>
Wärmeübergang
Softwareentwicklung
Physikalisches System
Elektronische Publikation
Template
Quick-Sort
Computeranimation
Eins
Physikalisches System
Texteditor
Druckertreiber
Geschlecht <Mathematik>
Skript <Programm>
Softwareentwickler
Peripheres Gerät
Peripheres Gerät
Bit
Gruppenoperation
Mathematisierung
Mailing-Liste
Physikalisches System
Term
Computeranimation
Deskriptive Statistik
Energiedichte
Druckertreiber
Rechter Winkel
Gamecontroller
Programmbibliothek
Wiederherstellung <Informatik>
Programmbibliothek
Softwareentwickler
Term
Gerade
Betriebsmittelverwaltung
Bit
Compiler
Wasserdampftafel
Systemplattform
Physikalische Theorie
Computeranimation
Freeware
Datensatz
Prognoseverfahren
Maßstab
Bildschirmfenster
Programmbibliothek
Inverser Limes
Softwareentwickler
Druckertreiber
Verzweigendes Programm
Systemplattform
Softwareentwicklung
Mailing-Liste
Dreieck
Energiedichte
Druckertreiber
Rechter Winkel
Strategisches Spiel
Projektive Ebene
Gcc <Compiler>
Wort <Informatik>
Verkehrsinformation
Aggregatzustand
Bit
Virtualisierung
Minimierung
Datensichtgerät
Klasse <Mathematik>
Term
Code
Internetworking
Hydrostatik
Font
Flächentheorie
Skript <Programm>
Virtuelle Adresse
Ganze Funktion
E-Mail
Quellencodierung
Konfigurationsraum
Gerade
Lineares Funktional
Assembler
Template
Systemaufruf
Softwareentwicklung
Elektronische Publikation
Teilbarkeit
Stochastischer Prozess
Arithmetisches Mittel
Druckertreiber
Menge
Forcing
Benutzerschnittstellenverwaltungssystem
Rechter Winkel
Festspeicher
Speicherabzug
Information
Decodierung
Ordnung <Mathematik>
Overhead <Kommunikationstechnik>
Instantiierung

Metadaten

Formale Metadaten

Titel The xpcc microcontroller framework
Untertitel An efficient, object-oriented approach to embedded software development.
Serientitel FOSDEM 2014
Autor Hauser, Niklas
Laeufer, Kevin
Lizenz CC-Namensnennung 2.0 Belgien:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
DOI 10.5446/32642
Herausgeber FOSDEM VZW
Erscheinungsjahr 2014
Sprache Englisch

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract This talk introduces the xpcc framework for efficient object-oriented programming for micro-controllers. Originally developed by the Roboterclub Aachen e.V. for the Eurobot competition, xpcc became a separate project in 2009 and since then focussed on a new approach to cross target microcontroller libraries. It stands out for its extensive use of static C++ classes and templates which is unusual in this field, but lends itself well to the static nature of embedded development. The main goal of xpcc is to provide a simple API which is efficient enough to be deployed on a small ATtiny, yet powerful enough to make use of advanced capabilities found on 32bit ARM Cortex-M.

Ähnliche Filme

Loading...
Feedback