joh4289 wrote on Monday, May 12, 2014:
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 configTOTAL_HEAP_SIZE 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)