Skip to content

Commit 850b220

Browse files
committed
moved metadata struct to shared
1 parent aaa9f3e commit 850b220

File tree

21 files changed

+2024
-2030
lines changed

21 files changed

+2024
-2030
lines changed

obc/CMakeLists.txt

Lines changed: 250 additions & 249 deletions
Large diffs are not rendered by default.

obc/app/app_main.c

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,52 @@
11
#include "obc_logging.h"
2+
#include "obc_adc.h"
23
#include "obc_sci_io.h"
3-
#include "obc_i2c_io.h"
4-
#include "obc_spi_io.h"
5-
#include "obc_reset.h"
4+
#include "obc_errors.h"
5+
#include "obc_print.h"
66
#include "obc_scheduler_config.h"
7-
#include "state_mgr.h"
7+
#include "obc_metadata.h"
88

99
#include <FreeRTOS.h>
1010
#include <os_task.h>
11+
#include <sci.h>
12+
#include <adc.h>
13+
#include <metadata_struct.h>
1114

1215
#include <sys_common.h>
1316
#include <sys_core.h>
14-
#include <gio.h>
15-
#include <sci.h>
16-
#include <i2c.h>
17-
#include <spi.h>
18-
#include <can.h>
19-
#include <het.h>
2017

21-
// This is the stack canary. It should never be overwritten.
22-
// Ideally, it would be a random value, but we don't have a good source of entropy
23-
// that we can use.
24-
void *__stack_chk_guard = (void *)0xDEADBEEF;
18+
static StaticTask_t taskBuffer;
19+
static StackType_t taskStack[1024];
2520

26-
void __stack_chk_fail(void) { resetSystem(RESET_REASON_STACK_CHECK_FAIL); }
21+
extern uint32_t __metadata_start__;
2722

28-
int main(void) {
29-
// Run hardware initialization code
30-
gioInit();
31-
sciInit();
32-
i2cInit();
33-
spiInit();
34-
canInit();
35-
hetInit();
23+
void vTask1(void *pvParameters) {
24+
while (1) {
25+
app_metadata_t metadata = {0};
26+
obc_error_code_t errCode;
3627

37-
_enable_interrupt_();
28+
errCode = readAppMetadata(&metadata);
3829

39-
// Initialize bus mutexes
40-
initSciMutex();
41-
initI2CMutex();
42-
initSpiMutex();
30+
if (errCode == OBC_ERR_CODE_NO_METADATA) {
31+
sciPrintf("\r\nNO METADATA, APP NOT SENT TO BL OVER SERIAL\r\n");
32+
} else {
33+
sciPrintf("\r\nParsed values:\r\n");
34+
sciPrintf("Version: 0x%x\r\n", metadata.vers);
35+
sciPrintf("Binary Size: 0x%x\r\n", metadata.binSize);
36+
sciPrintf("Board Type(0 = Launchpad, 1 = Rev1, 2 = Rev2): 0x%x\r\n", metadata.boardType);
37+
vTaskDelay(2000);
38+
}
39+
}
40+
}
4341

44-
// The state_mgr is the only task running initially.
45-
obcSchedulerInitTask(OBC_SCHEDULER_CONFIG_ID_STATE_MGR);
46-
obcSchedulerCreateTask(OBC_SCHEDULER_CONFIG_ID_STATE_MGR);
42+
int main(void) {
43+
sciInit();
44+
initSciPrint();
45+
46+
xTaskCreateStatic(vTask1, "Demo", 1024, NULL, 1, taskStack, &taskBuffer);
4747

4848
vTaskStartScheduler();
49+
50+
while (1)
51+
;
4952
}

0 commit comments

Comments
 (0)