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

Open
aslansq opened this issue Jan 2, 2025 · 12 comments
Open

task is blocked #12

aslansq opened this issue Jan 2, 2025 · 12 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

@ShawnHymel
Copy link
Owner

Interesting workaround...glad to see you got it working!

@aslansq
Copy link
Author

aslansq commented Jan 5, 2025

I am actually planning to implement all concepts from your video for zephry os. I making a lot of demos to put in my CV :)
I ll actually reopen this, since you have not tried. I do not think current implemantation on esp32 will work

@aslansq aslansq reopened this Jan 5, 2025
@ShawnHymel
Copy link
Owner

If it helps, I'm actually working on an "Intro to Zephyr" series next. My demo code is here if you'd like to take a look: https://github.com/ShawnHymel/introduction-to-zephyr. Only one episode covers RTOS stuff (basic multithreading and queues), so implementing the concepts from this series in Zephyr would be very helpful! Let me know, and I'll link to your work.

@aslansq
Copy link
Author

aslansq commented Jan 6, 2025

I am not sure, how much will it make sense to abstract with QEMU. This one was focused on SW concepts, just required a running core. That being said I am looking for challenge.
https://www.linkedin.com/in/mehmet-aslan-418674b0/
you can add me here. Send me a message what needs to emulated. I ll look if it is possible or make sense.

@ShawnHymel
Copy link
Owner

Added on LinkedIn! No worries on QEMU, I just figured my Intro to Zephyr repo might help getting started with Zephyr (if you have not already).

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