Thursday, December 11, 2014

Intel Edison and RTEMS - Day One

It was Monday afternoon when an Intel Edison board showed up in the mail. It is quite small with an expansion board needed to have access to I/O. From an RTEMS perspective, it looks interesting because it has 40 discrete I/O pins and six analog inputs. The challenge was to see
how long it took to get the RTEMS up on this board.

It wasn't long at it was unboxed, that we were looking at a GNU/Linux prompt in a PuTTY window. Poking around, it quickly became apparent that the Edison didn't use Grub so my first hope that we could just add an RTEMS executable as an option on the boot menu was off the table. We had to identify a way to boot an RTEMS executable.

We had already noticed that U-Boot was on the board. Now the question was how to get an executable image into a bootable location and what the magic commands were to boot it. I came across this thread which had a lot of information on the Edison. It quickly became apparent that the Edison did not have much low-level public documentation yet and that support for most (if not all) legacy peripherals was not present. I posted an email to the RTEMS Users mailing list which summarized what we knew so far:
  • SoC documentation won't be out until later this month.
  • Has U-Boot and doesn't appear to have a 16-bit mode at all.
  • Looks like U-Boot will want a binary image to boot.
    • This turned out to be wrong. We figured out how to boot an ELF executable.
  • There is a comment in the OS Dev forum that the PCI configuration space is memory mapped and not IO mapped like a regular PC. This means the PCI initialization and support code needs to be different for Edison from other PCs.
  • All serial ports are on the PCI bus. It looks like the PCI layout is constant so for a start, we are hacking a simple polled driver for one UART and go from there. U-Boot initializes that port so we can skip initialization. Besides the person on the forum couldn't figure out the clock rate for the UART. This should be enough to at least temporarily get around the lack of PCI config space code.
  • There is a watchdog on it that needs to be disabled or managed.
  • Looks like it doesn't have a legacy i8254 timer and may not have legacy interrupt controller.
A user named mutex on the OS Dev forum had poked and prodded at the Edison board and managed to post a few very useful pieces of information.
  • Base address of the UART and the U-Boot command to force a character out:
    • mw.b 0xff010180 0x21 1
  • Address of the watchdog control register along with commands to disable it:
    • mw.l 0xff009000 0x10f8 1
  • And to reset the board
    • mw.l 0xff009000 0x10f8 0xf8
  • Commands to boot a binary image.
    • load emmc 0:9 0x100000 /kernel.img
    • go 0x100000
I contacted this user. It was clear that he had been the most successful in booting something that wasn't the Linux that came with the board. He quickly replied. Thomas Nilsen has his own kernel and was kind enough to send me a binary which we were able to run. He is owed a big thank you.

This was the end of Monday with the board. 

No comments:

Post a Comment