• AVR Freaks

Helpful ReplyHot!Has anyone one actually ported the freeRTOS to onto xc8?

Page: 12 > Showing page 1 of 2
Author
abhi143
Junior Member
  • Total Posts : 115
  • Reward points : 0
  • Joined: 2018/05/20 09:06:52
  • Location: 0
  • Status: offline
2020/02/25 22:43:48 (permalink)
0

Has anyone one actually ported the freeRTOS to onto xc8?

Hello
I only have MPLABX v 4.15 with xc8 compiler.  I was just curious to know if anyone has successfully ported FreeRTOS to any PIC devices using MPLAB-Xc8 and wouldn’t mind sharing the procedure. if I want to port free ratos Should I change compiler something like xc16 or c32
#1
ric
Super Member
  • Total Posts : 27072
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/25 22:49:31 (permalink)
0
XC8 is only for 8 bit processors, which only have a tiny hardware stack and very limited support for context saving.
XC16 is only for 16 bit PICs, and XC32 is only for 32 bit PICs.
So, you have to decide which PIC processor can do the job before deciding on the compiler.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
LdB_ECM
Super Member
  • Total Posts : 359
  • Reward points : 0
  • Joined: 2019/04/16 22:01:25
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 07:40:04 (permalink)
+2 (2)
When you download the FreeRTOS source code goto the FreeRTOSv10.2.1\FreeRTOS\Demo directory and walk down to Pic and you will find ported examples
 
PIC18_MPLAB is a port onto a 18f452 not sure what others work
PIC24_MPLAB is a port on any of the PIC24, PIC33 devices don't know of any that wont work
PIC32MX_MPLAB obviously all that range
PIC32MZ_MPLAB obviously all that range
 
I use the Pic24 all the time and it is fantastic on those. It basically comes down to can you get a good context switch code on the device. 
 
It looks rather overwhelming at first but it really is only 10-12 files depending on what features you want.
 
If you need a hand with the port drop a post, I have done it so many times I can almost do it in my sleep :-)
#3
Jim Nickerson
User 452
  • Total Posts : 6659
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 07:47:49 (permalink)
+1 (3)
Do you mind sharing what you intend to do with the "RTOS" once you have it ?
#4
LdB_ECM
Super Member
  • Total Posts : 359
  • Reward points : 0
  • Joined: 2019/04/16 22:01:25
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 07:52:33 (permalink)
-2 (4)
That is a weird question, you basically use it so you don't have to write stupid complex superloops that can not be ported. That would be the number one use of it.
#5
Jim Nickerson
User 452
  • Total Posts : 6659
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 07:57:50 (permalink)
0
LdB_ECM
That is a weird question, you basically use it so you don't have to write stupid complex superloops that can not be ported. That would be the number one use of it.


I have found each individual has a specific use for the RTOS, frequently as it turns out there might be an alternative solution.
I think the RTOS is a complex solution that takes requires one to be quite mindful when using it.
 
#6
Jim Nickerson
User 452
  • Total Posts : 6659
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 07:59:00 (permalink)
+1 (1)
LdB_ECM,
do note it was not I who down voted your answer
#7
Howard Long
Super Member
  • Total Posts : 796
  • Reward points : 0
  • Joined: 2005/04/04 08:50:32
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 08:01:56 (permalink)
+3 (3)
Respectfully, I think it's a very valid question.
 
Experience tells me that if you think you need an RTOS for an 8 bit PIC application, (a) you're trying to provide a solution before understanding the problem, and (b) you're trying to fit a square peg into a round hole.
#8
LdB_ECM
Super Member
  • Total Posts : 359
  • Reward points : 0
  • Joined: 2019/04/16 22:01:25
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 08:04:32 (permalink) ☄ Helpfulby abhi143 2020/02/26 08:31:55
+2 (2)
It's only complex the first time when you are learning, after that it becomes second nature. Compared to trying to explain and get a superloop running right it's a walk in park.
 
I am not sure I would use it on an 8bit MCU but then it comes down to are you setting up a superloop on the 8 bit MCU and can it context switch neatly.
 
My care factor on a down vote on this forum is lower than your could ever imagine :-)
 
The OP asked a question I answered, if he needs help I am happy to do so. He can test easily and see if it works for him given all the code exists you just need to drag it into a project it not like he is going to spend days setting it up.
post edited by LdB_ECM - 2020/02/26 08:12:37
#9
Jim Nickerson
User 452
  • Total Posts : 6659
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 08:13:15 (permalink)
0
tough crowd Howard Smile: Smile
#10
abhi143
Junior Member
  • Total Posts : 115
  • Reward points : 0
  • Joined: 2018/05/20 09:06:52
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 08:31:42 (permalink)
0
ric
XC8 is only for 8 bit processors, which only have a tiny hardware stack and very limited support for context saving.
XC16 is only for 16 bit PICs, and XC32 is only for 32 bit PICs.
So, you have to decide which PIC processor can do the job before deciding on the compiler.

I have downloaded both now
Edit: I have download xc32 but how to include it in IDE. I have attached screenshot 
 
JANickerson
Do you mind sharing what you intend to do with the "RTOS" once you have it ?

I want to learn rtos I think the best way is to first run some sample code on the IDE and see how they work.
After that we can study that code
I have selected my IDE and Micro 16 bit and 32 bit. First of all my attempt is to run the sample code on IDE



post edited by abhi143 - 2020/02/26 08:59:15

Attachment(s)

Attachments are not available: Download requirements not met
#11
abhi143
Junior Member
  • Total Posts : 115
  • Reward points : 0
  • Joined: 2018/05/20 09:06:52
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 08:41:56 (permalink)
0
LdB_ECMThe OP asked a question I answered, if he needs help I am happy to do so. He can test easily and see if it works for him given all the code exists you just need to drag it into a project it not like he is going to spend days setting it up.

Everyone has their own style of learning. And I don't think something bad if we look at the sample code. It will be a big help if you can share your work

Attachment(s)

Attachments are not available: Download requirements not met
#12
LdB_ECM
Super Member
  • Total Posts : 359
  • Reward points : 0
  • Joined: 2019/04/16 22:01:25
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 09:23:17 (permalink)
0
Just pick a MCU I already have a few out on GitHub but happy to set one up
 
This is a basic example it just sets up a heart beat LED on a Pic24F
https://github.com/LdB-ECM/PIC24F_FreeRTOS
You should be able to just open that in MPLAB
 
To be able to really do anything serious I obviously need connections to peripherals.
If you just want to mess about I would start with an SPI GRAPHICAL LCD or even just a 16x2 LCD
 
Cheap ones that might interest you and I have played with is ILI9341 controller type
These are 320x240 16 bit colour and under $10USD
https://github.com/LdB-ECM/PI_SPI_LCD
 
There OLED 128x128 type based on the SSD1327 type are also common but a bit more expensive
https://github.com/LdB-ECM/SSD1327_Linux_v1
 
The code on those are linux on Github as a couple of people were asking me how to do it but I have the code for them on PIC as well.
#13
LdB_ECM
Super Member
  • Total Posts : 359
  • Reward points : 0
  • Joined: 2019/04/16 22:01:25
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 09:32:38 (permalink)
0
I threw up my SPI driver which works both under linux and on PIC24F which might help if you go that path
https://github.com/LdB-ECM/SPI_linux_Pic24
#14
NKurzman
A Guy on the Net
  • Total Posts : 18678
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 09:53:17 (permalink)
+4 (4)
LdB_ECM
That is a weird question, you basically use it so you don't have to write stupid complex superloops that can not be ported. That would be the number one use of it.



No, the Question is Not what you intend to do with the "RTOS".  It is what you intend to do with the "RTOS" on an 8 bit PIC.  That question is valid since it sounds like a bad idea.  There may be a use case for it.  But it would be rare and require someone that had the skill to do it.
#15
simong123
Lab Member No. 003
  • Total Posts : 1391
  • Reward points : 0
  • Joined: 2012/02/07 18:21:03
  • Location: Future Gadget Lab (UK Branch)
  • Status: online
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 10:30:52 (permalink) ☄ Helpfulby Jim Nickerson 2020/02/26 10:40:26
+7 (7)
LdB_ECM
That is a weird question, you basically use it so you don't have to write stupid complex superloops that can not be ported. That would be the number one use of it.

So don't write stupid complex superloops. Write clever simple superloops :-D
 
I don't think that superloops/state machines are any less portable than any other hardware drivers if written with portability in mind from the outset (i.e. a proper HAL to separate application code from driver code). However I do think there are use cases for RTOS's for certain applications e.g. user interaction with complex GUI's, and there is never any harm in learning. But I would stick to MCU's with enough resources e.g. PIC24/32. It may be possible on PIC16/18, but not really usefull.
#16
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11824
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 10:49:56 (permalink)
0
LdB_ECM
That is a weird question, you basically use it so you don't have to write stupid complex superloops that can not be ported. That would be the number one use of it.

 
Surprisingly, there are options for 8-bit PICs other than an RTOS or a "complex superloop".
#17
NKurzman
A Guy on the Net
  • Total Posts : 18678
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 10:52:01 (permalink)
+2 (2)
If you want a Use Case for an RTOS it is Harmony.  Its Drivers often do not honor time slice restrictions.  Mixed with user code "bugs" that do the same, hilarity can ensue.
honoring certain timing can be more difficult without an RTOS.  While Simple projects end up more complicated if an RTOS is added. 
While It could be fixed.  They choose not to.  I am not sure I disagree with their choice.
All RTOS Projects can be written without an RTOS.  The Question is does the RTOS make a project "better".  The answer is sometimes yes, sometimes no,  and sometimes either way is about the same.
The choice is made via a process called "Engineering"
 
My 2 cents, Your 2 cents may vary.
#18
LdB_ECM
Super Member
  • Total Posts : 359
  • Reward points : 0
  • Joined: 2019/04/16 22:01:25
  • Location: 0
  • Status: offline
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 12:35:45 (permalink)
+1 (1)
I would strongly suggest not ever using Harmony if you are intending to actually learn how to use an RTOS, yes it does lots of stupid things that you would not wish on your worst enemy. It has no clear concept under it and leaves out standard common practices like device contexts.
 
For my part is all I see is lots of posts from people who don't program in or even use an RTOS about what an RTOS will and won't do. If you want to actually have an opinion that matters at least have written code in FreeRTOS and explain what was good or bad about it. I have lost count of the times I have had people complain about an RTOS and then show you how they are coding for it and you have to explain basic concepts they have not grasped.
 
I would also add the big plus in learning any of the good RTOS systems like FreeRTOS is you can easily walk straight into pthreads and posix/ linux and windows. Your code almost ports directly you just change the names
       FREERTOS                   POSIX/LINUX                WINDOWS
===============================================
       vTaskDelay        =           usleep           =             sleep
xSemaphoreCreateBinary  =      sem_init         =       CreateSemaphore
xSemaphoreTake        =           sem_wait       =      WaitForSingleObject
xSemaphoreGive         =          sem_post       =       ReleaseSemaphore
vSemaphoreDelete       =        sem_destroy     =         CloseHandle
#19
NorthGuy
Super Member
  • Total Posts : 6099
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: online
Re: Has anyone one actually ported the freeRTOS to onto xc8? 2020/02/26 12:41:54 (permalink)
+3 (3)
IMHO, the most common RTOS use case is as follows: You get a complex library A which does something without any regards on timing, and a complex library B which works in the same fashion. You test them both separately and they both work somehow, but now you need to make them work at the same time. So, you have to use RTOS or part with the libraries.
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2020 APG vNext Commercial Version 4.5