flipperzero-firmware/core/app.cpp
coreglitch 176e608c6d
Add minunit test framework (#168)
* add minunit tests

* fix logging

* ignore unexisting time service on embedded targets

* fix warning, issue with printf

* add exitcode

* migrate to printf

* indicate test by leds

* add testing description

* redesigned minunit tests to allow testing in separate files

* add test step for local target

* add failure test

* add restore test_check

* testing description

Co-authored-by: rusdacent <rusdacentx0x08@gmail.com>
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2020-10-10 13:32:06 +03:00

47 lines
1.2 KiB
C++

#include <stdio.h>
extern "C" {
#include "flipper.h"
#include "furi.h"
#include "log.h"
#include "startup.h"
#include "tty_uart.h"
}
// for testing purpose
uint32_t exitcode = 0;
extern "C" void set_exitcode(uint32_t _exitcode) {
exitcode = _exitcode;
}
extern "C" int app() {
register_tty_uart();
FuriRecordSubscriber* log = get_default_log();
fuprintf(log, "\n=== Welcome to Flipper Zero! ===\n\n");
// FURI startup
const size_t flipper_app_count = sizeof(FLIPPER_STARTUP) / sizeof(FLIPPER_STARTUP[0]);
FuriApp* handlers[flipper_app_count];
for(size_t i = 0; i < flipper_app_count; i++) {
// TODO create a dependency tree and run tasks in the desired order
furiac_wait_libs(&FLIPPER_STARTUP[i].libs);
handlers[i] = furiac_start(FLIPPER_STARTUP[i].app, FLIPPER_STARTUP[i].name, NULL);
}
bool is_alive = false;
do {
is_alive = false;
for(size_t i = 0; i < flipper_app_count; i++) {
if(handlers[i]->handler != NULL) {
is_alive = true;
}
}
delay(500);
} while(is_alive);
fuprintf(log, "\n=== Bye from Flipper Zero! ===\n\n");
return (int)exitcode;
}