FreeRTOS on MSP430F2274

carvalhais wrote on Wednesday, August 26, 2009:

Hi folks,

     I was trying to compile FreeRTOS to run on a F2274 (32kb flash and 1kb ram), from a eZRF2500 board that TI distributed in last year´s MSP Day. After adjusting things a little bit, when I tried to compile a simple code I got the following errors (mspgcc 3.2.3 with eclipse):

**** Build of configuration Debug for project SPECTraS ****

**** Internal Builder is used for build               ****
msp430-gcc -mmcu=msp430x2274 -oSPECTraS.elf sys\init.o SPECTraS.o FreeRTOS\tasks.o FreeRTOS\queue.o FreeRTOS\port.o FreeRTOS\list.o FreeRTOS\heap_1.o FreeRTOS\croutine.o
C:\Program Files\mspgcc\bin\…\lib\gcc-lib\msp430\3.2.3\…\…\…\…\msp430\bin\ld.exe: region data is full (SPECTraS.elf section .bss)
C:\Program Files\mspgcc\bin\…\lib\gcc-lib\msp430\3.2.3\…\…\…\…\msp430\bin\ld.exe: region data is full (SPECTraS.elf section .bss)
Build error occurred, build is stopped
Time consumed: 157  ms. 

My FreeRTOSConfig.h is as follows:

#define configUSE_PREEMPTION        1
#define configUSE_IDLE_HOOK            0
#define configUSE_TICK_HOOK            0
#define configCPU_CLOCK_HZ            ( ( unsigned portLONG ) 16000000 ) /* Clock setup from main.c in the demo application. */
#define configTICK_RATE_HZ            ( (portTickType)(configCPU_CLOCK_HZ/32768) )
                                    /* If configUSE_WDT_AS_TICKER is set below, this
                                     * must be set as ( configCPU_CLOCK_HZ / 32768 ) */
#define configMAX_PRIORITIES        ( ( unsigned portBASE_TYPE ) 2 )
#define configMINIMAL_STACK_SIZE    ( ( unsigned portSHORT ) 50 )
#define configTOTAL_HEAP_SIZE        ( ( size_t ) ( 800 ) )
#define configMAX_TASK_NAME_LEN        ( 4 )
#define configUSE_TRACE_FACILITY    0
#define configUSE_16_BIT_TICKS        1
#define configIDLE_SHOULD_YIELD        0
#define configUSE_WDT_AS_TICKER        1

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES         0
#define configMAX_CO_ROUTINE_PRIORITIES ( 0 )

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet        1
#define INCLUDE_uxTaskPriorityGet        1
#define INCLUDE_vTaskDelete                0
#define INCLUDE_vTaskCleanUpResources    0
#define INCLUDE_vTaskSuspend            0
#define INCLUDE_vTaskDelayUntil            1
#define INCLUDE_vTaskDelay                1

configWDT_AS_TICKER is just an option I´ve added to allow me to use the watchdog timer instead of the timer a to generate the ticker interrupts.

The code is really simple, it just creates a task to toggle the onboard led (it uses vTaskDelay to generate the delay). Is FreeRTOS really that big or am I missing something here?
I also don´t understand why the compiler tries to link croutines.o since I have turned configUSE_CO_ROUTINES off.
Could someone please help me? Thanks in advance,

Andre.

petermeier wrote on Wednesday, August 26, 2009:

Hi Andre,
iam not familar with that particular chip i even don’t know if its a 8/16/32 bit architecture but it seems if your chip has only 1kB = 1024 bytes of Ram and if you defined a total heap size (#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 800 ) ) ) of 800 * (depending on the register size. e.g. for a 8 bit machine 1 byte, 16 bit = 2 bytes, 32 bits = 4 bytes) you will lead into a memory usage of 800, 1600, 3200 bytes…
As you can see, the linker is posting the message: Region data is full (SPECTraS.elf section .bss). In .bss-section (this is at pic32 gcc compiler, so i assume gcc behaves the same on different platforms) contains the uninitialized data which will be copies at startup into ram, which will not fit.

Hope this helps.
Peter

jwestmoreland wrote on Thursday, August 27, 2009:

Good answer Peter.

To Andre:
Cut your heap size in half.  Make sure GCC isn’t trying to allocate another block of heap.  Make sure you are not linking in clib or any of the stdlibs.
You may have to play with task stack sizes - and cut down to the bare-minimum on tasks just to get it to work.

Having WDT as the timer doesn’t really buy you much.

Regards,
john