Skip to content

Commit

Permalink
src/scheduler: Fix msp stack overflow from isr_systick.
Browse files Browse the repository at this point in the history
  • Loading branch information
xBogas committed Dec 22, 2023
1 parent d0af7b0 commit a7d8519
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,25 @@ static uint32_t systick_counter = 0;

void isr_systick(void)
{
__asm ("push {lr}\n");

systick_counter++;
if (systick_counter > 10) {
systick_counter = 0;

__asm ("push {lr}\n");

sched_status.run = mythread();
sched_status.next = sched.first->th;
sched.first = sched.first->next;
printk("isr %s -> %s\n", sched_status.run->name, sched_status.next->name);

__asm ("pop {r1}\n");

if (sched_status.run->id != sched_status.next->id)
context_switch(&sched_status);
else
__asm ("bx r1\n");
}

__asm ("pop {pc}\n");
__asm ("bx lr\n");
}


Expand Down

0 comments on commit a7d8519

Please sign in to comment.