Quality RTOS & Embedded Software

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




Loading

Using ATmega323 port with ATmega16

Posted by joh4289 on 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 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)


Using ATmega323 port with ATmega16

Posted by rtel on May 12, 2014

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.


Using ATmega323 port with ATmega16

Posted by joh4289 on May 12, 2014

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!


Using ATmega323 port with ATmega16

Posted by joh4289 on May 12, 2014

How to mark this as solved?


Using ATmega323 port with ATmega16

Posted by rtel on May 12, 2014

No need to mark it as solved - I don't think that is possible.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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