cancel
Showing results for 
Search instead for 
Did you mean: 

SPC58nh-disp - I get a build error when I run the example

SHan.4
Associate

Hi, My discovery board is SPC58NH-DISP and I'm a beginner

I want to run the RTOS exampe.

so I tried running the example sequnce.

like picture....

umm..

I am getting a build error.

-----

./components/spc5_freertos_tcpip_component_rla/lib/src/FreeRTOS_IP.c:1782:32: warning: comparison of promoted ~unsigned with unsigned [-Wsign-compare]

-----

How can I solve this?

2 REPLIES 2
ODOUV.1
ST Employee

Hello,

this is not an error but a compilor warning

if( pxICMPHeader->usChecksum >= FreeRTOS_htons( 0xFFFFu - usRequest ) )

in this line, 0xFFFFu is a 32 bits unsigned value 65535

usRequest is a 16 bit unsigned value

usChecksum is a 16 bit unsigned value

compiler suppose that u32 - u16 can be a negative value

macro FreeRTOS_htons is casting this supposed negative value into an u16

the comparison (<=) between a u16 and casted negative value can be an issue

this is the reason of the warning

BUT usRequest value is between 0 and 65535

so 0xFFFFu - usRequest will remain between 65535 and 0

so it cannot be negative, so there is no issue

Best regards.

ODOUV.1
ST Employee

you could try this:

/**

* Fix warning: comparison of promoted ~unsigned with unsigned

*

* with uint16_t format:

* 0xFFFFu - usRequest == ~usRequest

*

*/

uint16_t temp = ~usRequest;

if( pxICMPHeader->usChecksum >= temp )