STR91x PORT led demo bug?

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?  

STR91x PORT led demo bug?

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.

STR91x PORT led demo bug?

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

STR91x PORT led demo bug?

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