IAR AVR 5.40 warning

zaalzaalak wrote on Wednesday, February 03, 2010:


I compiler freeRTOS demo project for AVR with IAR ver 5.40 ,but the compiler generates 1 warning at line 422 of tasks.c file:
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long )  portBYTE_ALIGNMENT_MASK  ) );

this is warning message of compiler:
Warning: conversion from integer to smaller pointer E:\freeRTOS_AVRProj\freeRTOS\tasks.c 422

Please help me to edit this line and file for removing this warning.

best regards

edwards3 wrote on Wednesday, February 03, 2010:

Try changing the tow (unsigned long) casts to (unsigned portSTACK_TYPE) or just (portSTACK_TYPE) if it is already unsigned. Post back if this works or not.

zaalzaalak wrote on Saturday, February 06, 2010:

The above change will not work !

please help me Mr barry.

bmarques wrote on Tuesday, February 09, 2010:

To solve it you can cast to unsigned int instead of unsigned long, it works and it should be correct because pointers are two bytes in size, as so the correct cast is to a two-byte wide type.