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] [May 2014 Threads]
Hi,
I'm trying to use the ATmega323 port with my ATmega16 controller. I'm using FreeRTOSv8.0.1 on Linux with avr-gcc and am following this guide:
http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html
The first two steps are working, I modified vParTestInitialise() however, since my LEDs are on PORTC and I set configTOTALHEAPSIZE to 700 to fit the 1k SRAM.
I have problems with step three. This is working:
// Code goes here ...
short main( void )
{
prvIncrementResetCount();
/* Setup the LED's for output. */
vParTestInitialise();
/* Create the standard demo tasks. */
/// works
// either these are working
//vStartIntegerMathTasks( tskIDLE_PRIORITY );
//vStartRegTestTasks();
// or this is working
//vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
// or this
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
/* Create the tasks defined within this file. */
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* Create the co-routines that flash the LED's. */
vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES );
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
as 1 in portmacro.h. To use the cooperative scheduler define
configUSE_PREEMPTION as 0. */
vTaskStartScheduler();
return 0;
}
As the comments indicate I can either use vStartIntegerMathTasks and vStartRegTestTasks or vStartPolledQueueTasks or vAltStartComTestTasks. If I use more at the same it doesn't work, meaning no LEDs are flashing. I modified vErrorChecks for each case to check if the are operating correctly and they are fine except vAltStartComTestTasks. I don't have a Com inteface so I didn't expect that to work anyway.
Now what I don't understand: If I comment out vStartFlashCoRoutines nothing works anymore. I expected to still have the LED flashing which is controlled by vErrorChecks but it just doesn't.
Since I haven't used coroutines before it's hard for me to anaylze where this behavior comes from. I looked at the code, but I don't see it doing anything concerning the LED controlled by vErrorChecks.
Another thing:
I want to check that my stuff fits int the RAM. With avr-size I get:
text data bss dec hex filename
9880 82 865 10827 2a4b rtosdemo.elf
Am I correct, that I should be fine if the sum of data and bss is smaller than 1000?
(my controller has 1kByte of SRAM)
Hope someone can help me. Thanks in advance!
(Sorry the code isn't highlighted properly, I looked at the formatting help, but I couldn't figure out how to wrap it)
1K of RAM is really a very small amount to use a multi tasking system where each task has its own stack.
If I use more at the same it doesn't work, meaning no LEDs are flashing
So presumably you are running out of heap. Are you checking the return value of xTaskCreate() and do you have a malloc failed hook defined?
If I comment out vStartFlashCoRoutines nothing works anymore
If you have not created any co-routines did you also set configUSECOROUTINES to 0 in FreeRTOSConfig.h? I think it is necessary.
Am I correct, that I should be fine if the sum of data and bss is smaller than 1000?
If you are using heap1.c, heap2.c or heap_3.c then yes, I think that is correct.
Regards.
I think too, that I'm running out of heap, if I use more tasks.
Setting configUSECOROUTINES to 0 in FreeRTOSConfig.h pointed me in the right direction. Turned out I had vCoRoutineSchedule in vApplicationIdleHook. Commenting it out solved my problem.
I think I'll set configUSEIDLEHOOK to 0 too.
Thx!
How to mark this as solved?
No need to mark it as solved - I don't think that is possible.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.