FreeRTOS with CodeWarrior and PE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS with CodeWarrior and PE

2,567 Views
scottm
Senior Contributor II


Does anyone have any experience with FreeRTOS (particularly on K20 series parts) with CodeWarrior and Processor Expert - not KSDK?  I'm having trouble finding any documentation on that configuration, particularly on integration of FreeRTOS BSPs with PE.  I've been working with MQX lately but it sounds like FreeRTOS is going to be the better option going forward and if I can I'd like to make the switch before I go too far down a dead end.  I'll still be running CW and PE for the sake of maintaining parallel ColdFire projects so KDS/KSDK is not an option.

Thanks,

Scott

Labels (1)
8 Replies

1,986 Views
elecsmith
Contributor II

We do not use processor expert in our projects, but we use FreeRTOS in CodeWarrior with K10s/K20s with great success.  In general, FreeRTOS does not get in the way of drivers and vice-versa unless you try to interact with the RTOS in driver ISRs.  (This is still possible, but you have to make sure that interrupt priorities are set correctly and that you use the correct RTOS functions for ISRs).  I have not looked into processor expert, but I do not think that you would have a problem with this.  If you have more specific questions, feel free to ask.

0 Kudos
Reply

1,986 Views
scottm
Senior Contributor II

Thanks for the quick reply.  Thanks to MCUOnEclipse I was able to get a FreeRTOS "hello world" application running with a minimum of fuss.  Still no luck getting the third-party task aware debug to work, but I'll worry about that later.

I see that FreeRTOS has ...FromISR() event functions.  I assume these are the ones I'll use to notify my tasks from ISRs?  Pardon my ignorance, but how should the interrupt priorities be set up?  Does the ISR just need to be of lower priority than the RTOS interrupt so that it doesn't block when trying to call a privileged function?  The last time I touched FreeRTOS was several years ago and I'm awfully rusty.

Thanks,

Scott

0 Kudos
Reply

1,986 Views
elecsmith
Contributor II
I see that FreeRTOS has ...FromISR() event functions. I assume these are the ones I'll use to notify my tasks from ISRs?

Yes.

Pardon my ignorance, but how should the interrupt priorities be set up? Does the ISR just need to be of lower priority than the RTOS interrupt so that it doesn't block when trying to call a privileged function?

Exactly!  Interrupts that do not interact with the RTOS can be any priority, but those that do must be a lower logical priority than the RTOS itself.  A good description is here:

http://www.freertos.org/RTOS-Cortex-M3-M4.html

1,986 Views
BlackNight
NXP Employee
NXP Employee

Hi Scott,

the _FromISR() functions are the ones you are allowed to call from an interrupt context (from an interrupt service routine). Interrupt priorities: The RTOS (SysTick and SV call interrupts) run with the lowest level. On Cortex M0+ the RTOS will block all interrupts. On M4(F) the RTOS will block interrupts up to MAX_SYSCALL level. I highly recommend to read this article:

RTOS for ARM Cortex-M

In conclusion: only call things with _FromISR() from an interrupt, and only do this with interrupts up to configMAX_SYSCALL_INTERRUPT_PRIORITY interrupt level.

Other than that: ARM Cortex-M0+ Interrupts and FreeRTOS | MCU on Eclipse

Erich

1,986 Views
scottm
Senior Contributor II

Nice to see you again, Erich.  You're like a one-man army when it comes to Kinetis and CodeWarrior support.  I really ought to set aside some time to read your blog from start to finish - it'd probably have saved me at least that much time by now.  I'll definitely have to check out any FreeRTOS USB demos you've got.  I think I've got a handle on the interrupt issues but I should take a look at a more complicated example.

Can you tell me if the StateViewer plugin can be made to work with the debugger in CodeWarrior 10.6, or is that only going to work with KDS?

Thanks,

Scott

0 Kudos
Reply

1,986 Views
BlackNight
NXP Employee
NXP Employee

Hi Scott,

:-)

About StateViewer: it only works with GDB, not with CodeWarrior. The reason is that CodeWarrior is using a custom debug engine, and the StateViewer API to the debugger only supports the GDB API. KDS does support it (see DIY Free Toolchain for Kinetis: Part 5 – FreeRTOS Eclipse Kernel Awareness with GDB | MCU on Eclipse ) as it is based on GDB.

Erich

1,986 Views
scottm
Senior Contributor II

Yeah, that's what I figured.  Oh well... I'll see how it goes without a task-aware debugger.  Thanks!

0 Kudos
Reply

1,986 Views
elecsmith
Contributor II

Codewarrior produces ELF files that I believe GDB should be able to use (haven't tried it).  You may still be able to compile with Codewarrior and debug with KDS or GDB if you need thread-awareness.

0 Kudos
Reply