mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-11 08:34:34 +02:00
example: auto restart int the linux hello world example
This commit is contained in:
@@ -369,4 +369,5 @@ test_linux_example:
|
|||||||
script:
|
script:
|
||||||
- cd ${IDF_PATH}/examples/build_system/cmake/linux_host_app
|
- cd ${IDF_PATH}/examples/build_system/cmake/linux_host_app
|
||||||
- idf.py build
|
- idf.py build
|
||||||
- build/linux_host_app.elf
|
- timeout 5 ./build/linux_host_app.elf >test.log || true
|
||||||
|
- grep "Restarting" test.log
|
||||||
|
@@ -8,13 +8,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
void app_main() {
|
void app_main() {
|
||||||
|
while(1) {
|
||||||
printf("Hello, Host!\n");
|
printf("Hello, Host!\n");
|
||||||
|
|
||||||
|
for (int i = 10; i >= 0; i--) {
|
||||||
|
printf("Restarting in %d seconds...\n", i);
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
setbuf(stdout, NULL);
|
||||||
app_main();
|
app_main();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user