FreeRTOS V7.5.0 released

A week ago, the updated FreeRTOS V7.5.0 has been released on FreeRTOS.org. So time to have my Processor Expert FreeRTOS component updated as well :-).

FreeRTOS V7.5.0

FreeRTOS V7.5.0

Supported Microcontroller, Compilers and Tool Chains

The Processor Expert component supports now the following Freescale architectures (DSC support is still experimental)

  • HCS08
  • HCS12(X)
  • ColdFire V1 and ColdFire V2
  • Kinetis K and L (Cortex M0+, M4 and M4F cores)

Following compilers/tool chains are supported, where Keil µVision has been recently added:

Keil µVision 4.x is now officially supported with FreeRTOS, and an example project can be found on GitHub here.

Changes

V7.5.0 comes with improved and multiple scheduling support. I noticed that the code size of my application was reduced by a few hundred bytes by this which is always welcome.

There has been a few other API and source changes:

  • vTaskList() and vTaskGetRunTimeStats() are now considered ‘legacy’. I’m still using them in my Shell command line interface implemenation, but they will be replaced with using the more portable uxTaskGetSystemState() implementation.
  • vTaskIncrementTick() is now called xTaskIncrementTick(), as it returns now a value. The return value tells the caller if a context switch shall happen. This is reflected now in all ports supported.
  • New function uxTaskGetSystemState(), see http://www.freertos.org/uxTaskGetSystemState.html
  • New xQueueOverwrite(), see http://www.freertos.org/xQueueOverwrite.html
  • New xQueueOverwriteFromISR() and xQueuePeekFromISR()
  • The RTOS core is PC-linted, and compiles without warnings on supported compilers.

Additional details are in the FreeRTOS release notes.

Queue Sets

Queue sets had been added in FreeRTOS 7.4.0, and have now an UI in the Processor Expert component. Queue sets provide a mechanism to allow an RTOS task to block on a read operation from multiple RTOS queues or semaphores simultaneously.

As using queue sets add some overhead, it is disabled by default:

Queue Sets Property in FreeRTOS Component

Queue Sets Property in FreeRTOS Component

If enabled, the Queue Set API functions are enabled too:

New Queue Set API

New Queue Set API

Summary

The Processor Expert FreeRTOS component has been upgraded to the latest version of the FreeRTOS with many improvements. With a single Processor Expert component, 7 different Freescale microprocessor families, 5 IDE’s and 7 different compilers are supported :-).

I have exported the components as *.PEupd files on GitHub.

Happy Updating 🙂

50 thoughts on “FreeRTOS V7.5.0 released

  1. I’m a fan of this component Erich, thanks!
    Special thanks for your time exporting the .PEupd version!

    Regards,
    Juan

    Like

    • Hi Juan,
      glad to hear that this is useful for you. Just in case you are using the FreeRTOS+Trace part too: I’m in the process of porting this to the latest V2.5.0 too 🙂

      Like

    • Thank you so much for your respond.
      Yes, Eric. I am using your USB MSD Host for the Freedom Board . It is working fine, however, If I want to write or read a text file for data logging , there is no such command. copy,cd,dir,rename commands are working fine.

      Best regards,
      Liong Lee

      Like

      • Hi Liong,
        yes, there are no shell commands for ‘data logging’, because that’s the job of the application. I mean the shell has no idea what you are going to log (temperature? accelerometer? something else?) and in which format. You have to implement this in the application.

        I hope this helps.

        Like

  2. Hi Erich, I am a fan of your website. I am interesting in creating a log file using USB Flash Memory. I used VINCO for reading and writing to USB Flash Memory, but now I am trying to use KL25Z128 to read and write to USB Flash Memory. VINCO has function to read and write to USB Flash Memory, but I do not see read and write function to USB Flash Memory in Freedom_USBHostMSD project Could you give me a hint as a starting point to read and write to USB Flash Memory using KL25Z128?

    Like

    • Hi Harry,
      thanks :-). The Freedom_USBHostMSD project is using a file system (FatFS). With this one, you can read/write files. It would be possible to use the low level functions to read/write directly the FLASH blocks, but that’s probably not what you want. You can use the normal f_open(), f_write(), f_read() and f_close() functions.

      Like

  3. Hi Erich,
    I am a beginner for FreeRTOS, and try to implementing it into my S12G128 board!
    However, once I try to import *.PEupd into CodeWarrior v5.1 that got the warring message, unkown file format; not sure my procedure correct or not, but does this support v5.1 platform?

    Like

    • Have you used the menu Processor Expert > Import Beans (or something like this) to import it? One thing I have seen that depending on your internet connection the download might result in a corrupted file. You might try to re-download the files again. Or better download them as a .zip file. On GitHub there is on the right hand side a button ‘Download ZIP’.

      Like

      • hi Erich and Hong,
        I am also porting FreeRTOS on S12G128 on a bareboard. I am a beginner. I just wanted to ask what if I dont want to use Processor Expert. What all files I have to import in my project and what all things I have to modify accordingly to make FreeRTOS run?
        It will be a great help.

        Like

        • Hi Nukul,
          why don’t you want to use Processor Expert? It makes things so much easier, especially for a beginner. And if you do not like it, you can simply take the sources and use it without Processor Expert. I recommend to give it a try.

          Like

        • Erich,
          Actually the thing is that I am working in an automotive industry. We use bareboards and bare codes to implement. I m trying to make a middle layer with RTOS but strictly want to put things in my hands thats why PE is not a good option but FreeRTOS is. SO if you can help me out with that. it will be great 🙂

          Like

        • That’s funny. In my previous job developing software for the automotive industry the requirement was to use code generation tool like Processor Expert as this improved the safety and reliability of code :-). Maybe you have missed it, but there is a non-PEx port available for HCS12 in FreeRTOS (e.g. V8.0.0) under Source\portable\CodeWarrior\HCS12.

          Like

  4. Pingback: A new Freedom Board: FRDM-KL46Z | MCU on Eclipse

  5. Hi Erich,

    Thanks for the PEx components and posts,I have a problem when I am trying the freeRTOS component on myFRDM K25 RevD board with a simple task project with a para passed to task. If the parameter is pointer to a int, it works fine. But with a pointer to a struct, like the following code, the value of the element in the structure gets lost. I checked pointer address for the structure, it is the same in task create function and in the task. and FRTOS1_xTaskCreate() returns okay.

    Harry

    Like

      • I think so, and i got same address for the pointer in task function and create function. Here are the code and result:

        typedef struct{
        uint8_t dummy;
        }task_para_t;

        static void test_task( void * h){
        task_para_t * p = (task_para_t *) h;\
        printf(“%s: %p %d\n”, p, p->dummy);
        for(;;){
        }
        }

        void main_task( void ){
        task_para_t foo;
        foo.dummy = 22;
        printf(“%s: %p %d\n”,__func__,&boo, boo.dummy);
        portBASE_TYPE ret = FRTOS1_xTaskCreate(test_task, “tester”,512,(void *)&foo, 1, NULL);
        printf(“ret = %d\n”,ret);
        FRTOS1_vTaskStartScheduler();
        }

        Result:
        Tasks_app: 0x20002fe0 22
        ret = 1
        log_task: 0x20002fe0 0

        Like

        • I appologize for the late answer: I thought I had posted my reply yesterday, but somehow it was lost 😦
          I see that you are using printf() which is a very bad thing: I think printf() causes a stack overflow or something like this to you.
          Please try this without printf() (see https://mcuoneclipse.com/2013/04/19/why-i-dont-like-printf/).
          The other thing is: you have the variable ‘foo’ on the stack before calling vTaskStartScheduler(). While I think that’s ok (but dangerous too, as the RTOS will switch to its own stack), can you try to have ‘foo’ as a global variable?

          Like

  6. Hi Eric,

    I started building a project with a MKL16Z128VLH4. This processor has a cortex M0+ core. When I install the FreeRTOS, and set the ARM Family to M0+, I get a compile error:

    Description Resource Path Location Type
    ERROR: “Library Lowest Interrupt Priority (15) is larger than Lowest Interrupt Priority (3). Priority shall be <= 3." KuhlStat16 FRTOS1 Processor Expert Problem

    The Lowest Interrupt Priority =3.

    If I set the ARM Family to M4, the project compiles without error.

    Is this a bug, or is there a work around for the M0+ setting?

    Thanks,

    George

    Like

  7. when add FreeRTOS component in PE with using M0+ core, the Max SysCall Interrupt Priority and RTOS Interrupt Priority default setting are wrong(in 5 and 15), but M0+ only have 3 in lowest,
    this just not a porblem, its a place may go wrong when using the component.

    Like

    • Ok, I see. The component does not automatically change the priority settings. By default it is using M4. If you then switch to M0+, it does not overwrite the previous settings. I was thinking about automatically changing the RTOS priority say to 3. But I was afraid that if someone changes from M4 to M0+ (just to check it out), his M4 settings are overwritten. Are you suggesting that overwriting the M4 values with M0+ levels (e.g. with 3 and 1) would not be a problem? I should be able to do this :-). Let me know if this is a bad or good idea.

      Like

  8. Pingback: RNet: A Simple Open Source Radio Network Stack | MCU on Eclipse

  9. Hi Erich,
    I just install FreeRTOS(V7.5.0), working in CW10.5 and wict a S08 MCU, but I can’t set SWI correct proporty. after build and inspect ‘Vectors.c’, vPortYieldISR have been set to Vrti, but not Vswi.
    could you help me how to set Vswi point to vPortYieldISR,

    Like

  10. Hey Erich,
    It looks like this FreeRTOS port actually does not support floating point….
    If you enable it, the macro is empty in FreeRTOS.h:

    #ifndef portTASK_USES_FLOATING_POINT
    #define portTASK_USES_FLOATING_POINT()
    #endif

    And if you try to do some floating point in a task you get a hard fault (not always, though, depends on how complex it seems, probably to do with the stack)

    I believe a function vPortTaskUsesFPU() should be defined, and some other stuff, for this to work?

    Like

    • Hmm, it should, but I admit I have not used it much on a M4F with floating point enabled. Which CPU are you targeting? Have you set the processor to M4F in the FreeRTOS component properties?

      Like

      • I’m targeting a K20F120… yes in the PE component I have M4F and floating point support set to yes. I’m also pulling in standard libraries so I can get libm, including math.h and using a sin() function. Oddly, using sin() in one place worked OK, but when I added it another place the whole thing hard faults… maybe I’m doing something wrong, I’m still investigating, but it seems there should be some stuff going on (unless that’s for older versions of FreeRTOS, lots of stuff out on the web, it’s not clear 10% what’s current…).

        Like

        • The latest version is 8.0.0. I have not touched the floating point support for a while. What is different with enabling floating point is a) that FPU is enabled at RTOS start and b) the stack frame/context switch is checking if floating point is used in the task. At least with the small examples I used, that was working fine for me.

          Like

        • That’s strange, I think the compiler options (in project settings) should do this already? I have under Target Processor:
          Float ABI: FPU SP only (-mfloat-abi=softfp -fshort-double)
          FPU Type: FPv4-SP-D16 (-mfpu=fpv4-sp-d16)
          Maybe this is not set for you?

          Like

      • I had all those options set already, but that define wasn’t defined… and I was digging thru library code and saw that it probably should be, so I tried it and it worked… maybe it’s an artifact of the way I made the project (based on your blog post on how to get PE running with C++, editing the .cproject file etc)?

        Like

        • Not sure. I have to admit that I played only a little with floating point: I avoid usage of floating point whenever possible. Adding a define sounds odd to me. Where you using CodeWarrior (EWL libraries) or something different?

          Like

    • Well I’m using a K20F120M specifically to do audio signal processing, a big reason the part was selected was the hardware floating point…. I started to notice this when I started adding more floating point to the project, and it seems like it’s something to do with the stack and save/restore float registers on function calls, when you only have a little floating point it doesn’t manifest. But after adding a couple of different sections in a function to calculate sin() tables on the fly that it started crashing… there isn’t much on the freescale forums on floating point either, either noone is having these problems or not many are using the FPU. The float example code is not demanding at all (where’s the FFT example? ha!)

      Like

  11. I think I found a bug… when you enable the shell, and have memory management scheme 3 (wrapped malloc), then the PrintStatus function in FRTOS1.c should not include the ‘free heap’ report, as there is no FRTOS1_xPortGetFreeHeapSize and AFAICT no system call to find out available heap space….

    Like

    • …and a worse one… it won’t run at all. gets a malloc error upon creating the first task. Appears to be due to the GCC/Kinetis malloc routine checking for collision with the stack by checking the stack pointer, which FreeRTOS sets in the heap (reminded of that here lpcware.com/content/faq/malloc-failure-using-freertos-heap3c-lpcxpresso-tool-chain). I really don’t want to recompile the EWL library (looks like if it were with alloc.c::HEAP_GROWS==0 that might work)… not sure what the options are. Maybe, in the heap3.c wrapper, saving SP, setting SP to SP_MAIN, doing the malloc, then restoring after?

      Like

      • I think I have never used the malloc scheme. I agree with you, recompiling the EWL libraries will be a night mare. I assume you have your reasons why to use malloc() for the rest of the application? I usually avoid using malloc() from the library, and instead I’m using the FreeRTOS heap malloc. Would that be possible for you?

        Like

      • Hi Erich,
        The reason is that I’m trying to integrate C++ functions with FreeRTOS (namely, parts of https://ccrma.stanford.edu/software/stk/). C++ uses the system heap for new() of course. If I use one of FreeRTOS’s private heaps, I have either lots of wasted memory or lots of time tuning the two heap sizes, both of which I’ve tried and I’m not really happy with those solutions. It would be so much better if they were unified.
        I know people complain that malloc is dicey but I looked at the code in the EWL malloc and it’s not bad at all, it’s comparable to heap_4 in size and complexity. I think the claims of indeterminism of malloc() are true but way overblown.
        In any case I posted the question to the FreeRTOS SF group as well… considering how FreeRTOS uses the stack pointers in the ARM, I don’t see how it would ever work with EWL – other ARM vendor’s mallocs might not do a heap/stack crash test the same way, though it looks like LPCWare might have the same problem.
        I would add that, if one were to want to use FreeRTOS for a packet processing application like using LwIP, I would think that malloc’s slightly more advanced memory coalescing would be a great benefit over heap_4, since that kind of application has to constantly create and destroy varying sized structures. Otherwise you’d be stuck with your own memory management using a pool, etc.
        Best,
        Marc

        Like

        • Hi Marc,
          yes, that’s kind of what I expected. So far I had not had the need to use the normal malloc() (lucky me!). I’m affraid that I’m probably not of a big help here. I saw your message in the FreeRTOS forum, so I hope there will be a solution.

          Best,
          Erich

          Like

Leave a reply to hxlich Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.