6 Replies Latest reply on Apr 17, 2017 8:57 PM by stott1

    Bare metal programming

    Osccon

      Hi,

      I am coming from Microchip PIC16/18/24 microcontrollers which I used and programmed in assembler using PIC Kit 3 and MPLAB.

      I also designed some PCBs for some small fun projects using them.

      Moreover I wrote a lot C/C++ and very basic x86 assembler programs on windows and always tried to get some deep understanding on how exactly windows works and for example manage RAM.

      But for me it's a bit frustrating to learn for example the paging mechanism without writing some assembler program using this from ground up (for example setting up a page table myself).

      Now I noticed that Intel is producing also microcontrollers which are using the x86 architecture or at least the x86 instruction set.

      This sounds really nice to me and I am wondering whether other guys tried to program an Intel Edison or Galileo from ground up?

      What do you think?

      Or could it maybe also possible to design my own PCB for the Intel Quark D100 or is the electrical specifications way too much complicated compared with PIC microcontrollers?

      What would be the best way to get started programming an Intel processor from ground up?

      Are there better alternatives than Intel Edison or Galileo?

      Finally Microchip wrote very well documentations for it's microcontrollers well to understand and offered also nice and simple tools like MPLAB and especially PIC Kit 3 (of course pic micrcontrollers are far more simple than an x86 Intel processor).

      Is Intel offering some similar tools?

      Probably someone will suggest me to use some x86 emulator like QEMO but I don't like to work with this, it's much more fun learning with real hardware I can touch.

       

      I hope these are not too much questions at all but maybe someone knows to help me getting started at some point.

        • 1. Re: Bare metal programming
          qudor

          There are not enough information or documentations for Intel Microcontrollers especially Quark D2000 and C1000 SE microcontrollers they just provide simple examples without enough comments. Actually, Intel disappointed me.

          If you google Intel quark d2000 you will not find enough information!

          Our team in Centre of Excellence for Advanced Sensor Technology (CEASTech) tried to mirror Arduino code style to use it with Intel Quark D2000 and SE C1000 but we were shocked because intel studio for microcontroller does not support C++ compiler.

          Finally, you will not find good information about Intel microcontrollers and you need to spend a long time to understand their examples as well as do many experiments to be able to use the Microcontrollers of Intel.

          • 2. Re: Bare metal programming
            AndresV_Intel

            Hello Osccon,

             

             

            Unfortunately, the guides available are made with high-level programming in mind. There are certain official articles that introduce assembly language (https://software.intel.com/en-us/articles/introduction-to-x64-assembly) but those are not written for a certain platform or set of tools.

             

             

            In other words, currently, there is not an easy way to program any of the platforms as a “bare-metal device”, due to the fact that an official documentation (user guide) that teaches how to manipulate any platform through assembly language doesn’t exist.

             

             

            Regarding your question “is it possible to design my own PCB for the Intel Quark D1000 or is the electrical specifications way too much complicated compared with PIC microcontrollers?” Some costumers have successfully made their own PCB around Intel microprocessors and microcontrollers, so it is possible. The learning curve (complexity) depends on each costumer’s background, but since you have experience designing PCBs and programming PICs it may be easier for you to jump in.

             

             

            The documentation that is publicly disclosed (electrical and mechanical characteristics) can be found here http://ark.intel.com/, (for example, the information available for the Quark Microcontroller D1000 microcontroller: http://ark.intel.com/products/86826/Intel-Quark-Microcontroller-D1000#@specifications).

             

             

            I hope you find that information useful.

             

             

            Regards,

            Andres

            • 3. Re: Bare metal programming
              marbol

              This is exactly what I want to do too. I also come from the PIC18Fxxx family and used assembly with them as well.

               

              I want to program the Quark SE C1000 or the Curie module directly for my next project.

               

              As far as I can tell so far, we'd need to set up protected mode from real mode, provide primitives to set up all of the descriptors and interrupt tables, etc. If the watchdog resets it, we'll need to also go through all of that again. etc.

               

              Then we'll need to initialize the SRAM and other subsystems to communicate with the x86 core, and all of the peripherals. But I'm sure it can be done.  I'm sure that the makers of Arduino, etc. did it. The makers of those higher level tools all must have done the work needed.

               

              So that means it exists somewhere. My take is that it will take a lot of trial and error and experimentation.

               

              I'm willing to do it. Once someone notices they might also share some of their tips with us.

               

              I might write a book on it. My next project will be using either of the modules I mentioned. I might finish it this summer or this fall. But I'll do it somehow.

              • 4. Re: Bare metal programming
                iexpress

                I'm kinda wondering myself how to program these x86 based MCU's, I know there's a System Studio for Microcontrollers, and some of the Intel line are Arduino IDE environment based, but since the board MCU's are x86, maybe they can run windows 95/98 natively.. maybe even msdos.

                 

                I'm mostly interested in seeing if there's a hardware library for each CPU. MCU and evaluation board.

                 

                In Atmel Studio, we can program for each board model by model number and each processor by processor model number with hardware libraries pertinent to each model.

                • 5. Re: Bare metal programming
                  SergeyK

                  Intel Quark D2000 can indeed be a good platform for do-it-yourself experiments.

                  On the hardware side, I've designed and built my own boards for D2000, and several other people did as well.

                   

                  On the software side, as it was mentioned above, Intel's supported method of programming Quark MCUs is either using Intel Quark Microcontroller Software Interface (QMSI), or Zephyr RTOS using C language.

                   

                  If you want to program it yourself using x86 assembly or otherwise (without using QMSI), there are several resources that can be helpful. Most of them are linked from this page: Intel® Quark™ Microcontroller D2000: Documentation

                  There you'll find the Intel Quark D2000 datasheet (it is not perfect, but it does provide the documentation for the MCU peripheral registers).

                  The schematic and PCB files are also available from that page, and you can use them to complement the datasheet, to understand how the MCUs GPIOs are wired, or as a reference for your own schematic and PCB design.

                   

                  The Intel Quark Bootloader GitHub - quark-mcu/qm-bootloader: Quark MCUs Bootloader and Firmware Manager and QMSI GitHub - quark-mcu/qmsi: Quark MCUs HAL can provide even more programming information.

                  For example qm-bootloader/rom_startup.s at master · quark-mcu/qm-bootloader · GitHub  contains the early initialization code. It is the code that switches the microcontroller from 16-bit real mode to 32-bit flat memory protected mode.

                  The drivers directory in the QMSI tree qmsi/drivers at master · quark-mcu/qmsi · GitHub contains all the on-chip peripheral drivers, that might help you to understand how to program these peripherals.

                   

                  Thanks,

                  Sergey

                  1 of 1 people found this helpful
                  • 6. Re: Bare metal programming
                    stott1

                    To add a hopefully helpful note to the posts above.

                     

                    The assembler code that is in the https://communities.intel.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2Fquark-mcu%2Fqm-bootloader is in the AT&T assembler format. The link https://communities.intel.com/external-link.jspa?url=https%3A%2F%2Fsoftware.intel.com%2Fen-us%2Farticles%2Fintroduction-…  provided above use the Intel or Microsoft assembler format. These two formats are very different.