Contiki

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search

What is Contiki?

(Text copied from the official Contiki website.)

Contiki running on the Commodore 64

The Contiki operating system is a highly portable, minimalistic operating system for a variety of constrained systems ranging from modern 8-bit microcontrollers for embedded systems to old 8-bit homecomputers. Contiki provides a simple event driven kernel with optional preemptive multithreading, interprocess communication using message passing signals, a dynamic process structure and support for loading and unloading programs, native TCP/IP support using the uIP TCP/IP stack, and a graphical subsystem with either direct graphic support for directly connected terminals or networked virtual display with VNC or Telnet.

Contiki was designed with very low hardware requirements. And can run on a unexpanded Commodore 64. The portability is ensured by the core being written entirely in ANSI C.

Efforts in porting Contiki to Amstrad CPC

Contiki running on the Amstrad CPC

Previously there have been attempts to port Contiki to the CPC. The first successful port was done by Kevin Thacker.

This was accomplished by:

  1. Modifying the linker so that it could generate binary files with relocation data
  2. Modifying the optimiser rules to reduce the program size.
  3. Modifying the source so it produced smaller and better code for the SDCC compiler to work with.

The nature of Contiki (written almost entirely in C) and the poor Z80 optimisation by the SDCC compiler makes Contiki slow compared to other operating systems. The desktop routines in the Amstrad port relies on the slow firmware routines because it was quicker to make the port this way.

The Amstrad port runs in 64k. It doesn't make use of any extra RAM, this choice was taken so that a quick port could be done to proove it was possible.

A key feature of Contiki is its ability to access networks.

Two reasons prevented this in the Amstrad port:

  1. The compiled binaries for the webserver and other network programs were large, meaning that at runtime, both the binaries and contiki OS code could not fit into the 64K ram at the same time
  2. The networking hardware was not at a sufficiently developed stage.

The original plan was to implement CPC Booster support in Contiki. The CPC would be connected to the PC via a serial cable. On the PC would be Linux running Slip or PPP. The PC would be connected to the internet through a Broadband connection, with port 8080 opened for incomming connections.

The linux machine would effectively become a gateway and would pass information to/from the CPC through the serial connection.

However, because the Contiki programs could not all fit into ram, this plan was shelved.

The Amstrad version is based on Contiki v1.0.

Later updates

In 2014, and later in 2023, PulkoMandy updated the port to use a newer version of SDCC. The code generation has improved a lot, and some issues with the drawing code were solved to make it a lot less slow, and almost usable.

To free more RAM, the kernel code was moved to an expansion ROM, leaving a lot more RAM for applications to be loaded. This should allow resuming the effort on porting the network applications. But there is still no driver for any CPC hardware to use with it for now.

This version is based on the latest version of Contiki 1.2, with several updates that never made it into an official release of Contiki. The version 1 of Contiki is no longer developped, and version 2 has no desktop and windowing system.

Weblinks