Quality RTOS & Embedded Software

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


Loading

Modifications on LM3S811 demo code

Posted by Antonio Pessina on 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:

GPIODirModeSet(GPIO_PORTC_BASE, mainUSER_LED, GPIO_DIR_MODE_OUT);

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

static void vUserLEDTask(void *pvParameter) {

for(;;) {
GPIOPinWrite(GPIO_PORTC_BASE, mainUSER_LED, mainUSER_LED); // let it shine
vTaskDelay(mainLED_DELAY);
GPIOPinWrite(GPIO_PORTC_BASE, mainUSER_LED, 0); // take a break
vTaskDelay(mainLED_DELAY);
}
}

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

Antonio
Milano - Italy

RE: Modifications on LM3S811 demo code

Posted by Richard on 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.

Regards.

RE: Modifications on LM3S811 demo code

Posted by Antonio Pessina on 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 ;)
They are very clear, and I strongly suggest them.

Regards

Antonio


[ 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