Hello BlackNight,
I have used your 'queue.c' file and there is an error because the linker says this: Symbol ulPortSetIPL in file queue.o is undefined.
When delete this parts:
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
It works well. I want to know if I must keep them or delete them.
Thank for your answer
Hello,
Are you using an earlier version of the FreeRTOS component?
It looks so, as earlier versions did not correctly support the message queue API to be called within an ISR.
E.g. are using the xQueueSendToFrontFromISR() routines, then you need the new version I just had posted on 2011-07-13 10:34 AM. This one correctly supports the message queue handling within ISR's.
BK
Hello,
attached is the latest version of the FreeRTOS component.
This one supports the S08 banked memory model and has fixed the issue with using queues within an ISR.
BK
Thanks for the quick answer BK!!
Ok i'll try your procedure and then i will report my result....only one question, you say to give a look to QE128 port, but i can't see it in your files. Where can I find it?
thanks again
Hello,
the Processor Expert component in the port is for all S08, in principle for all ColdFire V1 (I have tested it with CN, JM, QE, JE and MM family) and the ColdFire V2 (tested with 52259). That's the advantage of the Processor Expert component port: one port to cover a lot of architectures
If you want to see the port files: they are in
C:\ProgramData\Processor Expert\CWMCU_PE5_00\Drivers\freeRTOS
after you have imported the Processor Expert component.
BK
Hello, I have just started using freertos on a 9S08(GT60) using CW 6.2.
This is what I have:
3 tasks + 1 idle task.
Task1 : blocks for 100 ms using Vdelayuntil(). priority( idle+1)
Taks2: blocks for 50 ms using Vdelayuntil(). priority(idle+2)
Task3: blocks for a binary semaphore. priority(idle+3)
The semaphore is given by an interrupt generated by ( tim1 channel 1) every 100 ms. The interrupt rate is 10ms, and the TICKS_TO_WAIT is set to 10.
The RTOS tick is set at 1ms using tim1 channel 0 .
The problem:
When I have all three tasks running, the tasks are NOT running at their specified repeat rates. ( its all over the place).I am toggling an output pin in each of the tasks to determine the timing.
If I remove task2, then task1 and task3 run at the specified repeat rates.
Will appreciate any help/hints to this problem.
Thanks!!
Lav
// ------------------------------------------//
code snippets below
//---------------------------------//
*******************************************************************************
*
*
*
*******************************************************************************
*/
static void vTaskone( void *pvParameters )
{
// pvParameters = pvParameters;
portTickType xLastWakeTime;
const portTickType xFrequency = 100;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for( ;; )
{
//#if !defined(_FCS_)
// Wait for the next cycle.
vTaskDelayUntil( &xLastWakeTime, xFrequency );
PTDD_PTDD4 = ~PTDD_PTDD4;
//#endif
// vTaskDelay(500);
}
}
/*
*******************************************************************************
*
*
*
*******************************************************************************
*/
void vTaskTwo ( void *pvParameters )
{
// pvParameters = pvParameters;
portTickType xLastWakeTime;
const portTickType xFrequency = 50;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for (;
{
//#if !defined(_FCS_)
vTaskDelayUntil( &xLastWakeTime, xFrequency );
//PTDD_PTDD3 = ~PTDD_PTDD3;
//#endif
// vTaskDelay(250);
}
}
*******************************************************************************
*
*
*
*******************************************************************************
*/
void vTaskThree ( void *pvParameters )
{
// pvParameters = pvParameters;
/* We are using the semaphore for synchronisation so we create a binary
semaphore rather than a mutex. We must make sure that the interrupt
does not attempt to use the semaphore before it is created! */
vSemaphoreCreateBinary(tsk3_semphr);
for (;
{
/* We want this task to run every 30 ticks of a 10 ms timer. The semaphore
was created before this task was started.
Block waiting for the semaphore to become available. */
if( xSemaphoreTake( tsk3_semphr, LONG_TIME ) == pdTRUE )
{
PTDD_PTDD3 = ~PTDD_PTDD3;
}
}
}
*******************************************************************************
*
*
*
*******************************************************************************
*/
if (xTaskCreate( vTaskone, (const signed char *)"MyTaskone", configMINIMAL_STACK_SIZE , NULL, ( tskIDLE_PRIORITY + 1 ), NULL ) == pdFAIL)
{
for (; __asm ("nop");
}
if (xTaskCreate( vTaskTwo, (const signed char *)"MyTaskTwo", configMINIMAL_STACK_SIZE, NULL, ( tskIDLE_PRIORITY + 2 ), NULL ) == pdFAIL)
{
for (; __asm ("nop");
}
if (xTaskCreate( vTaskThree, (const signed char *)"MyTaskThree", configMINIMAL_STACK_SIZE, NULL, ( tskIDLE_PRIORITY + 3 ), NULL ) == pdFAIL)
{
for (; __asm ("nop");
}
There was a problem with the links in my original post. I've since moved to a new web platform. The files I originally posted are now here:
http://www.gadgetworks.com/?q=node/2
Tho' since that time there's been numerous changes and upgrades (I ported to FreeRTOS 4.x eons ago, but never posted that.) I'm happy to post the project files that represent "current state of things" in HCS08+FreeRTOS if anyone has significantly changed the project in a useful way. Just send me a message. (Did someone get this running on S08? I don't need that, but I'm curious.)
Jeff
hello, I use the jm60 with bootloader. I try for a few days with FreeRTOS but I have not been successful .. In the context changes and apparently lost the use asm in the port that is not right.
Could you share with your project? ...
Dear Ernesto,
As I have no experience with the JM60 or its bootloader I cannot be of any help to you. Good luck!
Miguel.
hello,
this is my first attempt to carry the FreeRTOS to JM60. My concern is that you can live with USB Bootloader.
In this attempt, use the sample code mcolina@aimme.es. Thank you very much for sharing the code with all.
ProcessorExpert not use, because I want to be fully ANSI-C.
In some ways the FreeRTOS operates within the FLASH memory locations that do not overwrite the bootloader. Reflects the tasks to scheduled times, but do not understand the reason why if I want to control 2 LEDs, change out of the scheduled times.
Below is the compiled project in CodeWarrior 6.3. Could you please help me check where it may be the problem? ..
main.c
/********************************************************//********************************************************//*-------------- Espacio para funciones ---------------*//********************************************************//* Standard includes. */#include <stdio.h>/* Scheduler includes. */#include "FreeRTOS.h"#include "task.h"#include "queue.h"#include "semphr.h"void led_task1(void *pvParameters){PTDDD_PTDDD2=1; //Configura pin de control de LED como salida for(;;){ PTDD_PTDD2=!PTDD_PTDD2; vTaskDelay(1000 / portTICK_RATE_MS); }}void led_task2(void *pvParameters){PTFDD_PTFDD5=1; //Configura pin de control de LED como salida for(;;){ PTFD_PTFD5=!PTFD_PTFD5; vTaskDelay(2000 / portTICK_RATE_MS); }}/********************************************************//********************************************************//*------------ Espacio de codigo principal -------------*//********************************************************/ void main(void) {SOPT1 = 0x20; //Deshabilita el modulo COP (WDT)xTaskCreate( led_task1, ( signed portCHAR * ) "Led1_blink", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); xTaskCreate( led_task2, ( signed portCHAR * ) "Led2_blink", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); vTaskStartScheduler(); // EnableInterrupts; for(;;){ }}//*******************************************************
I'm using the development system DEMOJM
Hello,
There is now CodeWarrior for MCU10.0 (eclipse based) available (see http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-MCU10&tid=vancwmcu10).
Attached is a port based on the original port to S08 (see beginnig of this thread) plus the available port for V1 on www.freertos.org.
It is using eclipse with Processor Expert, so with this it is virtually working with any S08 and ColdFire V1.
The work is based on an university research project, and is presented at the FTF in Orlando (session ID FTF-ENT-F0539).
It encapsulates the latest FreeRTOS (6.0.5) as an embedded component, so you can create a project from scratch (Processor Expert enabled), and simply add the freeRTOS to your project, specify the timer module and SWI interrupt and you are ready to go.
The attached zip file contains the embedded component, two demo projects (one for S08 and one for QE128) plus a readme/installation guide. The demos are using doxygen too (there is the Eclox eclipse plugin you can download).
I hope this is useful. In any case, I plan to add other cores (like the S12 and the other ColdFires), so it should be really easy to use FreeRTOS with CodeWarrior under eclipse.
BK
Hello,
ups, I posted the .zip without the example projects, so here again.
BK
Hy blacknight, when I try to put other thask in the project of coldfire v1 qe128, dont do it anything, you think that the problem is the memory ram is not to much?? best regards
this is the code that I try to do
/** ###################################################################** Filename : ProcessorExpert.c** Project : ProcessorExpert** Processor : MCF51QE128CLH** Version : Driver 01.00** Compiler : CodeWarrior ColdFireV1 C Compiler** Date/Time : 03/07/2010, 10:58 p.m.** Abstract :** Main module.** This module contains user's application code.** Settings :** Contents :** No public methods**** ###################################################################*//* MODULE ProcessorExpert *//* Including needed modules to compile this module/procedure */#include "Cpu.h"#include "Events.h"/* Include shared modules, which are used for whole project */#include "FRTOS1.h"#include "RTOSSWI1.h"#include "RTOSTMR1.h"#include "Term1.h"#include "Inhr2.h"#include "Bit1.h"#include "Bit2.h"#include "PE_Types.h"#include "PE_Error.h"#include "PE_Const.h"#include "IO_Map.h"static portTASK_FUNCTION(MyTask2,pvParameters){ (void)pvParameters; for(;;){ Bit2_NegVal(); //Term1_SendStr("Envio de tarea 2\r"); FRTOS1_vTaskDelay(500/portTICK_RATE_MS); }}/* User includes (#include below this line is not maintained by Processor Expert) */static portTASK_FUNCTION(MyTask, pvParameters) { (void)pvParameters; /* parameter not used */ FRTOS1_xTaskCreate(MyTask2, (signed portCHAR *)"mytask2", configMINIMAL_STACK_SIZE, (void *)NULL, 1, (xTaskHandle*)NULL); for(;;) { Bit1_NegVal(); //Term1_SendStr("Envio de tarea 1\r"); FRTOS1_vTaskDelay(500/portTICK_RATE_MS); }}static void RTOS_Start(void) { if (FRTOS1_xTaskCreate( MyTask, /* pointer to the task */ (signed portCHAR *)"MyTask", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE, /* task stack size */ (void*)NULL, /* optional task startup argument */ 1, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ )!=pdPASS) { //Term1_SendStr("Error1\r"); for(;;){} } FRTOS1_vTaskStartScheduler();}void main(void){ /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ /* For example: for(;;) { } */ RTOS_Start(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***//* END ProcessorExpert *//*** ###################################################################**** This file was created by Processor Expert 4.00 Beta [04.40]** for the Freescale ColdFireV1 series of microcontrollers.**** ###################################################################*/
Hello,
not enough RAM for the heap is a common cause for task not created.
But I think your problem is a different one: you have your task code, but you do not add the task to the task list (xTaskCreate())?
You need to add in RTOS_Start() (or somewhere else) a call to xTaskCreate (see example for myTask in RTOS_Start()).
BK
Yes, I created the task2 in to the task1, in the MyTask
see
static portTASK_FUNCTION(MyTask, pvParameters) { (void)pvParameters; /* parameter not used */ FRTOS1_xTaskCreate(MyTask2, (signed portCHAR *)"mytask2", configMINIMAL_STACK_SIZE, (void *)NULL, 1, (xTaskHandle*)NULL); for(;;) { Bit1_NegVal(); //Term1_SendStr("Envio de tarea 1\r"); FRTOS1_vTaskDelay(300/portTICK_RATE_MS); }}
But I try to create the task in the function RTOS_Start() and and yet it does not work, like this
/** ###################################################################** Filename : ProcessorExpert.c** Project : ProcessorExpert** Processor : MCF51QE128CLH** Version : Driver 01.00** Compiler : CodeWarrior ColdFireV1 C Compiler** Date/Time : 03/07/2010, 10:58 p.m.** Abstract :** Main module.** This module contains user's application code.** Settings :** Contents :** No public methods**** ###################################################################*//* MODULE ProcessorExpert *//* Including needed modules to compile this module/procedure */#include "Cpu.h"#include "Events.h"/* Include shared modules, which are used for whole project */#include "FRTOS1.h"#include "RTOSSWI1.h"#include "RTOSTMR1.h"#include "Term1.h"#include "Inhr2.h"#include "Bit1.h"#include "Bit2.h"#include "PE_Types.h"#include "PE_Error.h"#include "PE_Const.h"#include "IO_Map.h"static portTASK_FUNCTION(MyTask2,pvParameters){ (void)pvParameters; for(;;){ Bit2_NegVal(); //Term1_SendStr("Envio de tarea 2\r"); FRTOS1_vTaskDelay(500/portTICK_RATE_MS); }}/* User includes (#include below this line is not maintained by Processor Expert) */static portTASK_FUNCTION(MyTask, pvParameters) { (void)pvParameters; /* parameter not used */ for(;;) { Bit1_NegVal(); //Term1_SendStr("Envio de tarea 1\r"); FRTOS1_vTaskDelay(300/portTICK_RATE_MS); }}static void RTOS_Start(void) { if (FRTOS1_xTaskCreate( MyTask, /* pointer to the task */ (signed portCHAR *)"MyTask", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE, /* task stack size */ (void*)NULL, /* optional task startup argument */ 1, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ )!=pdPASS) { //Term1_SendStr("Error1\r"); for(;;){} } FRTOS1_xTaskCreate(MyTask2, (signed portCHAR *)"mytask2", configMINIMAL_STACK_SIZE, (void *)NULL, 1, (xTaskHandle*)NULL); FRTOS1_vTaskStartScheduler();}void main(void){ /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ /* For example: for(;;) { } */ RTOS_Start(); /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***//* END ProcessorExpert *//*** ###################################################################**** This file was created by Processor Expert 4.00 Beta [04.40]** for the Freescale ColdFireV1 series of microcontrollers.**** ###################################################################*/
How much task do you think I could created with 8kb of ram??? I dont know why dont works, because is a simple example, best regards