Quality RTOS & Embedded Software

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




Loading

FreeRTOS on ATmega168

Posted by Uwe Fechner on March 25, 2006
Hello,

I am trying to get FreeRTOS working on the ATmega168, a chip with 16 k FLASH and 1 kBytes RAM.

The program memory is no problem, the RAM usage is.

The following is working so far:

vStartLEDFlashTasks
vStartIntegerMathTasks

and the TX part of

vAltStartComTestTasks

Important for me is it, to get the RX part of the
COMTestTasks going.

My configuration:

#define configUSE_PREEMPTION1
#define configUSE_IDLE_HOOK0
#define configCPU_CLOCK_HZ( ( unsigned portLONG ) 8000000 )
#define configTICK_RATE_HZ( ( portTickType ) 512 )
#define configMAX_PRIORITIES( ( unsigned portBASE_TYPE ) 4 )
#define configMINIMAL_STACK_SIZE( ( unsigned portSHORT ) 85 )
#define configTOTAL_HEAP_SIZE ( (size_t ) (500 ) ) // default: 1500

#define configMAX_TASK_NAME_LEN( 4 ) // default: 8
#define configUSE_TRACE_FACILITY0
#define configUSE_16_BIT_TICKS1
#define configIDLE_SHOULD_YIELD1


/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */

#define INCLUDE_vTaskPrioritySet0
#define INCLUDE_uxTaskPriorityGet0
#define INCLUDE_vTaskDelete1
#define INCLUDE_vTaskCleanUpResources0
#define INCLUDE_vTaskSuspend0
#define INCLUDE_vTaskDelayUntil1
#define INCLUDE_vTaskDelay1


WinAVR reports: (I am using avr-gcc version 3.4.5)

Program: 6390 bytes (39,0% Full)
(.text + .data + .bootloader)
Data: 689 bytes (67,3% Full)
(.data + .bss + .noinit)

I don't no yet, where this high ram usage is coming from.

Is it right, that statically allocated RAM and the HEAP_SIZE together must be less then 1k RAM?

Any hints, how I can optimize the RAM usage are welcome.

Uwe Fechner

RE: FreeRTOS on ATmega168

Posted by Richard on March 25, 2006
Yes, the HEAP_SIZE is statically allocated, so this together with the other statically allocated variables must be less than 1K.

1K is not very much.

On Monday FreeRTOS V4.0.0 will be available. This will give you the option to use co-routines in place of tasks, which could give you a big RAM saving if appropriate for your application. This might be better for you on a 1K device.

Regards.

RE: FreeRTOS on ATmega168

Posted by Uwe Fechner on March 25, 2006
Well, it is working now.
(One blinking LED Task, RX and TX Tasks with 600 Bytes Heap).

My application shouldn't need more than 128 Bytes of RAM, so I can provide 800-872 Bytes for the heap. I hope that this is sufficient for five tasks with two priorities.

The heap size is included in the memory usage reported from avr-gcc (other than I thought).

My problem was, that a changed heap size was recognized by the compiler only if I run

make clean
make all

and not with a simple make all.

Nevertheless I am looking forward to the new release.

Regards:

Uwe Fechner

RE: FreeRTOS on ATmega168

Posted by Uwe Fechner on March 27, 2006
The update to FreeRTOS 4.0 reduced the memory usage, even without using CoRoutines:

V3.2.3:
PROGRAM: 7262 Bytes
DATA: 981 Bytes

V4.0
PROGRAM: 7122 Bytes
DATA: 931 Bytes

This is a reduced demo application with
six tasks.

VERY NICE!

Keep up the good work!

Uwe Fechner

RE: FreeRTOS on ATmega168

Posted by Uwe Fechner on April 1, 2006
I just published my FreeRTOS port in my wiki.

http://www.kieltech.de/uweswiki/FreeRTOS

The code is not very clean and not very well documented yet.

When this is done, the port could be added to the distribution.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists