Porting

Version 6 (Anthony Rowe, 03/08/2007 05:54 pm)

1 1 Anthony Rowe
2 1 Anthony Rowe
= Porting Nano-RK =
3 2 Anthony Rowe
4 2 Anthony Rowe
[[Image(many-fish.jpg,200)]]
5 3 Anthony Rowe
6 5 Anthony Rowe
Porting Nano-RK to other platforms should be relatively simple.  Most architecture specific files are in seperate ''platform'' or ''hal'' directories.  When moving to a different processor, first focus on porting the hal files.  The platform directories deal with different configurations that exist even if two platforms use the same processor.  For instance, one board might use UART0 by default, the other might use UART1.  GPIO pin layout as well as radios will likely be different across platforms.
7 4 Anthony Rowe
8 4 Anthony Rowe
The /include/platform.mk file takes the PLATFORM_TYPE parameter set in a project's local make file and then sets:
9 4 Anthony Rowe
 * MCU
10 4 Anthony Rowe
 * RADIO
11 4 Anthony Rowe
 * PROG_TYPE
12 4 Anthony Rowe
These are used in the common makefile to switch to the correct directories for architecture specific files.
13 4 Anthony Rowe
14 4 Anthony Rowe
The hal file can be found in: /src/kernel/hal/$(MCU) and consist of:
15 4 Anthony Rowe
 * nrk_status.c
16 6 Anthony Rowe
  * The status file checks the state of the hardware at startup to catch an unexpected restart.  This uses processor specific information about the default cpu state.
17 4 Anthony Rowe
 * nrk_timer.c
18 6 Anthony Rowe
  * This is where any Nano-RK timer functions need to be changed
19 4 Anthony Rowe
 * $(mcu)_hw_specific.S
20 6 Anthony Rowe
  * This file containts the assembly context swap
21 4 Anthony Rowe
22 4 Anthony Rowe
Add the correct switches into the /includes/common.mk to select the correct platform directories as well as the correct hw_specific.S file.