Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task is blocked #12

Closed
aslansq opened this issue Jan 2, 2025 · 7 comments
Closed

task is blocked #12

aslansq opened this issue Jan 2, 2025 · 7 comments

Comments

@aslansq
Copy link

aslansq commented Jan 2, 2025

Hello
Thank you very much for all these great tutorials. Maybe this stupid question but here it goes:

I thought OS systick also interrupt based. When I run this code in QEMU, ofc it stops in this line forever since systick is never increased. Is this a bug? Sorry I dont have hardware to test it.

@aslansq
Copy link
Author

aslansq commented Jan 2, 2025

https://github.com/aslansq/freertos_intro_qemu

I dunno if you care to look at it :) but I implement all of your tutorials in qemu vanilla freertos.

@ShawnHymel
Copy link
Owner

Awesome work! I linked to your repo from the README to hopefully help people who don't have the hardware.

I don't know QEMU, but my guess is that the appropriate ISR is not implemented. In your code xPortSysTickHandler is declared but never defined (from what I can tell).

It also might be related to the SysTick_Handler vs. xPortSysTickHandler naming issue in ARM CMSIS: FreeRTOS/FreeRTOS-Kernel#511

Sorry I don't have more info...maybe those links are helpful?

@aslansq
Copy link
Author

aslansq commented Jan 2, 2025

Ah thank you! I ll put some more effort to clean it up
I am confused now though. If there is no 'taskENTER_CRITICAL', ISR gets called.
priority_inversion

When there is 'taskENTER_CRITICAL', ISR does not get called. xTickCount is always 25.
challenge

Isn't 'taskENTER_CRITICAL' should disable all interrupts?

@ShawnHymel
Copy link
Owner

That is weird it is stuck at 25. You are correct: taskENTER_CRITICAL should disable interrupts: https://www.freertos.org/Documentation/02-Kernel/04-API-references/04-RTOS-kernel-control/01-taskENTER_CRITICAL_taskEXIT_CRITICAL

@aslansq
Copy link
Author

aslansq commented Jan 4, 2025

Anyways, I am surprised it worked for you.
aslansq/freertos_intro_qemu#27
I fixed mine like this.
since it works for you, I am closing the issue.

@aslansq aslansq closed this as completed Jan 4, 2025
@ShawnHymel
Copy link
Owner

I actually haven't had a chance to try it yet. Did you manage to get it working?

@aslansq
Copy link
Author

aslansq commented Jan 4, 2025

Yes but in a different way. I described below how. I hope it is clear and helps :)

Description of the bug at my setup:

xTaskGetTickCount returns xTickCount. xTickCount is increased by systick timer interrupt. Since we disabled all interrupts, xTickCount never changes.

My workaround:

I have setup a new timer with huge prescaler and does not depend on interrupt.
Screenshot from 2025-01-04 19-06-40
Instead of xTaskGetTickCount I use:
Screenshot from 2025-01-04 19-10-05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants