Jump to content

FreeRTOS


JoergSH

Recommended Posts

Hello Jörg,

I am successfully running uGFX on FreeRTOS. This means that the port already exists and runs. It would only require some cleanup to include it into the repository.

If you're intetesed, I can send it to you. It would be nice if you could clean it up and contribute it back. It should not take any longer than 30 minutes to complete the job.

Please send an e-mail to the adress listed on the website.

~ Tectu

Link to comment
Share on other sites

  • 2 weeks later...

Hello Tectu,

I have a lot of work to do for my job and I have not so many experience in programming, but I am interested in testing the new FreeRTOS port.

I have some LPCXpresso boards + TFT-Display + SSD1963-Controller-Board, which I want to use with the µGFX embedded GUI. :D

What I have to do to get the created port for FreeRTOS?

Florian

Link to comment
Share on other sites

Hello Florian,

There's a branch called freertos in the git repository. In there you will find src/gos/freertos.c and include/gos/freertos.h. These files are included in src/gos/gos.mk and in include/gos/gos.h. This way you can either pick them into your current repository or simply use the branch as it is.

The only thing that you should have to modify are the delay functions inside the freertos.c file. Everything else should work as it is there.

Just one question: Did you ever run FreeRTOS successfully on your hardware before? Otherwise I would suggest you to start with that. Note that FreeRTOS does not come with any HAL like ChibiOS/RT comes. Therefore you'll have to include your own!

Please keep us up to do date :)

~ Tectu

Link to comment
Share on other sites

Hello Tectu,

The FreeRTOS example project for my XPresso boards is working well and now I want to add my display (display SSD1963 board and the display) and the µgfx-GUI. Then I want to take a first try with one of the example project from µgfx.

Tomorrow I will see the difference between the branch called freertos in the git repository and my at the moment not tested version (Creating started in January).

What do you mean with "The only thing that you should have to modify are the delay functions inside the freertos.c file.". One more question: Have you create a HAL for FreeRTOS?

Thanks, Florian

Link to comment
Share on other sites

Hello again,

The problem for me is the "TIME_INFINITE" define. I think that FreeRTOS has not such a functionality. Example of my implementation:

void gfxSleepMilliseconds(delaytime_t ms) {
switch(ms) {
case TIME_IMMEDIATE: taskYIELD(); return;
case TIME_INFINITE: vTaskDelay(TIME_INFINITE); return;
default: vTaskDelay(ms / portTICK_RATE_MS); return;
}
}

The define TIME_INFINITE in the repository is "#define TIME_INFINITE ((delaytime_t)-1)".

I want to use it with my implementation, but in my documents there is no information about an "infinite" wait within the vTaskDelay() function.

If you think my implementation is OK then I want to share it (like the version of the gfxSleepMilliseconds() function above).

One more question:

Function gfxThreadCreate(): Why do you have a for-loop after the call of xTaskCreate() (if the return value is pdTRUE)?

Thanks,

Florian

Link to comment
Share on other sites

The problem for me is the "TIME_INFINITE" define. I think that FreeRTOS has not such a functionality.

The delay functions provided by FreeRTOS do indeed not provide such a thing, but this is also not vital. If TIME_INFINITE is passed to the gfxSleepXxx() function, this means that the thread should never continue at all. You'd either let the task sleep forever using the FreeRTOS API or you'd simply call delays of 100ms or something in an infinite loop. You can take a look at the ChibiOS/RT port for the former solution.

Function gfxThreadCreate(): Why do you have a for-loop after the call of xTaskCreate() (if the return value is pdTRUE)?

If xTaskCreate() does return something other than pdPass, this means that the thread could not be created. Therefore µGFX can simply not run at all. The for(;;) is a simple infinite loop so the program will not continue to execute. Debugging of the application is easier this way because inifinite loops can be spotted easily.

~ Tectu

Link to comment
Share on other sites

If TIME_INFINITE is passed to the gfxSleepXxx() function, this means that the thread should never continue at all. You'd either let the task sleep forever using the FreeRTOS API or you'd simply call delays of 100ms or something in an infinite loop. You can take a look at the ChibiOS/RT port for the former solution.

In this case we have to use "vTaskSuspend(NULL)" I think. Then the task is not deleted, but sleep forever. Do you think so too?

Thanks,

Florian

Link to comment
Share on other sites

In this case we have to use "vTaskSuspend(NULL)" I think. Then the task is not deleted, but sleep forever. Do you think so too?

Looks absolutely correct to me. Note that you have to add a macro check for INCLUDE_vTaskSuspend at the top of the freertos.c file just as we already check for the mutexes and semaphores.

~ Tectu

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...