diff --git a/apps/sys_init/CMakeLists.txt b/apps/sys_init/CMakeLists.txt new file mode 100644 index 0000000..64e1643 --- /dev/null +++ b/apps/sys_init/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(sys_init) + +target_sources(app PRIVATE src/main.c) \ No newline at end of file diff --git a/apps/sys_init/prj.conf b/apps/sys_init/prj.conf new file mode 100644 index 0000000..814117e --- /dev/null +++ b/apps/sys_init/prj.conf @@ -0,0 +1,16 @@ +# Set to -Og +CONFIG_DEBUG_OPTIMIZATIONS=y + +# Thread awareness support +CONFIG_DEBUG_THREAD_INFO=y + +# Generate stack usage per-function +CONFIG_STACK_USAGE=y + +# Other options in case not set by default +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_BUILD_OUTPUT_META=y +CONFIG_OUTPUT_SYMBOLS=y +CONFIG_OUTPUT_STAT=y +CONFIG_OUTPUT_DISASSEMBLY=y +CONFIG_OUTPUT_PRINT_MEMORY_USAGE=y diff --git a/apps/sys_init/src/main.c b/apps/sys_init/src/main.c new file mode 100644 index 0000000..27819b3 --- /dev/null +++ b/apps/sys_init/src/main.c @@ -0,0 +1,25 @@ +#include + +int post_kernel_cb(void) { + printk("[POST_KERNEL:10] Called automatically by the kernel\n"); + return 0; +} + +int post_kernel_cb2(void) { + printk("[POST_KERNEL:20] Called after priority 10\n"); + return 0; +} + +int application_cb(void) { + printk("[APPLICATION] Called automatically before main()\n"); + return 0; +} + +SYS_INIT(post_kernel_cb, POST_KERNEL, 10); +SYS_INIT(post_kernel_cb2, POST_KERNEL, 20); +SYS_INIT(application_cb, APPLICATION, 10); + +int main(void) { + printk("[main] running\n"); + return 0; +} \ No newline at end of file