Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

STR91x PORT led demo bug?

Posted by johanan on August 27, 2007
The led flash demo should control 3 leds, with 3 different tasks, but only one led is working. Looking at the code I don't understand how it should work.
----------
/* Create the three tasks. */
for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
{
/* Spawn the task. */
xTaskCreate( vLEDFlashTask, ( const signed portCHAR * const ) "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
}
------
But in order to create 3 different leds, the vLEDFlash must execute (in order to increment uxFlashTaskNumber),
and I don't think that xTaskCreat is executing the the function vLEDFlashTask(), it only take its address.

Am I wrong?

RE: STR91x PORT led demo bug?

Posted by Richard on August 27, 2007
Either I misunderstand your question or you have some misconceptions about how a multitasking system works. vLEDFlashTask() is not an ordinary function, but defines a task. The task executes autonomously (by itself). xTaskCreate() does not attempt to call vLEDFlashTask(), it creates the task that is defined by vLEDFlashTask(). As it is called three times it creates three such tasks, so when the scheduler takes control all three tasks run (pseudo) simultaneously and continuously.

Regards.

RE: STR91x PORT led demo bug?

Posted by johanan on August 27, 2007
I understand. My miscoseption is from beeing a bit "object oriented" thinking that xCreate should create all the data structure that is needed for the task to run, which probably should have been done with the vParameters pointer. In the demo the led number is changed when the function starts before the endless loop.

I will look for the problem elswhere, probably in the 91x_vect.s (I did not use the demo supplied file, so probably its a problem with user/supervisor mode)

Thanks,
Johanan

RE: STR91x PORT led demo bug?

Posted by johanan on August 27, 2007
Well, of course its in the 91x_vect.s file. Problem is that IAR made some changes in the file (IAR Ver 5.0)since the original one. Looks easy to change a few lines in the file so SWI will work. However I am so new to ARM that I don't wnat to do somthing I don't fully understand. ANy help will be apriciated. (I don't see how can attach a file to the post).
Regards,
Joahanan


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


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner