Skip to content
Christopher Hall edited this page Oct 15, 2010 · 3 revisions

Features

  • Separate kernel and application binaries
  • Simple API for application program in: grifo.h
  • Fixed ABI for separate kernel/application updates
  • Event queue mechanism with option for low power standby while waiting for the next event, and a callback to capture the timeout (allows for saving unsaved data before power off)
  • Text output to LCD
  • File/directory handling for SD card
  • Watchdog timer auto power off
  • Application main must be the first code in the first object linked

Boot sequence

  • Hardware initialisation
  • Run the command: init.app auto-boot grifo-kernel
  • init.app runs
  • All files are closed on return
  • One of three possible actions occurs depending on the value returned to the kernel:
    • Power off
    • Reboot - equivalent to power on reset
    • Run: init.app restart grifo-kernel

Initial application: init.app

  • Reads a configuration file: init.ini
  • example line: hello.ico : hello.app some test arguments
  • if auto-boot was present the it unconditionally runs the first program
  • if not the first 9 items are displayed as a graphic menu

Program code from examples/hello

This displays a message on the LCD and on the console serial port, then displays the command line arguments provided by init.app.

#include <grifo.h>
int main(int argc, char *argv[])
{
	lcd_clear(LCD_WHITE);
	lcd_printf("Hello LCD world\n");
	debug_printf("Hello serial world\n");
	size_t i;
	for (i = 0; i < argc; ++i) {
		lcd_printf("argv[%d] = '%s'\n", i, argv[i]);
		debug_printf("argv[%d] = '%s'\n", i, argv[i]);
	}
	delay_us(1000000);
	return EXIT_RESTART_INIT;
}