-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.cfg
289 lines (229 loc) · 10.7 KB
/
app.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/*
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* ======== app.cfg ========
*/
/* ================ General configuration ================ */
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var Event = xdc.useModule('ti.sysbios.knl.Event');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Seconds = xdc.useModule('ti.sysbios.hal.Seconds');
var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');
var Timer = xdc.useModule('ti.sysbios.hal.Timer');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
/*
* Reducing the system stack size (used by ISRs and Swis) to reduce
* RAM usage.
*/
Program.stack = 8192;
/*
* Comment this line to allow module names to be loaded on the target.
* The module name strings are placed in the .const section. Setting this
* parameter to false will save space in the .const section. Error and
* Assert messages will contain an "unknown module" prefix instead
* of the actual module name.
*/
Defaults.common$.namedModule = true;
/*
* Minimize exit handler array in System. The System module includes
* an array of functions that are registered with System_atexit() to be
* called by System_exit().
*/
System.maxAtexitHandlers = 2;
/* ================ System configuration ================ */
var SysMin = xdc.useModule('xdc.runtime.SysMin');
System.SupportProxy = SysMin;
SysMin.bufSize = 128;
if(environment["configuration"] == "debug"){
/* Enable Semihosting for GNU targets to print to CCS console */
if (Program.build.target.$name.match(/gnu/)) {
var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
}
}
/* ================ BIOS configuration ================ */
/*
* Disable unused BIOS features to minimize footprint.
* This example uses Tasks but not Swis or Clocks.
*/
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.libType = BIOS.LibType_Instrumented;
BIOS.logsEnabled = true;
BIOS.assertsEnabled = true;
BIOS.clockEnabled = true;
BIOS.heapSize = 1024;
/* Runtime stack checking is performed */
Task.checkStackFlag = true;
Hwi.checkStackFlag = true;
/* Reduce the number of task priorities */
Task.numPriorities = 4;
Task.common$.namedInstance = true;
/* ================ Task configuration ================ */
var eps_task_Params = new Task.Params();
eps_task_Params.instance.name = "eps_task";
eps_task_Params.stackSize = 1024;
eps_task_Params.priority = 3;
Program.global.eps_task_xdc = Task.create("&eps_task", eps_task_Params);
var cli_task_Params = new Task.Params();
cli_task_Params.instance.name = "cli_task";
cli_task_Params.stackSize = 2048;
cli_task_Params.priority = 1;
Program.global.cli_task_xdc = Task.create("&cli_task", cli_task_Params);
var gps_task_Params = new Task.Params();
gps_task_Params.instance.name = "gps_task";
gps_task_Params.stackSize = 2048;
gps_task_Params.priority = 2;
Program.global.gps_task_xdc = Task.create("&gps_task", gps_task_Params);
var navigation_task_Params = new Task.Params();
navigation_task_Params.instance.name = "navigation_task";
navigation_task_Params.stackSize = 4048;
navigation_task_Params.priority = 2;
Program.global.navigation_task_xdc = Task.create("&navigation_task", navigation_task_Params);
var weather_task_Params = new Task.Params();
weather_task_Params.instance.name = "weather_task";
weather_task_Params.stackSize = 1024;
weather_task_Params.priority = 2;
Program.global.weather_task_xdc = Task.create("&weather_task", weather_task_Params);
var imu_task_Params = new Task.Params();
imu_task_Params.instance.name = "imu_task";
imu_task_Params.stackSize = 4048; //3000 is not enough!
imu_task_Params.priority = 3;
Program.global.imu_task_xdc = Task.create("&imu_task", imu_task_Params);
var comm_task_Params = new Task.Params();
comm_task_Params.instance.name = "comm_task";
comm_task_Params.stackSize = 2048; //due to the camera
comm_task_Params.priority = 2;
Program.global.comm_task_xdc = Task.create("&comm_task", comm_task_Params);
var lora_task_Params = new Task.Params();
lora_task_Params.instance.name = "lora_task";
lora_task_Params.stackSize = 4048;
lora_task_Params.priority = 1;
Program.global.lora_task_xdc = Task.create("&lora_task", lora_task_Params);
var rockblock_task_Params = new Task.Params();
rockblock_task_Params.instance.name = "rockblock_task";
rockblock_task_Params.stackSize = 1024;
rockblock_task_Params.priority = 1;
Program.global.rockblock_task_xdc = Task.create("&rockblock_task", rockblock_task_Params);
/* ================ Hwi configuration ================ */
var hwi_port1_Params = new Hwi.Params();
hwi_port1_Params.instance.name = "null";
var hwi_port1 = Hwi.create(51, "&port1_isr", hwi_port1_Params);
var hwi_port2_Params = new Hwi.Params();
hwi_port2_Params.instance.name = "null";
var hwi_port2 = Hwi.create(52, "&port2_isr", hwi_port2_Params);
var hwi_port4_Params = new Hwi.Params();
hwi_port4_Params.instance.name = "null";
var hwi_port4 = Hwi.create(54, "&port4_isr", hwi_port4_Params);
var hwi_timer_a0_Params = new Hwi.Params();
hwi_timer_a0_Params.instance.name = "null";
var hwi_timer_a0 = Hwi.create(25, "&timer_a0_isr", hwi_timer_a0_Params);
var hwi_timer_a2_Params = new Hwi.Params();
hwi_timer_a2_Params.instance.name = "null";
var hwi_timer_a2 = Hwi.create(29, "&timer_a2_isr", hwi_timer_a2_Params);
var hwi_timer_a3_Params = new Hwi.Params();
hwi_timer_a3_Params.instance.name = "null";
var hwi_timer_a3 = Hwi.create(31, "&timer_a3_isr", hwi_timer_a3_Params);
var hwi_adc_Params = new Hwi.Params();
hwi_adc_Params.instance.name = "null";
var hwi_adc = Hwi.create(40, "&adc_isr", hwi_adc_Params);
/* ================ Swi configuration ================ */
/* var swi0Params = new Swi.Params();
swi0Params.instance.name = "cli_print_swi";
swi0Params.priority = 1;
Program.global.swi0 = Swi.create("&cli_print_swi", swi0Params);
*/
/* ================ Clock configuration ================ */
//TODO: the following two clocks have been commented out to make the BNO055 work
var clockParams = new Clock.Params();
clockParams.period = 5000;
clockParams.startFlag = true;
clockParams.instance.name = "cron_quick";
Program.global.cron_quick = Clock.create("&cron_quick_clock", 5, clockParams);
var clock1Params = new Clock.Params();
clock1Params.instance.name = "cron_hourly";
clock1Params.period = 3600000;
clock1Params.startFlag = true;
Program.global.cron_hourly = Clock.create("&cron_hourly_clock", 10000, clock1Params);
var timestampParams = xdc.useModule('xdc.runtime.Timestamp');
var Seconds = xdc.useModule('ti.sysbios.hal.Seconds');
Seconds.SecondsProxy = xdc.useModule('ti.sysbios.hal.SecondsClock');
/* ================ Logging configuration ================ */
var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
LoggingSetup.loadLoggerSize = 256;
LoggingSetup.mainLoggerSize = 512;
LoggingSetup.sysbiosLoggerSize = 1024;
/* ================ Semaphore configuration ================ */
var semLogParams = new Semaphore.Params();
Program.global.semLog = Semaphore.create(1, semLogParams);
var semFlashParams = new Semaphore.Params();
Program.global.semFlash = Semaphore.create(1, semFlashParams);
/* ================ Driver configuration ================ */
//var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
//TIRTOS.useGPIO = true;
//TIRTOS.useUART = true;
//TIRTOS.useI2C = true;
//TIRTOS.usePWM = true;
//TIRTOS.useSPI = true;
var driversConfig = xdc.useModule('ti.drivers.Config'); //new from TI-RTOS 2.16
//TIRTOS.libType = TIRTOS.LibType_Instrumented;
driversConfig.libType = driversConfig.LibType_Instrumented; //new from TI-RTOS 2.16
LoggingSetup.enableTaskProfiler = true;
LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
Clock.tickMode = Clock.TickMode_PERIODIC;
Task.enableIdleTask = true;
/* ================ Mailbox configuration ================ */
//holds incoming messages for all channels and outgoing for UART0
var comm_mailboxParams = new Mailbox.Params();
comm_mailboxParams.instance.name = "comm_mailbox";
Program.global.comm_mailbox = Mailbox.create(273, 10, comm_mailboxParams); // sizeof(mavlink_message_type) = 272 + 1 byte CHANNEL & TX/RX
//holds outgoing messages for LoRa
var lora_mailboxParams = new Mailbox.Params();
lora_mailboxParams.instance.name = "lora_mailbox";
Program.global.lora_mailbox = Mailbox.create(273, 10, lora_mailboxParams); // sizeof(mavlink_message_type) = 272 + 1 byte CHANNEL & TX/RX
//holds outgoing messages for Rockblock
var rockblock_mailboxParams = new Mailbox.Params();
rockblock_mailboxParams.instance.name = "rockblock_mailbox";
Program.global.rockblock_mailbox = Mailbox.create(273, 10, rockblock_mailboxParams); // sizeof(mavlink_message_type) = 272 + 1 byte CHANNEL & TX/RX
//holds sensors data before they are written to flash
//currently can hold up to 20 32-bytes messages
var mailbox2Params = new Mailbox.Params();
mailbox2Params.instance.name = "logging_mailbox";
Program.global.logging_mailbox = Mailbox.create(32, 20, mailbox2Params);