summaryrefslogtreecommitdiff
path: root/os/src/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/src/init.c')
-rw-r--r--os/src/init.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/os/src/init.c b/os/src/init.c
index 4febb10..bb3a6fb 100644
--- a/os/src/init.c
+++ b/os/src/init.c
@@ -1,40 +1,29 @@
#include <stdlib.h>
#include <BoardConsole.h>
-extern void __libc_init_array() __attribute__((weak));
-extern void __libc_fini_array() __attribute__((weak));
-extern void __main() __attribute__ ((weak));
+extern void __libc_init_array();
+extern void __libc_fini_array();
+extern void __main();
extern int main(int, char **, char **);
-extern void BoardEarlyInit() __attribute__((weak));
-extern void BoardLateInit() __attribute__((weak));
-extern void BoardExceptionHandler(int) __attribute__((weak));
-extern void BoardShutdown() __attribute__((weak));
+extern void BoardEarlyInit();
+extern void BoardLateInit();
+extern void BoardExceptionHandler(int);
+extern void BoardShutdown();
void _exit(int return_code) __attribute__((noreturn));
void _exit(int return_code) {
- if (return_code && BoardExceptionHandler)
+ if (return_code)
BoardExceptionHandler(return_code);
- if (BoardShutdown)
- BoardShutdown();
+ BoardShutdown();
while(1);
}
void _start() {
- if (BoardEarlyInit)
- BoardEarlyInit();
+ BoardEarlyInit();
BoardConsoleInit();
BoardConsolePuts("uC-sdk - booting.");
- if (__libc_init_array)
- __libc_init_array();
-
- if (__main)
- __main();
-
- if (BoardLateInit)
- BoardLateInit();
-
- if (__libc_fini_array)
- atexit(__libc_fini_array);
-
+ __libc_init_array();
+ BoardLateInit();
+ atexit(__libc_fini_array);
exit(main(0, NULL, NULL));
}