Problems using demo project of FreeRTOS V8 and V9 for HCS12

karimaaissaoui wrote on Wednesday, March 23, 2016:

Hello,
I hope you are well.
I work with a microcontroller Freescale HCS12 family especially the HCS12P64, I try to incorporate a real-time kernel : FreeRTOS.
I downloaded the demo file from the official website of FreeRTOS two versions 8 and 9, and it did not work with the HCS12, I tried to work with several version of Codewarrior 5 and 9 but in vain. it generates me a lot of errors that I tried to solve, but with any progress.
Is someone already worked with this demo project? and please how I can make it work?

Best regards.

rtel wrote on Wednesday, March 23, 2016:

Those demos are very old. Is the tool version used to create them fathomable from the project files?

You might be better off creating a new project. There is a page on the freertos.org site that says which files are needed, but is sounds like you can open the existing project so just copy the files that uses.

If you posted the error messages it might help too.

karimaaissaoui wrote on Wednesday, March 23, 2016:

Thank you for the quick replying.

Indeed I created a new project which I have built the necessary files described in the official website of FreeRTOS for creating a new project, I wrote a code to hand the management of tasks and here are the errors generated :

Link Error: L1822: Symbol vTaskDelay in file C: \ Users \ FAAR Industry \ Desktop \ 23032016 \ HCS12P64 \ HCS12P64Data \ Standard \ ObjectCode \ main.c.o
is undefined

**Link Error: L1822: Symbol xTaskGenericCreate in file C: \ Users \ FAAR Industry \ Desktop \ 23032016 \ HCS12P64 \ HCS12P64Data \ Standard \ ObjectCode \ main.c.o
is undefined

**Link Error: L1822: Symbol vTaskStartScheduler in file C: \ Users \ FAAR Industry \ Desktop \ 23032016 \ HCS12P64 \ HCS12P64Data \ Standard \ ObjectCode \ main.c.o
is undefined

Link Error: Link failed

knowing that I have in the FreeRTOSConfig file: #define INCLUDE_vTaskDelay 1

and this function is already declared in task.h and defined under tasks.c

And I didn’t use the symbol xTaskGenericCreate in the main file.

rtel wrote on Wednesday, March 23, 2016:

Are you building the task.c file from the FreeRTOS/Source directory?

Are you including tasks.h in main.c?

karima7 wrote on Wednesday, March 23, 2016:

yes I build the task.c file from the FreeRTOS source directory and II included task.h in the main code, and I built the whole project.

karima7 wrote on Wednesday, March 23, 2016:

Here are the main code that I use:

#include <hidef.h>      /* common defines and macros */
#include "derivative.h"      /* derivative-specific definitions */
 #include "FreeRTOS.h"
 #include "FreeRtOSConfig.h"
#include "task.h"
#include "croutine.h"


static void MyTask1(void* pvParameters);
static void MyTask2(void* pvParameters);
static void MyTask3(void* pvParameters);



void main(void) {

	xTaskCreate( MyTask1, ( signed char * )"Task1", configMINIMAL_STACK_SIZE, NULL, 1, NULL );
	xTaskCreate( MyTask2, ( signed char * )"Task2", configMINIMAL_STACK_SIZE, NULL, 2, NULL );
	xTaskCreate( MyTask3, ( signed char * )"Task3", configMINIMAL_STACK_SIZE, NULL, 3, NULL );

	EnableInterrupts;

	vTaskStartScheduler();		/* Start the schedular */

	while(1);

}


static void MyTask1(void* pvParameters)
{     int i=0;
	while(1)
	{
		i++;
		vTaskDelay(100);
	}
}


/* Task1 with priority 2 */
static void MyTask2(void* pvParameters)
{
	  int j=0;
	while(1)
	{
		j++;
		vTaskDelay(250);
	}
}


/* Task1 with priority 3 */
static void MyTask3(void* pvParameters)
{
  int k=0;
	while(1)
	{
		k++;
		vTaskDelay(600);
	}
}

rtel wrote on Thursday, March 24, 2016:

So this is not yet a FreeRTOS problem, just a compiler problem.

The missing symbols are in tasks.c. Did tasks.c get built? Did you see
compiler output for it and did it generate an object file?

karimaaissaoui wrote on Thursday, March 24, 2016:

Hi,
When I joined the tasks.c file in the hierarchy of the project in codeWrrior here are the errors generated:

Link Error : L1822: Symbol pxPortInitialiseStack in file …\Standard\ObjectCode\tasks.c.o
is undefined

Link Error : L1822: Symbol vPortFreeAligned in file …\Standard\ObjectCode\tasks.c.o
is undefined

Link Error : L1822: Symbol vApplicationIdleHook in file …\Standard\ObjectCode\tasks.c.o
is undefined

Link Error : L1822: Symbol xPortStartScheduler in file …\Standard\ObjectCode\tasks.c.o
is undefined

Link Error : Link failed

And when I add the port.c file in the project tree under codeWrrior here are the errors generated:

**Error : C1815: TFLG1 not declared (or typename)
port.c line 263 **
Error : C2450: Expected: ,
**port.c line 267 **
Error : Compile failed

here is the code section in which I used the variable TFLG1 under port.c

void interrupt vPortTickInterrupt( void )
{
	#if configUSE_PREEMPTION == 1
	{
		/* A context switch might happen so save the context. */
		portSAVE_CONTEXT();

		/* Increment the tick ... */
		if( xTaskIncrementTick() != pdFALSE )
		{
			vTaskSwitchContext();
		}

		TFLG1 = 1;								   

		/* Restore the context of a task - which may be a different task
		to that interrupted. */
		portRESTORE_CONTEXT();	
	}
	#else
	{
		xTaskIncrementTick();
		TFLG1 = 1;
	}
	#endif
}

rtel wrote on Thursday, March 24, 2016:

Well I will guess TFLG1 is a register definition, and either the definition in the library has changed, or a different library is being used. If it’s a memory mapped register just write to it directly. Otherwise a little inline asm code might be needed.

karimaaissaoui wrote on Thursday, March 24, 2016:

Thank you for your reply.
I try to change and add files such as IO_Map.h and IO_Map.c, but that adds other errors.
I wonder if you can see the project that I created to detect the problem.
I would be really grateful, because I wasted over a month just to create functional tasks FreeRTOS

karimaaissaoui wrote on Thursday, March 24, 2016:

Please I will like to know if it is possible to create a functional FreeRTOS project for the microcontroller HCS9P64, that is light and easy or not, just not to stay in the importation of changes to the files, and without results :confused: