rtel wrote on Friday, July 15, 2005:
I know several people have FreeRTOS running on a 128, so this should not be a problem.
The compile error you see when attempting to compile for the ATMega128 is due to the fact that the ATMega128 has two serial ports so the #defined constants have slightly different names to distinguish between the two com ports.
Do you have a decent debug system that allows you to step through the code?
Here is my suggested approach:
1) Change the CPU definition at the top of the makefile I suspect you have done this already. As downloaded it is set for MCU = atmega323.
2) Take a look in FreeRTOSConfig.h (same directory as the makefile) to ensure the settings are correct for your board. The clock frequency being the most likely thing that needs changing. The heap size can also be increased on the ATMega128 but dont worry about that for now.
3) Im hoping your demo board has some LEDs?
Take a look at the file Demo/AVR_ATMega323_WinAVR/partest/partest.c.
This file has some simple code to set, clear and toggle LEDs. The port to which the LEDs are attached is unlikely to be the same for your board as the STK500 for which this file is configured, so this will require updating. Also for now comment out the lines vTaskSuspendAll() and xTaskResumeAll(), as these cannot be used without the scheduler running.
4) Comment out the lines in serial.c that are causing you the compile problems (alternatively find the correct constants to use to correct the error).
5) Write a very simple program that just turns LEDs on and off to ensure the functions in step (3) are working. You can do this in the main.c file along the lines of:
portSHORT main( void ) // existing code
____prvIncrementResetCount(); // existing code
____/* Setup the LED’s for output. */
____vParTestInitialise(); // existing code
____/* Add a new infinite loop here so the rest of
____the main() code never gets reached. */
____for( ;; )
________unsigned long ul;
________vParTestToggleLED( 0 );
________for( ul = 0; ul < 0xfffff; ul++ );
____/* Rest of code will not get executed. */
6) When you are happy that the partest files are working, put back the lines that were commented out.
7) Now we want a very simple program that does nothing but flash leds using the kernel. In a clean main.c file (i.e. remove any code added so it is as per the download), comment out every line that creates a task other than the line that creates the flash tasks.
//____vStartIntegerMathTasks( tskIDLE_PRIORITY );
//____vAltStartComTestTasks( mainCOM_TEST_PRIORITY, //____mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
____vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
//____vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
//____xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
The flash tasks should flash LEDs 0, 1 and 3 as described on the WEB site.
8) Compile the code, download, see what happens! the flash tasks should run along with the idle task.
If you can step through the code then it is best to set for cooperative scheduling (set configUSE_PREEMPTION to 0 in FreeRTOSConfig.h).
Once this very simple system is running the application can be built up.