kernel: introduce single-threaded kernel

For very constrained systems, like bootloaders.

Only the main thread is available, so a main() function must be
provided. Kernel objects where pending is in play will not behave as
expected, since the main thread cannot pend, it being the only thread in
the system. Usage of objects should be limited to using K_NO_WAIT as the
timeout parameter, effectively polling on the object.

Change-Id: Iae0261daa98bff388dc482797cde69f94e2e95cc
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-12-14 15:24:12 -05:00 committed by Benjamin Walsh
commit b12a8e0914
7 changed files with 65 additions and 3 deletions

View file

@ -46,6 +46,7 @@ static inline int _is_idle_thread(void *entry_point)
return entry_point == idle;
}
#ifdef CONFIG_MULTITHREADING
#define _ASSERT_VALID_PRIO(prio, entry_point) do { \
__ASSERT(((prio) == K_IDLE_PRIO && _is_idle_thread(entry_point)) || \
(_is_prio_higher_or_equal((prio), \
@ -57,6 +58,9 @@ static inline int _is_idle_thread(void *entry_point)
K_LOWEST_APPLICATION_THREAD_PRIO, \
K_HIGHEST_APPLICATION_THREAD_PRIO); \
} while ((0))
#else
#define _ASSERT_VALID_PRIO(prio, entry_point) __ASSERT((prio) == -1, "")
#endif
/*
* The _is_prio_higher family: I created this because higher priorities are