osd-contiki/platform/galileo
Andre Guedes e4ff61ff6c galileo: Support for rtimer library
This patch adds support for rtimer library on Galileo's platform.

We use the PIT to implement the rtimer platform dependent
functionalities. We chose the PIT for mainly two reason: I) its
configuration is very simple II) it has a high frequency which
provides us a good clock resolution (requirement from rtimer
library).

Since we keep track of the number of ticks in software, we define
rtimer_clock_t type as uint64_t. This gives us a good amount of time
til the variable overflows. For instance, a 32-bit type would overflow
in about one hour for high clock resolution (~ 1us).

The rtimer clock frequency (RTIMER_ARCH_SECOND) is setup to 1 kHz.
There is no technical matter regarding this value. It is just an
initial guess.

Just for the record, we might want to use HPET in future to
implement the rtimer library since it seems to be more appropriate.
The reason why we don't use it at this moment is that, in order to
configure it, we need support for ACPI 2.0 which we don't. Once we
have use-cases for the rtimer library we'll probably replace PIT
by HPET or any other timer more suitable for the job.
2015-12-21 08:06:14 -02:00
..
bsp galileo: Add 'debug' rule 2015-12-21 08:06:14 -02:00
clock.c galileo: Add support for Etimer and Ctimer libraries 2015-12-21 08:06:14 -02:00
contiki-conf.h galileo: Support for rtimer library 2015-12-21 08:06:14 -02:00
contiki-main.c galileo: Support for rtimer library 2015-12-21 08:06:14 -02:00
galileo.ld galileo: Initial support for Intel Galileo Platform 2015-12-21 08:06:14 -02:00
loader.S x86: Add helpers.h 2015-12-21 08:06:14 -02:00
Makefile.customrules-galileo galileo: Print elf sections sizes after build 2015-12-21 08:06:14 -02:00
Makefile.galileo galileo: Support for rtimer library 2015-12-21 08:06:14 -02:00
newlib-syscalls.c galileo: Initial support for Intel Galileo Platform 2015-12-21 08:06:14 -02:00
README.md galileo: Add README file 2015-12-21 08:06:14 -02:00
rtimer-arch.c galileo: Support for rtimer library 2015-12-21 08:06:14 -02:00
rtimer-arch.h galileo: Support for rtimer library 2015-12-21 08:06:14 -02:00

Intel Galileo Board

This README file contains general information about the Intel Galileo board support. In the following lines you will find information about supported features as well as instructions on how to build, run and debug applications for this platform. The instructions were only test in Linux environment.

Requirements

In order to build and debug the following packages must be installed in your system:

  • gcc
  • gdb
  • openocd

Moreover, in order to debug via JTAG or serial console, you will some extra devices as described in [1] and [2].

Features

This section presents the features currently supported (e.g. device drivers and Contiki APIs) by the Galileo port.

For now, no features are supported.

Building

To build applications for this platform you should first build newlib (in case it wasn't already built). To build newlib you can run the following command:

$ ./platform/galileo/bsp/libc/build_newlib.sh

Once newlib is built, you are ready to build applications. To build applications for Galileo platform you should set TARGET variable to 'galileo'. For instance, building the hello-world application should look like this:

$ cd examples/hello-world/ && make TARGET=galileo

This will generate the 'hello-world.galileo' file which is a multiboot- compliant [3] ELF image. In order to boot the Contiki image, you will need a multiboot-compliant bootloader. In the bsp directory, we provide a helper script which builds the Grub bootloader with multiboot support. To build the bootloader, just run the following command:

$ platform/galileo/bsp/grub/build_grub.sh

Running

So to run Contiki applications in Galileo, we have three main steps: prepare SDcard, connect to console, and boot image. Below follows detailed instructions.

Prepare SDcard

Mount the sdcard in directory /mnt/sdcard.

Copy Contiki binary image to sdcard

$ cp examples/hello-world/hello-world.galileo /mnt/sdcard

Copy grub binary to sdcard

$ cp platform/galileo/bsp/grub/bin/grub.efi /mnt/sdcard

Connect to the console output

Connect the serial cable to your computer as showed in [2].

Choose one terminal emulator such as screen, putty or minicom. Make sure you use keyboard SCO mode (on putty that option is at Terminal -> Keyboard, on the left menu). Connect to /dev/ttyUSB0, use 115200 speed.

Boot Contiki Image

Turn on your board. After a few seconds you should see the following text in the screen:

Press [Enter] to directly boot.
Press [F7]    to show boot menu options.

Press and select the option "UEFI Internal Shell" within the menu. Once you have a shell, run the following commands to run grub application:

$ fs0:
$ grub.efi

You'll reach de grub shell. Now run the following commands to boot Contiki image:

$ multiboot /hello-world.galileo
$ boot

For now, we lack of UART support so you won't see any output. However, you can use JTAG (see next section) to verify that the Contiki is running.

Debugging

This section describes how to debug Contiki via JTAG. The following instructions consider you have the devices: Flyswatter2 and ARM-JTAG-20-10 adapter (see [1]).

Attach the Flyswatter2 to your host computer with an USB cable. Connect the Flyswatter2 and ARM-JTAG-20-10 adapter using the 20-pins head. Connect the ARM-JTAG-20-10 adapter to Galileo Gen2 JTAG port using the 10-pins head.

Once everything is connected, run Contiki as described in "Running" section, but right after loading Contiki image (multiboot command), run the following command:

$ make TARGET=galileo debug

The 'debug' rule will run OpenOCD and gdb with the right parameters. OpenOCD will run in background and its output will be redirected to a log file in the application's path called LOG_OPENOCD. Once gdb client is detached, OpenOCD is terminated.

If you use a gdb front-end, you can define the "GDB" environment variable and your gdb front-end will be used instead of default gdb. For instance, if you want to use cgdb front-end, just run the command:

$ make BOARD=galileo debug GDB=cgdb

References

[1] https://communities.intel.com/message/211778

[2] http://www.intel.com/support/galileo/sb/CS-035124.htm

[3] https://www.gnu.org/software/grub/manual/multiboot/multiboot.html