Quality RTOS & Embedded Software

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




Loading

Compilation warning on AVR GCC

Posted by Bernardo on February 5, 2010
Hello,

I'm using FreeRTOS on a board I made with an AT90USB647 and the compiler issues a warning on line 422 of tasks.c:

FreeRTOS/tasks.c: In function 'xTaskGenericCreate':
FreeRTOS/tasks.c:422: error: cast from pointer to integer of different size
FreeRTOS/tasks.c:422: error: cast to pointer from integer of different size


in line 422 of tasks.c i can see:
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long ) ~portBYTE_ALIGNMENT_MASK ) );


in portmacro.h (based on portmacro.h in the ATMega323 example) i have:
#define portSTACK_TYPEunsigned portCHAR

is this the correct portSTACK_TYPE for the AVR uController?
What should i do? change portSTACK_TYPE or change line 422 of tasks.c?
If i replace 'long' by 'int' in line 422 the warning disapears and FreeRTOS works but is this correct?

Regards,
Bernardo Marques.

RE: Compilation warning on AVR GCC

Posted by Richard on February 5, 2010
This warning has arrisen from a recent change and occurs on ports where the stack type is smaller than the pointer type. I think changing the unsigned long casts to portBASE_TYPE cases might be ok, but would have to check each port individually.

Regards.

RE: Compilation warning on AVR GCC

Posted by Bernardo on February 9, 2010
Nope. It cannot be a cast to portBASE_TYPE, it will make it worse. I suppose that in AVR GCC a pointer has two bytes and the base type on the AVR is 8-bit. As pxTopOfStack must be casted to a 16-bit integer it must be to either int or portSHORT.


[ 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