Porting

Version 7 (Anthony Rowe, 03/08/2007 07:50 pm)

1 1 Anthony Rowe
2 1 Anthony Rowe
= Porting Nano-RK =
3 7 Anthony Rowe
[[Image(htdocs:images/sushi.jpg, 225)]]  [[Image(many-fish.jpg,200)]]
4 3 Anthony Rowe
5 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.
6 4 Anthony Rowe
7 4 Anthony Rowe
The /include/platform.mk file takes the PLATFORM_TYPE parameter set in a project's local make file and then sets:
8 4 Anthony Rowe
 * MCU
9 4 Anthony Rowe
 * RADIO
10 4 Anthony Rowe
 * PROG_TYPE
11 4 Anthony Rowe
These are used in the common makefile to switch to the correct directories for architecture specific files.
12 4 Anthony Rowe
13 4 Anthony Rowe
The hal file can be found in: /src/kernel/hal/$(MCU) and consist of:
14 4 Anthony Rowe
 * nrk_status.c
15 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.
16 4 Anthony Rowe
 * nrk_timer.c
17 6 Anthony Rowe
  * This is where any Nano-RK timer functions need to be changed
18 4 Anthony Rowe
 * $(mcu)_hw_specific.S
19 6 Anthony Rowe
  * This file containts the assembly context swap
20 4 Anthony Rowe
21 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.