[apps] switch to the __start __stop section linker magic
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
#include <app.h>
|
||||
#include <kernel/thread.h>
|
||||
|
||||
extern const struct app_descriptor __apps_start;
|
||||
extern const struct app_descriptor __apps_end;
|
||||
extern const struct app_descriptor __start_apps __WEAK;
|
||||
extern const struct app_descriptor __stop_apps __WEAK;
|
||||
|
||||
static void start_app(const struct app_descriptor *app);
|
||||
|
||||
@@ -19,13 +19,13 @@ void apps_init(void) {
|
||||
const struct app_descriptor *app;
|
||||
|
||||
/* call all the init routines */
|
||||
for (app = &__apps_start; app != &__apps_end; app++) {
|
||||
for (app = &__start_apps; app != &__stop_apps; app++) {
|
||||
if (app->init)
|
||||
app->init(app);
|
||||
}
|
||||
|
||||
/* start any that want to start on boot */
|
||||
for (app = &__apps_start; app != &__apps_end; app++) {
|
||||
for (app = &__start_apps; app != &__stop_apps; app++) {
|
||||
if (app->entry && (app->flags & APP_FLAG_DONT_START_ON_BOOT) == 0) {
|
||||
start_app(app);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
SECTIONS {
|
||||
.apps : {
|
||||
__apps_start = .;
|
||||
KEEP (*(.apps))
|
||||
__apps_end = .;
|
||||
}
|
||||
}
|
||||
INSERT AFTER .rodata;
|
||||
@@ -33,7 +33,7 @@ struct app_descriptor {
|
||||
size_t stack_size;
|
||||
};
|
||||
|
||||
#define APP_START(appname) const struct app_descriptor _app_##appname __ALIGNED(sizeof(void *)) __SECTION(".apps") = { .name = #appname,
|
||||
#define APP_START(appname) const struct app_descriptor _app_##appname __ALIGNED(sizeof(void *)) __SECTION("apps") = { .name = #appname,
|
||||
|
||||
#define APP_END };
|
||||
|
||||
|
||||
@@ -5,6 +5,4 @@ MODULE := $(LOCAL_DIR)
|
||||
MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/app.c
|
||||
|
||||
EXTRA_LINKER_SCRIPTS += $(LOCAL_DIR)/app.ld
|
||||
|
||||
include make/module.mk
|
||||
|
||||
Reference in New Issue
Block a user