seL4 / sel4-tutorials

Tutorials for working with seL4 and/or CAmkES.

Home Page:https://docs.sel4.systems/Tutorials

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in the hello-camkes-timer tutorial

Leonard-Blazevic opened this issue · comments

As far as I can see there is a bug with the hello-camkes-timer tutorial. The expected output after running the tutorial should be:

"------Sleep for X seconds------" and with a delay of 2 seconds (by default) a second message "After the client: wakeup"

Real behavior: the program prints out the 2 messages without a delay.

I suspect that the cause for this is that:

  1. ttc_start() starts the timer and it immediately generates an interrupt
  2. in the irq_handle() we release the semaphore and stop the timer
  3. the timer will not generate interrupts anymore and the semaphore is not locked so the delay in the hello sleep will not occur (hello_sleep() is executed after the hello_init() and irq_handle())

Sorry for the late response. I took a look at the issue and found out that if you run on actual hardware, the program does sleep for 2 seconds before printing out the second message. This is probably because when booting, U-Boot (on our setup) sets up the clocks for the timer and other devices and then never turns them off. QEMU doesn't have this, so the timers don't run as expected.

So to fix this for simulation, the clocks have to be setup before the timer is initialised.