lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] inet_chksum.c misbehaving with compiler optimisation?


From: Richard Barry
Subject: [lwip-users] inet_chksum.c misbehaving with compiler optimisation?
Date: Sun, 20 Nov 2011 22:06:34 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0

lwIP 1.4.0
GCC
ARM Cortex-M3 target

I have been developing on the above platform for some time quite
successfully without optimisation.  Recently I turned on optimisation
and found the raw httpd server (from lwIP contrib) stopped functioning
correctly when serving jpg files that didn't fit in a single Ethernet
frame.  The jpg loaded very slowly, and a wireshark log appear to show
junk being spewed onto the wire in between frames (at least, there were
frames appearing that were of a protocol unknown to me, and wireshark
seemed a bit confused too, and I am only using a point to point connection).

My first suspect was the Ethernet driver, as I always suspect my code
first ;o) and this problem appeared to have the symptom of a missing
volatile qualifier on a variable close to the hardware.  Many hours
later I did what I should probably have done to start with, and try to
isolate which file being optimised was causing the problem.

This experiment would appear, at least, to point to inet_chksum.c,
although I'm still open to anything being the actual cause.

inet_chksum.c was configured with LWIP_CHKSUM_ALGORITHM 2.

I can compile my entire project with optimisation turned up to -Os, and
manually set inet_chksum.c to use -O0, and everything runs fine.

Likewise, I can set the entire project to use optimisation -O0, and
manually set just inet_chksum.c to -O1 (the lowest optimisation) and the
problem is present.

The code does not crash, and the jpg does load eventually.  Setting
LWIP_CHKSUM_ALGORITHM to 1 does not change the behaviour.



Does this make any sort of sense?  A quick scan of the C file does not
show any obvious reason.

Have I run into a know problem here?  I cannot see anything in the bug
list.  Can you suggest any options I should try?


Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers.
More than 7000 downloads per month.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]