FreeRTOS for MCF5213 & CodeWarrior

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

FreeRTOS for MCF5213 & CodeWarrior

5,853 Views
Nouchi
Senior Contributor II
Hi,
 
Here's an new FreeRTOS port for MCF5213.
This port doesn't support nested interrupts (but it could be easily made)
All improvements are welcome....
Please visit  http://www.FreeRTOS.org for documentation.
 
Regards,
Emmanuel

Message Edited by BugMan on 2006-10-2010:47 AM

 

FreeRTOSV4.1.0.zip

Message Edited by t.dowe on 2009-09-02 04:12 PM
Labels (1)
0 Kudos
15 Replies

1,369 Views
jayaramsubraman
Contributor I

Hi,

I found that you were working on FreeRTOS. So it would be great if you have idea on this.

I am using coldfire mcf52259 demo kit. I have tried running the examples with MQX and it is working fine.

Now i want to port the FreeRTOS using Code Warrior5.9.0 on this demo kit. I am able to compile the program. But when I press debug(F5), I get this error

"Cold fire PE Protocol: No USB connection found". 

Has anyone used FreeRTOS in mcf52259. I used the rtosdemo project available in Freertos for coldfire mcf52259 demo kit.

Can we use tools--->flashprogrammer---->program to download the program.

I tried that though it didn't work.

Any suggestions would be very helpful.

Thank you.

0 Kudos

1,369 Views
JimDon
Senior Contributor III

First of all, why do you hijack a 4 year old thread and not just start one with your question?

It is unlikely that the OP is going to jump in and help now.

>Has anyone used FreeRTOS in mcf52259.

Since there is an official port for the part, I think the answer might be yes.

If you used the zip file from this thread, it is way out of date. FreeRTOS is at like 7.4 now.

Codewarrior 5.9.0? I think that is the IDE not the version of codewarrior.

You should be able to debug the project, if the project is set up correctly. Try downloading the latest version of FreeRTOS and try the ColdFire_MCF52259_CodeWarrior project. Perhaps you have already done that, but then I ask again why the 4 year old thread?

0 Kudos

1,369 Views
jayaramsubraman
Contributor I

Hi,

Thanks for replying.

I should have created a new post. My bad. I will post it again in a new post.

I have already tried the ColdFire_MCF52259_CodeWarrior project in FreeRTOS 7.4. It didn't work .

0 Kudos

1,369 Views
Nouchi
Senior Contributor II
Steps

1. Download the attached zip file
2. Unpack it into a directory.
3. Open the \FreeRTOSV4.1.0\Demo\MCF5213evb_CodeWarrior\MCF5213evb_CodeWarrior.mcp project in CodeWarrior 6.3.
4. Compile
5. Use flash tools to program M5213EVB.
6. Play with it
7. enjoy! (maybe)


Thanks to Richard Barry for providing a great operating system.

Message Edited by BugMan on 2006-10-2011:28 AM

0 Kudos

1,369 Views
Nouchi
Senior Contributor II

Hello,


I forgot in the previous release, to managed nesting critical sections.
Sorry

Emmanuel

 

FreeRTOSV4.1.2.zip

Message Edited by t.dowe on 2009-09-02 04:13 PM
0 Kudos

1,369 Views
hwn
Contributor I
Hi Emmanuel,
 
i have a problem with your freeRTOS-Port 4.1.2 for the Coldfire MCF5213.
 
I tested it with Codewarrior V7.0.
 
The Function "pvPortMalloc" calls "malloc" and this returns NULL as Pointer.
So the Scheduler ends and no task starts!
 
Do you have a solution?
 
Best regards Werner
 
 
0 Kudos

1,369 Views
Nouchi
Senior Contributor II
Hi Werner,

I fixed this problem in port.c, in pxPortInitialiseStack function, you have to initialize A5 register with _SDA_BASE addresse like this:
Code:
 *pxTopOfStack = ( portSTACK_TYPE ) 0xA6; /* A6 / FP */ pxTopOfStack--;// *pxTopOfStack = ( portSTACK_TYPE ) 0xA5; /* A5 */ *pxTopOfStack = ( portSTACK_TYPE )&_SDA_BASE;  /* keep data pointer!!! used by CW7.1 compiler */ pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) 0xA4; /* A4 */ pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) 0xA3; /* A3 */

Because CW7.x seems to use A5 as base pointer for global data, so you have to maintain A5 value in each task, if you want right data access.
Without the right A5 value, malloc can't access to data to manage the heap so, it return "can't allocate memory".

In CW_ColdFire_Compiler_Notes.txt  (CW7.1), I saw that :
Code:
Addressing: The libraries are built with A5-relative addressing for data, this setting limits to 64K the amount of global data accessible. From the compiler perspective using the sdata (A5-relative) setting makes initialized data assigned to .sdata sections and uninitialized (or set to zero) data to .sbss sections. Using the far declaration specifier makes the compiler use 32-bits absolute addressing, the near specifier makes the compiler use 16-bits absolute addressing. Note that these near and far specifiers apply to declarations since they affect relocations, whereas definitions select a section.

 Which can explain the previous behavior.



Emmanuel

 



Message Edited by BugMan on 2008-09-30 04:13 PM
0 Kudos

1,369 Views
Nouchi
Senior Contributor II
Hello,


Here's an update of 5213 FreeRTOS  port.
Please, don't forget to visit http://www.freertos.org for documentation, history, and upgrade to V5
and have fun  :smileyhappy:
enhancements are welcome.....

Regards,
Emmanuel
 
Message Edited by t.dowe on 2009-09-02 04:14 PM
0 Kudos

1,369 Views
Nouchi
Senior Contributor II
Hello,

There's a mistake in serial.c, uart0Exeption function have to be modified as below
Code:
// xTaskWokenByPost = xQueueSendFromISR( xRxedChars, ( void * ) &ucByte, pdFALSE ); 
            xQueueSendFromISR( xRxedChars, ( void * ) &ucByte, &xTaskWokenByPost ); 

or download this

Emmanuel
 
Message Edited by t.dowe on 2009-09-02 04:17 PM
0 Kudos

1,369 Views
hwn
Contributor I
Hello,
today i tried "Codewarrior V6.4 Special Edition" and your freeRTOS "Version v.4.1.2
 
This combination works => 3 LED on my Board are flashing!
 
The problem must be in  Codewarrior V7.x!
 
Can you help me?
 
Best regards
 
Werner
 
0 Kudos

1,369 Views
Nouchi
Senior Contributor II
Hi Werner,

CodeWarrior isn't in fault, you should just configure the MSL librarie for your needs.
You seems to need floating point support, and you should disable tiny IO support, to do that you have to modify C:\Program Files\Freescale\CodeWarrior for ColdFire V7.1\ColdFire_Support\msl\MSL_C\MSL_ColdFire\Include\ansi_prefix.CF.size.h as below:


Code:
#define _MSL_FLOATING_POINT    1//#define _MSL_NO_MATH_LIB                    #undef _MSL_NO_MATH_LIB                    #endif#define _MSL_C_TINY_IO         0         #define _MSL_TINY_FILE_IO      0#define _MSL_FLOATING_POINT_IO 1

You should also replace in your project C_4i_CF_SZ_MSL.a (no floating point support) by C_4i_CF_MSL.a (full functionnality but bigger footprint).

C:\Program Files\Freescale\CodeWarrior for ColdFire V7.1\Help\PDF\ColdFire_Build_Tools_Reference.pdf chapter19, and  C:\Program Files\Freescale\CodeWarrior for ColdFire V7.1\Help\PDF\MSL_C_Reference.pdf are good reading I think.

Emmanuel.

0 Kudos

1,369 Views
hwn
Contributor I
Hello Emmanuel,
 
now i can compile and make freeRTOS (Your Project V.5.0.42).
 
It runs in my MCF5213-Board!
 
Thanks for your help!
 
Best regards
Werner
 
0 Kudos

1,369 Views
hwn
Contributor I
Hello,
 
sorry, but i have a new problem.
 
yesterday i installed the newest version of "Codewarrior Special Edition".
 
(File "CW_ColdFire_7.1_SE[1].exe" and Patch to Version 7.1.1 = file "CWCF_V7_1_1.exe").
 
Prior i used Version 7.0.
 
 
If i Compile the project, then the Compiler tells me the error:
 
*******************************************************************
Error   : function has no prototype
flop.c line 137     if( fabs( d4 - dAnswer ) > 0.001 ) 
Error   : function has no prototype
flop.c line 190     if( fabs( d4 - dAnswer ) > 0.001 ) 
Error   : function has no prototype
flop.c line 248     if( fabs( dDifference ) > 0.001 ) 
Error   : function has no prototype
flop.c line 305     if( fabs( dDifference ) > 0.001 ) 
*******************************************************************
I dont understand the reason for this message, but it comes from the library-function "fabs".
 
If i include my own prototype in "flop.c" like:
 
portDOUBLE fabs(portDOUBLE); // HWN 3.10.2008
compilation is OK!
 
But then the Linker reports me the error:
 
*******************************************************************
Link Error   : Multiply-defined: "remove" in list.c
Previously defined in croutine.c
Link Error   : Multiply-defined: "fopen" in list.c
Previously defined in croutine.c
Link Error   : Multiply-defined: "fputs" in list.c
Previously defined in croutine.c
Link Error   : Multiply-defined: "fgetc" in list.c
Previously defined in croutine.c
Link Error   : Multiply-defined: "fclose" in list.c
Previously defined in croutine.c
*******************************************************************
 
Do you know, what is wrong?
 
I must use the Special edition, because my students must have this costfree version for their home exercises!
 
Best regards Werner
 
0 Kudos

1,369 Views
hwn
Contributor I
Hi Emmanuel,
 
thank you for this very fast answer!
 
I made the change to "port.c". Now the compiler tells me the error message "Undefined identifier _SDA_BASE".
 
I made a copy and paste direct from your message, so the name "_SDA_BASE" must be correct!
 
 *pxTopOfStack = ( portSTACK_TYPE )&_SDA_BASE;  /* keep data pointer!!! used by CW7.1 compiler */
 
II used your original LCF-File and made no other changes.
 
Have you an idea for this problem?
 
 
Some words to my person:
I am Professor on the Fachhochschule Kaiserslautern Germany and a realtime os is like Codewarrior very new for me!
 
I want to use  freeRTOS in my Lab with my students for some exercises! We developed our own MCF5213-System with TBLCF debugger, alphanumerical and graphical LCD display and it works well.
Sorry for my bad english!
 
Best regards Werner
 
 
0 Kudos

1,369 Views
Nouchi
Senior Contributor II
Hi Werner,

Shame on me, the  original lcf file can't work with CW7.x.
I'll post here before the end of this week an update of the project.



Emmanuel
0 Kudos