Nrk-api-static-configuration

Version 6 (Anthony Rowe, 10/18/2008 01:01 am)

1 1 Anthony Rowe
 = Static Configuration (nrk_cfg.h) =
2 6 Anthony Rowe
[[TracNav(nrk-api-toc)]]
3 1 Anthony Rowe
Given the memory constraints of embedded sensor operating systems, Nano-RK uses a
4 1 Anthony Rowe
static design-time framework. This approach is consistent with sensor networking assumptions
5 1 Anthony Rowe
because as compared to traditional operating systems (where processes can
6 1 Anthony Rowe
be dynamically spawned), the OS and the applications are co-located in a single address
7 1 Anthony Rowe
space. In particular, admission control and real-time schedulability analysis tests
8 1 Anthony Rowe
are carried out offline as compared to taking a dynamic online approach. We would
9 1 Anthony Rowe
like to stress that a static approach does not mean that task properties and configuration
10 1 Anthony Rowe
parameters cannot be reconfigured during run-time. Rather, a static approach enforces
11 1 Anthony Rowe
the checks to ensure that the dynamic reconfiguration does not adversely affect application
12 1 Anthony Rowe
and system guarantees in a pre-deployment offline setting as compared to running
13 1 Anthony Rowe
dynamic admission control algorithms. Data (or control) dependent modifications to
14 1 Anthony Rowe
the task code such as changing task periods, resource usage limits, resource priorities
15 1 Anthony Rowe
and configuration of various parameters such as the network buffer sizes and stack
16 1 Anthony Rowe
sizes of each task can be changed to accommodate mode changes. With current energy
17 1 Anthony Rowe
and memory constraints, the run-time configurations will need to be verified offline at
18 1 Anthony Rowe
design-time.
19 1 Anthony Rowe
20 1 Anthony Rowe
Many of the static parameters are defined in nrk_cfg.h
21 1 Anthony Rowe
22 1 Anthony Rowe
23 1 Anthony Rowe
{{{
24 3 Anthony Rowe
#!c
25 1 Anthony Rowe
   #define NRK_REPORT_ERRORS
26 1 Anthony Rowe
   // NRK_REPORT_ERRORS will cause the kernel to print out information about
27 1 Anthony Rowe
   // missed deadlines or reserve violations
28 1 Anthony Rowe
29 1 Anthony Rowe
   #define NRK_HALT_ON_ERROR
30 1 Anthony Rowe
   // NRK_HALT_ON_ERRORS will cause the kernel to freeze on errors so that
31 1 Anthony Rowe
   // it is easier to see debugging messages.
32 1 Anthony Rowe
33 4 Anthony Rowe
   #define NRK_HALT_AND_LOOP_ON_ERROR
34 4 Anthony Rowe
   // NRK_HALT_AND_LOOP_ON_ERRORS will cause the kernel to freeze on errors but
35 4 Anthony Rowe
   // unlike NRK_HALT_ON_ERROR, the kernel panic msg will continously be printed out.
36 4 Anthony Rowe
37 1 Anthony Rowe
   #define NRK_STACK_CHECK
38 1 Anthony Rowe
   // NRK_STACK_CHECK adds a little check to see if the bottom of the stack
39 1 Anthony Rowe
   // has been over written on all suspend calls
40 1 Anthony Rowe
41 1 Anthony Rowe
   #define NRK_NO_POWER_DOWN
42 1 Anthony Rowe
  // Leave NRK_NO_POWER_DOWN define in if the target can not wake up from sleep
43 1 Anthony Rowe
  // because it has no asynchronously clocked
44 1 Anthony Rowe
45 1 Anthony Rowe
  #define NRK_MAX_TASKS 2
46 4 Anthony Rowe
 // Max number of tasks in your application
47 4 Anthony Rowe
 // Be sure to include the idle task
48 4 Anthony Rowe
 // Making this the correct size will save on BSS memory which
49 4 Anthony Rowe
 // is both RAM and ROM...
50 1 Anthony Rowe
51 4 Anthony Rowe
  #define NRK_MAX_RESOURCE_CNT 1
52 4 Anthony Rowe
 // NRK_MAX_RESOURCE_CNT defines the number of semaphores in the system.
53 4 Anthony Rowe
 // If you don't use any semaphores, set this to 0.  Be sure that libraries
54 4 Anthony Rowe
 // you are using do not require semaphores.  These should be stated in any
55 4 Anthony Rowe
 // documenation that comes with them.
56 1 Anthony Rowe
 
57 1 Anthony Rowe
  #define NRK_TASK_IDLE_STK_SIZE 64
58 1 Anthony Rowe
  // Idle task stack size min=32
59 1 Anthony Rowe
  #define NRK_APP_STACKSIZE 128
60 1 Anthony Rowe
  // Used as a default for application tasks
61 1 Anthony Rowe
  #define NRK_KERNEL_STACKSIZE 128
62 1 Anthony Rowe
  // Size of kernel stack
63 4 Anthony Rowe
64 1 Anthony Rowe
}}}
65 1 Anthony Rowe
66 1 Anthony Rowe
A sample nrk_cfg.h that configures the static parameters for a particular
67 1 Anthony Rowe
project. This includes stack sizes, number of resources, error handling etc.
68 2 Anthony Rowe
Make sure tomake clean when you change any parameters in header files
69 2 Anthony Rowe
or moved from another project directory.
70 1 Anthony Rowe
71 5 Anthony Rowe
| [wiki:nrk-api Contents] | [wiki:nrk-api-error Errors] |