Modifications on LM3S811 demo code

apessina wrote on Tuesday, February 16, 2010:

Hi, I’m a FreeRTOS absolute beginner and I’m trying to add a simple Led Flasher task to the LM3S811 evaluation kit.
I’ve found the following code and very simply, inserted in main.c.

Unfortunately I don’t rememer the author’s name but I publicly thank him.

Added some #defines (near the ‘Demo Board Specifics’ #defines):

#define mainUSER_LED GPIO_PIN_5

Right after that, add a #define for the blink rate (1000 ms = 1 second):

#define mainLED_DELAY ((portTickType) 1000/portTICK_RATE_MS)

Added a prototype for the task function:

static void vUserLEDTask(void *pvParameter);

In the main() function, added the call to create the task after
the other demo tasks (modelled exactly after the other task create calls):

xTaskCreate(vUserLEDTask, “UserLED”, configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL);

In the prvSetupHardware() function, added a line to configure the GPIO pin
as an output, immediately after the section that configures the push button input:


And finally, added the actual blinking task after the other tasks:

static void vUserLEDTask(void *pvParameter) {

for(;:wink: {
          GPIOPinWrite(GPIO_PORTC_BASE, mainUSER_LED, mainUSER_LED); // let it shine
          GPIOPinWrite(GPIO_PORTC_BASE, mainUSER_LED, 0); // take a break

But once flashed the demo program hangs.
If I comment out the added parts, the original demo program works ok.
The FreeRTOSConfig.h is the original demo one and the compiler is the IAR Embedded Workbench.
CSTACK is 0x400 and HEAP is 0x800.

Any suggestion?

Thank you

Milano - Italy

rtel wrote on Tuesday, February 16, 2010:

I think the FreeRTOS download already includes a demo for the LM3S811 - which includes the standard ‘flash’ tasks.

There is nothing obviously wrong with your code (from my very quick look).  Maybe you are overflowing a stack or simply running out of heap space.

Does vTaskStartScheduler() ever return?

Normally the demos use heap_2.c or heap_1.c which means the heap size is defined by configTOTAL_HEAP_SIZE in FreeRTOSConfig.h.  If this is the case in your project then any heap allocated in the linker script will be wasted.


apessina wrote on Friday, February 19, 2010:

Problem solved !
Thank you very much Mr. Barry
It was just a too small heap space.
Now I purchased the two manuals and I’m studying :wink:
They are very clear, and I strongly suggest them.