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

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) 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