aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/mcusupport/wizards/application/FreeRTOS/main.cpp.tpl
blob: 43ca2e706b8ab4bdc594058ca77e788cd5766833 (plain)
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
#include "%{ProjectName}.h"

#include <qul/application.h>
#include <qul/qul.h>

#include <cstdio>
#include <FreeRTOS.h>
#include <task.h>

#ifndef QUL_STACK_SIZE
#error QUL_STACK_SIZE must be defined.
#endif

static void Qul_Thread(void *argument);

int main()
{
    Qul::initPlatform();

    if (xTaskCreate(Qul_Thread, "QulExec", QUL_STACK_SIZE, 0, 4, 0) != pdPASS) {
        std::printf("Task creation failed!.\\r\\n");
        configASSERT(false);
    }

    vTaskStartScheduler();

    // Should not reach this point
    configASSERT(false);
    return 0;
}

static void Qul_Thread(void *argument)
{
    Qul::Application app;
    static %{ProjectName} item;
    app.setRootItem(&item);
    app.exec();
}