Skip to content
Snippets Groups Projects
Commit 0754e8f8 authored by David Sidrane's avatar David Sidrane Committed by Lorenz Meier
Browse files

Bugfix:hrt is used before it is initalized.

   sched_note_{suspend|resume} were calling hrt_absolute_time before
   it hrt_init is called. This can lead to register access before
   clocking is enabled. The result is a hardfault.
parent 6c6cfd4f
No related branches found
No related tags found
No related merge requests found
......@@ -145,9 +145,10 @@ void sched_note_stop(FAR struct tcb_s *tcb)
void sched_note_suspend(FAR struct tcb_s *tcb)
{
uint64_t new_time = hrt_absolute_time();
if (system_load.initialized) {
uint64_t new_time = hrt_absolute_time();
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
/* Task ending its current scheduling run */
if (system_load.tasks[i].valid && system_load.tasks[i].tcb != 0 && system_load.tasks[i].tcb->pid == tcb->pid) {
......@@ -160,9 +161,10 @@ void sched_note_suspend(FAR struct tcb_s *tcb)
void sched_note_resume(FAR struct tcb_s *tcb)
{
uint64_t new_time = hrt_absolute_time();
if (system_load.initialized) {
uint64_t new_time = hrt_absolute_time();
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
if (system_load.tasks[i].valid && system_load.tasks[i].tcb->pid == tcb->pid) {
system_load.tasks[i].curr_start_time = new_time;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment