 So good afternoon everybody. My name is Malcolm print. I work for Intel. I joined Intel in 2015 in January and since about March of 2015 I worked pretty much exclusively on this Intel quark microcontroller software interface so yeah after about a year and a bit I thought try and give some Description or discussion about the sort of thing that we're doing inside an Intel And so I'm really hoping that most of you have got the question of what is QMSI if you don't this probably gonna be a bit boring for you, but So just sort of to begin with so QMSI is so it's a hardware abstraction layer. It's written in C and it's for Intel quark microcontrollers So as a version 1.1, there's around a hundred thousand lines of code inside there Version 1.0 at like 25,000 lines, so it's just getting bigger all the time That's just code because we've got like 25,000 lines of comments and stuff. So it's it's relatively well documented It supports most of the Intel quark microcontrollers. It doesn't support one of them Give you a reason why later on Because they're microcontrollers and obviously they have very limited amount of space and memory and stuff One of the main objectives that we have for this this abstraction layer is that we want to try and as much as possible give functionality but in a small possible code space and then also because microcontrollers wouldn't be Anything if they didn't have any sort of low power functionality. We've also got some low power functionality tailored to each different microcontroller Provided as part of QMSI so That's what it is but How does QMSI fit into the ground or schema things like if a new developer was coming along and they wanted to build some application and stuff like that how would they go about the whole process of You know getting the hardware building software and doing all that stuff. So that's sort of But this slide is kind of trying to show you so it's Partially the agenda. It's also partially just to show you where you are in progressing. Um, so obviously the first step Whenever you if you're doing a new application or something is you've got to try and evaluate your hardware options to see What suits your application type? so We've got these quark microcontrollers She's Intel's microcontroller option and then we've got QMSI It's just on top of that which is a hard abstraction there And then we've also got other other components that we it all sort of fits together in a package Which people can use pick and choose as they wish So the different libraries is tiny crypts, which does Encryption there's a thing IPPM which is Intel performance primitives, which is sort of a DSP like functionality And then obviously we work pretty closely with Zephyr So you've got your real-time operating system and you got communication stocks and there's also other RSS that people trying to port thing poor QMSI across to you and then there's also Integrated development environment, which is this Intel system studio for microcontrollers So that's sort of just an initial the sort of things. I'd like to talk to you today about But so if you take it say say you're starting a new project and you want to build something you decided you want to choose an Intel quark MCU and you Search on the Internet you say what are these things? You'll probably be greeted with this this slide Which just says you know, it's it's all microcontrollers basically this is Targeting the things part of internet for things right because you've got you know servers and gateways and you have the actual microcontrollers at the edge and So this is Intel's faray into the edge part of things. So They you know has the pictures suggest so they're they're They have low power in mind when they're being designed by the hardware engineers Some people might scream at just seeing integrated security. What does that mean? but for us currently it's Authentication and encryption so we have some things for that and then the scale of architecture is basically because these quark MCU's are they're all Intel Pentium you know processors So you you've got Intel architecture all the way up if you if you take the whole solution You've got Intel architecture all the way from the edge up to your servers in the cloud. So it's scalable architecture So just to give a quick Bit of an overview about the different MCU's that we have at the moment So the first one is this quark D2000 And basically this is sort of like a really low powered entry level market controller It's got 32k of flash. It's got AK a RAM. It's a 32 meg controller You know it's clock speed is 30 to make and it's x86 based You can see as well there's a bunch of IO and peripherals and stuff So like standard things you'd find on pretty much most microcontrollers. So there's you are to PWM this and spy GPO RTC and stuff and So this also comes in is part of a development kit So you can buy it from I know did you key your final or whatever and you can see there is the box And it comes with a nice form factor and it's also got sort of Arduino You know support for the rails and stuff so you can you can use Arduino shields and stuff like that if you if you if you wish So that's sort of a really basic You know sort of entry-level thing The next one, which is this SEC 1000 is like really beefy. It's like a much bigger brother version of the D2000 so Whereas the D2000 has only got 8k runs got 80k around Whereas it only had 32k of flash. This has got 384k the 384k is actually split over two flash controllers So you've got two banks of 192k The previous one there was only the one core. This is actually got two cores. It's a multi-core SSC So there's the this is the Intel one which runs a 32 meg and then there's also an arc core Well arc core means core so the Argonaut risk core that also runs at 32 megahertz And then again, you know You've got pretty much most of the same peripherals that you would have on the on the D2000 But in this case you've also got the additional thing of the sensor subsystem, which is the arc and that's got its own peripherals But then also because there's multi-cores you have to be able to talk to you know same messages between cores So this inter processor communications is dealt with there's a mailbox IP inside the there so you can send messages between your cores if you want to do any sort of synchronization or message passing there's also a USB Controller on the on the SSC and then sort of the the main sort of attraction of the whole C1000 is it's got this pattern matching engine So I don't know if anybody's seen any of the videos or anything, but it's on recent like the X games they have There people you know doing snowboarding or BMXing and whenever the people do it in real time They've got these little SSC strapped to the boards of the bicycles And if they do a flip or whatever it is then you know It it matches that flip and it will send the data real time over to some gateway waiting on and then currently in the Like in the X games will actually show the live stats of the athlete as they're doing so that's sort of one of the The really nice things about this one, but it's also quite a bit more complex comparison to the previous one so depending on whatever you need for you know your your Your application decision you choose one or the other whichever is most appropriate And then say you've done that and you say okay, I've chosen my my SSC and now I want to go and I want to actually see What is this this hell about because this house house is supposed to make life a lot quicker and easier for us, right? So just hammer it home again it's a harder abstraction layer and what it is basically we've got a whole bunch of APIs and They provide us sort of a standard interface. So if you're dealing between IPs your APIs will not exactly not be the same obviously, but they'll be sort of similar enough and offer similar sort of naming conventions and Things like that. So it's sort of you get a look in the field that you know lives on through the different things The API is a consistent across the different MCUs So if you develop something for like say a D2000 your API then you know all your code could just port across to the C1000 in Most cases Sometimes with if the hardware is completely different you need to change But but it provides as much as possible the same so it sort of reduces any sort of time when you're developing for different hardware's As well in the API collection, we've got a whole bunch of bare metal examples. So if we have any of the IPs you can just look into our examples directory and They could we'd have samples of how do you use the I2C controller or how do you use SPR? Whatever so there's a whole bunch of things that people can look at there and Again, so because these got really small amounts of memory We you know, we're trying to minimize the the usage of our code size as much as possible We access all of our IPs as memory mapped out. Oh, so it's kind of quick that way We don't do any a dynamic linking or anything. So everything we do is static so whenever you build your thing, it's that's the size of your application that's not going to grow a shrink and The whole library is Larger than the size of the flash but so we do garbage collection when you do compile time So any unused functionality is removed from the application that's generated So you you only use as much as you need to use so it gives us much spaces for the for user applications so here is just like Examples of some of the different things that like QMSI covers So you can see there's like all the different all the different IPs and peripherals and things and then also there's other things like Identification so you can at runtime you can Identify what SOC you're running on if you need to I mean if you want to have one that can run on multiple ones And they can do different functionality based on them. That's it's possible, you know If you don't want to do it at a compile time And then there's also things like a bootloader and firmware upgrade so from so if you see you get there sort of the overview of all the things that happens and then Pretending that you're curious you can look into because you can look into the bootroder bootloader or the ROM You can see all the sort of things that it does So mostly what it so it does the initialization because obviously whenever it boots up because it's because it's Pentium It starts off in like 8-bit real mode. So there's a bunch of code in there to transition it into 32-bit mode. So it's useful for us There's also trim code calculations, which I'll get to in a bit there. It's kind of important, but you know just Don't worry for now there's firmware update management, so we have like a You know processor. It's a fork of DFU utils So from version 1.1 What we did was you forked DFU utils and modified it so that you can use DFU utils with UART as the transport layer But then in version 1.2 we now have USB support so we just have the original DFU utils as an option there so you can Do your device firmware updates over USB or UART depending on which one you want and there's some host tools provided to do that so the ROM has this capability inside it and then the final one is is this unbrick me thing which When we got our first boards like you know this because you're dealing with micro trolleys There's a chance that you can leave it in a bad state So we added this little functionality in that if you if you ever are in a bad state with your your SOC or whatever It will basically wait for a pin. So if a pin is grounded It will just loop on that pin so you can always get back in and you can save your SOC So it's just a little bit of protection that you know we used and we think is quite handy so the General flow of how things go when the when the microcontroller or the SSE starts boots up at the start So they all start off at a resect vector and we've got we've got code in there as so again the assembly start up so you You set up your GDT so your or your interrupts and stuff you transition into 32-bit mode you set up your cache if it's on carcassie and Also, you set up your your stack pointer Then it goes into doing some prime primary peripheral setup where it sets up the clock modes, which I'll talk about on the next slide And it does trim calculations inside there as well Then it does this little unbrick me But where we'll check and see if you need to like get in there so you can talk to talk to it with open OCD and JTAG and then it sets up your Your secondary peripherals where it sets up the whole IDT and the IRQs and things so it gets your interrupts ready and Then it gets to a split so there's this Standard flow goes to the left and then there's the update management mode goes to the right so for the standard flow What we have is if you So you can see that the the arc box is a slightly different color and the reason why it is is because Prior to version 1.2 if you're running on the carcassie We would kick off the arc as part of the ROM flow But then we sort of realized that this wasn't exactly great if you needed synchronization or anything So now we've done from 1.2 on as we've actually removed that option from the ROM So user applications now have the ability to start the arc themselves so that you can do your own synchronization instead So after that step then this step now is starting the Lake Moncore is Common to all the SOC's so basically just jumps into your main So as you know embedded developers it just start running from there And then if it if there isn't an application flashed onto the SOC or if the user application actually finishes It just goes into power down mode so it can conserve battery and this is sort of like a if you if you are Are transporting your SOC or whatever and you're on battery mode Then you just go into power down mode to conserve battery life Going on to the other side of things with the with the boot manager flow basically just comes in if if It checks it checks for It's a compile time option and it also checks for flags and it says do I need to enter into Sort of DFU mode and if it does and it will first set up a flash controllers Then I'll do some sanitization of the bootloader section and then it will actually enter into bootloader mode Which itself is quite a large body of work. So not for here So I was saying before about the sort of clocking capabilities of the SOC's and so What you have on on the quark MC use is For the main system clock source You can have a selection of what you want to use the main system clock source as So you can choose to either use an external crystal oscillator We should be running a 32 megahertz and it's obviously it's a it's as accurate as your crystal is The downside of it is that uses around four milliamps current to operate on the crystal So you have to sort of decide Are you in a situation where you need the sort of accuracy and can you expend the sort of power if you can't? What we have is we've got a little silicon oscillator inside there and you can choose that to act as your main clock source So the silicon oscillators you can tell it operate 32 makes 16 8 or 4 meg and then also has prescalers You can prescale down from that But the so sort of and it uses only like 450 microamps at 32 meg which will be quite a lot less It's like an order of magnitude lower, but the accuracy is not as great So this is where the sort of the trim codes come in because if you So part of the trim code process you've got it, you know trim the oscillator and So the if you don't do any of the calculations and you say I want to operate at 32 megahertz because the trim codes would be Potentially wrong it would be operating You know 29 megahertz or something else and then everything would break down because you you're expecting it to be one frequency But it's not so that's why the boot loader then does It does the trim code calculations So that it will set up all the correct trim codes for the different operating modes of the silicon oscillator So if you change clocks clock settings, it will be correct and it'll be what you're expecting the final option that you would have for the system clock source is you can choose to have it operated of the RTC so the external RTC crystal. So there's obviously, you know, 32k crystal and For these ones is obviously it's if you're into sort of super low-parameters where you have really long delays between needing to wake up That's when you'd use it. So These can all feed in as an option. So it's one at a time as your system clock source And that's what your your processor run off of but then also The peripherals most of the peripherals are sourced from the system clock source so like the examples given here, I just like to see an SPI and So what you have is you've got your system clock source running at whatever speed it's running and then you can Assign a pre-scaler value to the to the clock source which would then feed in as the clock source for whatever IP So you could have your clock source running at 32 meg and you can pre-scale that down by like four or something And then your SPI will run it at four eight meg instead And then also as part of sort of power states and all this you know power modes and things You can also enable or disable clocking for different IPs for different peripherals as you want I'm saying that most of the IPs are sourced from the system clock source. There are three That are sourced from the RTC clock source So these are the RTC obviously The the watchdog timer is on that that sort of tree and then also the always on periodic timer So if anybody's ever dealing with those ones as opposed to the any of the other ones you could be Wondering as to why? Registers aren't updating so you know in that sort of time, but that's most of that stuff We've sort of taken care of in the hydro abstraction layer instead So then so if you've got like or your clocking done stuff in part of it is is checking out to what sort of different power states So I was saying that like each SOC, you know Chemo site provides power states based on whichever SOC that you're working with so d2000. It's it's a pretty simple thing It's got pretty simple power modes to go with it So you're either in active mode or you know completely off But so in active mode you can go into hold mode, which will just halt The the system clock, but won't hold anything else So everything else can keep on running and it's sort of a really fast way But she just conserve a little bit of power while you're waiting for some you know some slow Short transaction to complete and then when an interruptive request happens Then the whole system goes back into active mode, but then also you've got sort of deep sleep Options where you can power down more more clocks and the more clocks you power down the more power you would save obviously So then the sort of options we've got in d2000 so we got You can do deep sleep with no clocks at all or deep sleep with an RTC source So the RTC source you can wake up as RTC as your wake-up source or with the no clocks at all It would be on like a comparator, you know to wake up your your SSE So though that was really easy and it's you know not that intimidating But then when you go across to the C1000 You know it starts to look a bit more because you've got to start managing multiple cores now So there's obviously a lot more choices and options you can have but you know it's sort of almost analogous So you've got C states, which is an Intel thing, right? So you you're see C0 and SS0 as your active states And then you've got similar things where C1 and SS1 where if you just do a halt and then C2 LP and see you know is where you start to saving more and more clocks to get lower and lower power and then eventually you have like the sort of the lowest power consumption mode for for C1000 Where is the low if both are into C2 or SS2 mode and then you can enter into lower power standby state Which is sort of you know as good as it gets So One final little thing about the actual the code So this is just a little sample of how you'd actually use QMSI in general. So at the top, this is all lifted from one of our examples So you can see we've got a little QMRTC config struct type top We call a config and inside we've got different options So you set whatever your initial value if you want to have an alarm or a callback and then your alarm value like how long between alarms and If you want to use a callback and if you want to pass any user data and sort of a prescaler value and then When you set up all your configuration options for whatever IP it is, they're all Relatively similar, but they're obviously tailored for whatever IP you work on But then you would do a register an interrupt request if you need interrupts Which is part of the you know, just how the interrupt mechanisms work and then you can enable or you you can start your your Clocking because you because on the the clocking slide You can enable or disable different IPs on the clocks and then finally you can get around to set the config Which just takes your parameter and also takes a an enum of which instance of an IP you want to target So like if you because so with RTCs We only have you know the one at the moment But if there were two or three RTCs you could use the same function, but you just change RTC zero to be RTC one or two or whatever depending on which one you want to access So it's sort of the same and it will just handle multiple IPs instead one little thing about the The like set config functions and things like that in in a lot of our functions What we have is we've got a bit of parameter checking, but only if you're working in debug mode So if you compile in debug mode your applications will do some nice parameter checking for you So if you put in wrong values It will catch it and I'll say no you're wrong, but then if you compile and release mode instead It's it's not as forgiving. It will just assume that you're right You know so that because basically again it reduces the code size because you're not doing any you know Sanitization or you're not checking anything and it's so it's faster and you know It's just all better, but it also has a bit of a dangerous side because if you put in wrong values, it'll You know have Who knows what it'll do? But anyway, so that's sort of QMSI in general so then moving Along onto the sort of the library side of things so this so we have some new loop as part of the thing and So we provide a few you know system calls inside that so one of the things we have is is peak or printf which is It's like a modular Very tiny version of printf So what you can do is you can actually go in and at compile time You can disable certain options if you know you don't want to use it or you can even add stuff on At the end if you want to have your own versions, but you'd have to write the code for that So currently what it does supports du xx and s so you know integers hex and strings Then we also have a puts and There is Malik and free there so you can do some dynamic stuff if you really need to but We don't but it is an option and then we also have asserts which if You're interested you can dig into the code and you can change what happens on an assert behavior So there's a few defines which you do at compile time and you can change what happens if if an assert is called Then if you have sort of say you so you've got an application and you Want to actually sort of Run it on a board and sort of debug it a bit and you know your feel that you sort of like at that first sort of stage This is sort of the sort of the flow that you do So you've got your Harder at the bottom you've got whatever code that you've written and then for the standard case with whatever like our reference boards and things Is we've got open ocd is our communication method method and you can either talk directly Into open ocd or you can use gdb to do debug commands You can separate points view memory do all those sorts of things whatever you need to do Then the tool chains You know a bit confusing but so basically you've got two different tool chains with the both based on GCC So if you compare if you're compiling for Intel architecture You just use normal GCC and then if you're compiling for the arc We've got arc GCC and these do all these tool chains and open ocd and everything is provided as a It's a standalone download so you can just go into software Intel.com You know I system tool chain only and you can just download these four windows or or Linux Whatever you want and you can just use them as on their own if you wish So there's sort of the libraries And there we have and then so you know because security is king. We have a we do some tiny crypto stuff as well So for the tiny crypto basically as I was saying at the moment, it's all you know either encryption or Authentication so you've got you know some implementations of Shah and HMAC Shah for authentication And then you've got your elliptical curves or AES if you're doing encryption stuff So you can you know use whatever is appropriate for whatever you want so But it's up to you it's up to you to Use whatever has been implemented So then moving on towards this the DSP like stuff. So what we have is because Because there's no floating point unit on the on the ESSEs Basically, we just use fixed points instead much like Kim's this or other people would do So you got Q15 and Q31 formats and then there's a bit of floating point emulation or simulation but it's You know because there's no actual Floating point unit it's all in software. So it takes takes a lot of space and takes a lot of time to do that sort of thing But we have so for the DSP like things you've got a whole bunch of different functional groups So you know fast math or matrix functions or transforms whatever need Each Function that you use obviously would increase the whole size of whatever application you're using so you have to be judicial Is it is optimized as much as possible? But some functions take two kilobytes and some functions take a few hundred bytes of memory It all depends on the actual, you know the hard requirements of the functions and how much they use So that's you know things that are there There is like I said, there is the floating point library. This is only for Lakemore processors And it just emulates floating point operations, you know using these hardware into your instructions instead So yeah, you can read it yourselves, but you know, it's however Qx format goes and So Pretending now you've got like your hardware you got your Hell you've got your little application using tiny crypt and you got all these things going on, you know Left-right and center and then you also want to do some comm stacks on top of that Could potentially write your own, but it's much easier to use an RTOS instead that they've done all the hard work for you, right? so You know, we work really closely with with Zephyr and we're there now where they their Harder driver of choice when it comes to Intel architect Intel SoCs and microcontrollers And then they support all the things I'm sure everybody's heard a lot about this whole conference with Zephyr where they do You know a lot of different comms protocols like a six-low pan and things like that So then as a developer you can choose if you want you can either do All of the stuff yourself like you can download cum aside yourself. You can get all the libraries yourself. You can get Zephyr, you know time you get everything you could do all of that and it will work. It all works together Or instead what you can do is you can choose to use the central system studio for microcontrollers And basically this bundles everything together So you just have one download and we'll do all the all the work for you to make sure everything's in correctly So it's it's based on eclipse. So anybody's familiar with the clips should be fully I mean it should be fairly familiar with this It has the debugger so it has like open OCD and GDP integration built into it It also has some register of you stuff built into it. So you don't need to query everything individually On Windows only there's some extra drivers for USB support, but it's not required on Linux and Linux it's slightly better and Then you can see the nice pretty eclipse thing in action where you've got you know sort of code I'm there if you're doing if you're doing debugging your code on the left You've got disassembly on the right. You can see the actual you know Assembly instructions and then at the bottom. There's a register of you So you can if you are stepping through your application, you're wondering why something isn't working You can always stop at any point you can go down to the register view and you can just say What's the actual status of you know my you are registers and it will show you everything inside there So it's pretty good, you know, but it's It's pretty standard I say at this stage. So then the sort of final bit is How would you use all of the stuff together, you know, how would you take everything that's in a package and Go forth with it and do what you want So as I was saying before we've got a whole bunch of like existing applications in bare metal Zephyr comes with their own example applications as well, but here we have things of how exactly we would use RIPs in whatever situations There's a few classics Blinky, you know, just in case you ever need to blink lay it on and off forever We've also got hello world. Otherwise, we shot and Then also some specific power examples for the different SOCs because again the hardware is different So controlling the power modes in them is different and then also Some Grove shield examples as well where you know Grove shields a little sensor kits and you can use them and do what you wish So If you've done all that and you think maybe I'd like to you know, have a look at QMSI There's a couple places you can go where you want to get it so the first place would well one of the places is You can go along to this Intel developer zone and you can just download The latest bundle for ISSM on whatever platform you choose and that will give you, you know, everything tool chains code Zephyr all this stuff or You can go to github so prior to Version 1.1. We had github. We were hosting on zero one dog But then we sort of moved to our own little github project instead So we've got now and github is you know, we've got QMSI project We've got the bootloader project and we also have the do a few utils for the you are to paste updating and you know, it's It's there. You're free to do whatever you want. Copy it fork it who cares, you know Contribute to it that would be best of all right So that's you know the link up there Feel free to go along and then if everything else goes terribly wrong and you don't know where to turn to We do have a community page which is fairly actively looked after by some people inside So there's the the link for that and you know if you're welcome to ask questions about Quark stuff, you know like D2000 or C1000 whatever things, you know pertinent to that like and then generally will Answer as quick as you can or get onto somebody who can answer you Yeah, so otherwise this is this a little bit illegal stuff and Thanks, everybody for listening. Does anybody have any questions? Pedro is nodding. Yes Pedro is nodding. Yes You're inside Yeah, like we work so closely with the guys like we're you know meeting something like all the time So really tightly, you know integrated there Anybody else? Okay Yeah, it's just about to say yeah, it's pretty good Sure Well, the C1000 definitely got a lot more memory right so you've got 80 K of RAM and you've got the 2 by 192 K of flash if that's enough for Linux or not Well, so there are quarks like the the X1000 like the Galileo or the Edison they they run the next things But they're they're not the MCU side of things. They're Much much much beefier So for my videos It's for a batch I don't want Yeah, the guys want to port their software on there. That's already Do it in the winter winter situation See You can always drop something in email maybe and check The price point so on if you go into like Digikey or Mauser, I think it's it's around five No, you can go you can check it on digikey or wherever it's like Yeah, I think like I think in singles it's like if you if you're doing the C1000 I think for singles It's like I don't know it. Yeah, it's it's it's a number X And then if you're willing to buy in batches of 2000, it's like, you know, you get like it I don't know, you know 20% discount or something whatever the X is like Yeah, but the prices should be on Well, yeah, yeah, I'm sort of use the term a bit So this is the SOC is the the whole package, right? So the SOC contains all of the things inside of it. Whereas the microcontroller is maybe just So use case would be any internet of things I think so like some of the things you you might have seen before would Be like the X games they have these These ones in particular they have them on like snowboarders and BMX there is and stuff and as people do tricks It shows you in real time, you know, their speed and their velocity and their rotate angular rotation and stuff there was also Our CEO did a demonstration at CES last year We had a he had a button on his suit and it showed him walking You know, he showed his stats as he's walking around for the whole presentation. So Whatever you need for everything you things You're right, so Okay, thanks very much