mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20240 from benpicco/cpu/atmega-no_thread
cpu/avr8_common: fix build with !core_thread
This commit is contained in:
commit
2e3037c3aa
@ -106,8 +106,11 @@ void kernel_init(void)
|
||||
main_trampoline, NULL, "main");
|
||||
}
|
||||
else {
|
||||
/* RIOT without threads */
|
||||
irq_enable();
|
||||
main_trampoline(NULL);
|
||||
while (1) {}
|
||||
return;
|
||||
}
|
||||
|
||||
cpu_switch_context_exit();
|
||||
|
@ -260,6 +260,10 @@ void NORETURN avr8_enter_thread_mode(void)
|
||||
|
||||
void thread_yield_higher(void)
|
||||
{
|
||||
if (!IS_USED(MODULE_CORE_THREAD)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (irq_is_in() == 0) {
|
||||
avr8_context_save();
|
||||
sched_run();
|
||||
@ -278,7 +282,8 @@ void avr8_exit_isr(void)
|
||||
__asm__ volatile ("" : : : "memory");
|
||||
|
||||
/* schedule should switch context when returning from a non nested interrupt */
|
||||
if (sched_context_switch_request && avr8_state_irq_count == 0) {
|
||||
if (sched_context_switch_request && avr8_state_irq_count == 0 &&
|
||||
IS_USED(MODULE_CORE_THREAD)) {
|
||||
avr8_context_save();
|
||||
sched_run();
|
||||
avr8_context_restore();
|
||||
|
@ -156,7 +156,8 @@ void isr_cpu_switch_context_exit(void)
|
||||
ucontext_t *ctx;
|
||||
|
||||
DEBUG("isr_cpu_switch_context_exit\n");
|
||||
if ((sched_context_switch_request == 1) || (thread_get_active() == NULL)) {
|
||||
if (((sched_context_switch_request == 1) || (thread_get_active() == NULL))
|
||||
&& IS_USED(MODULE_CORE_THREAD)) {
|
||||
sched_run();
|
||||
}
|
||||
|
||||
@ -210,7 +211,11 @@ void isr_thread_yield(void)
|
||||
native_irq_handler();
|
||||
}
|
||||
|
||||
if (!IS_USED(MODULE_CORE_THREAD)) {
|
||||
return;
|
||||
}
|
||||
sched_run();
|
||||
|
||||
/* Use intermediate cast to uintptr_t to silence -Wcast-align.
|
||||
* stacks are manually word aligned in thread_static_init() */
|
||||
ucontext_t *ctx = (ucontext_t *)(uintptr_t)(thread_get_active()->sp);
|
||||
|
@ -84,7 +84,9 @@ USEMODULE += $(filter cortexm_svc, $(FEATURES_USED))
|
||||
|
||||
# select core_idle_thread if the feature no_idle_thread is *not* used
|
||||
ifeq (, $(filter no_idle_thread, $(FEATURES_USED)))
|
||||
USEMODULE += core_idle_thread
|
||||
ifneq (,$(filter core_thread, $(USEMODULE)))
|
||||
USEMODULE += core_idle_thread
|
||||
endif
|
||||
endif
|
||||
|
||||
# use mpu_stack_guard if the feature is used
|
||||
|
Loading…
Reference in New Issue
Block a user