Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Tasks compile and don't work

Posted by karima7 on April 9, 2016

Hello everyone,

I work with FreeRTOSV9 for the HCS12 family. I added a code to manipulate the LEDs in the main function, and it worked well, and when I joined this snippet of code into tasks, the project compiles, but the LEDs fail to light up, I don't really know if it's a problem with the management of interrruption or not, if that is the case how can I solve it? I must inform you that I created a new project, and I integrated the different files necessary to have a FreeRTOS kernel following the steps of creating a new project under the FreeRTOS website.

Please find below the code that I used :

~~~~ void MyTask1(void* pvParameters);

void main(void) {

DDRP = 0x0F;

PElowlevel_init();

xTaskCreate( MyTask1, ( signed char * ) "MyTask1", configMINIMALSTACKSIZE, NULL, 1, NULL );

vTaskStartScheduler();

for(;;){}

}

void MyTask1(void* pvParameters) { while(1) {

    PTP=0x08;

    vTaskDelay(5000);
}

}

~~~~

Thank you in advance for your help.


Tasks compile and don't work

Posted by heinbali01 on April 10, 2016

Hi Karima,

I would be curious to see if this would make a change:

~~~~~ void MyTask1(void* pvParameters) { while(1) { PTP=0x00; vTaskDelay(2000);

    PTP=0x08;
    vTaskDelay(2000);
}

} ~~~~~ What compiler are you using?

Can you use an in-circuit debugger and see if MyTask1 is called? Can you confirm that main() is called? In case main() is not called: does you project need a separate startup-code, maybe an assembler source file that calls your main()?

Are you using C-only or mixed with C++? If the code is placed in a C++ file, add the calling type:

extern "C" void MyTask1(void* pvParameters);

Can you check if vPortTickInterrupt() is called in either:

~~~~~ FreeRTOS/Source/portable/GCC/HCS12/port.c FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c ~~~~~


Tasks compile and don't work

Posted by rtel on April 10, 2016

I work with FreeRTOSV9 for the HCS12 family.

It sounds like you have the RTOS running on the HCS12. There have been a lot of questions about this recently.

I added a code to manipulate the LEDs in the main function, and it worked well

I presume that means you have code that toggles LEDs without the RTOS running, and that is functioning.

, and when I joined this snippet of code into tasks, the project compiles, but the LEDs fail to light up

So up to this point my understanding is:

1) You have the RTOS running without the LED code in the task. 2) You have the LED code working outside of an RTOS task. 3) If you add the LED code into the RTOS task then the RTOS task is no longer running.

Is this correct?

If so, when the RTOS task is not running, what is it doing? It is very hard to see how adding the line:

PTP=0x08;

into the task would make a difference as it is unlikely that code would either generate an interrupt or use any stack.


Tasks compile and don't work

Posted by karima7 on April 10, 2016

Hello,

Thank you very much for your answers.

Yes indeed the three points you made, describes perfectly my problem. So what can I use instead of PTP = 0x08 in the task? I tried the function you suggested me Mr.Hein, but it didn't work. I work with the CodeWarrior IDE 5.9.0 compiler, and I just created a project with C. I compiled step by step, and it actually made the call of different functions that I used, and enters the main function. I check if the vPortTickInterrupt () function is called in the port.c file path: FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c and indeed it is already integrated and developed down the file port.c

/ * Tick context switch function. This is the timer ISR. * / vPortTickInterrupt void interrupt (void);


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists