FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [February 2010 Threads] Modifications on LM3S811 demo codePosted 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 codePosted 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 codePosted 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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|