[core] Print errors about starting main task

This commit is contained in:
Kuba Szczodrzyński
2022-07-28 20:29:53 +02:00
parent 33c9868f90
commit 0e129130b1
4 changed files with 11 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ bool startMainTask() {
&mainThread, &mainThread,
THD_APPLICATION_PRIORITY, THD_APPLICATION_PRIORITY,
"main", "main",
(beken_thread_function_t)main_task, (beken_thread_function_t)mainTask,
8192, 8192,
NULL NULL
); );

View File

@@ -21,7 +21,7 @@ void initVariant() __attribute__((weak));
// Initialize C library // Initialize C library
extern "C" void __libc_init_array(void); extern "C" void __libc_init_array(void);
void main_task(const void *arg) { void mainTask(const void *arg) {
setup(); setup();
for (;;) { for (;;) {
@@ -46,7 +46,9 @@ int main(void) {
// provide root partition // provide root partition
fal_root_part = (fal_partition_t)fal_partition_find("root"); fal_root_part = (fal_partition_t)fal_partition_find("root");
// start the main task and OS kernel // start the main task and OS kernel
startMainTask(); if (!startMainTask()) {
LT_E("Couldn't start the main task");
}
while (1) {} while (1) {}
return 0; return 0;

View File

@@ -9,7 +9,9 @@ extern "C" {
#endif #endif
/** /**
* @brief Run main_task & start OS kernel (family-defined) * @brief Run mainTask & start OS kernel (family-defined).
* Return false if an error occured; else do not return and
* and keep the OS kernel running.
*/ */
extern bool startMainTask(); extern bool startMainTask();
@@ -17,7 +19,7 @@ extern bool startMainTask();
* @brief Main setup() and loop() task. * @brief Main setup() and loop() task.
* Not to be called directly. * Not to be called directly.
*/ */
extern void main_task(const void *arg); extern void mainTask(const void *arg);
#define PIN_NONE (1 << 0) #define PIN_NONE (1 << 0)
#define PIN_GPIO (1 << 1) #define PIN_GPIO (1 << 1)

View File

@@ -23,8 +23,8 @@ void initArduino() {
} }
bool startMainTask() { bool startMainTask() {
osThreadDef(main_task, osPriorityRealtime, 1, 4096 * 4); osThreadDef(mainTask, osPriorityRealtime, 1, 4096 * 4);
main_tid = osThreadCreate(osThread(main_task), NULL); main_tid = osThreadCreate(osThread(mainTask), NULL);
osKernelStart(); osKernelStart();
return true; return true;
} }