main function is now executed as kosmos thread

This commit is contained in:
tkl
2016-08-20 10:24:03 +02:00
parent 2fb1904de5
commit 2e874a9d56
5 changed files with 39 additions and 29 deletions

View File

@@ -76,7 +76,7 @@ __initialize_args (int*, char***);
// by redefining __initialize_args(), which is done when the
// semihosting configurations are used.
extern int
main (int argc, char* argv[]);
start_application (int argc, char* argv[]);
// The implementation for the exit routine; for embedded
// applications, a system reset will be performed.
@@ -311,7 +311,7 @@ _start (void)
__run_init_array ();
// Call the main entry point, and save the exit code.
int code = main (argc, argv);
int code = start_application (argc, argv);
// Run the C++ static destructors.
__run_fini_array ();

View File

@@ -0,0 +1,31 @@
/*
* application.c
*
* Created on: Aug 20, 2016
* Author: tkl
*/
#include <stdbool.h>
#include <stddef.h>
#include "board.h"
#include "queue.h"
#include "stack.h"
#include "kernel.h"
static struct thread_context main_task;
static stack_t main_stack[0xFF];
extern void main(void *arg);
int start_application (int argc, char* argv[])
{
board_init();
thread_create(&main_task, main_stack, 0xFF, main, NULL, THREAD_PRIO_IDLE);
schedule_start();
return 0;
}