[En-Nut-Discussion] Just a word of warning with WinAVR-20050214.
Vesa Jääskeläinen
chaac at nic.fi
Mon May 9 10:06:02 CEST 2005
Vesa Jääskeläinen wrote:
> Hi,
>
> I needed to disable all optimizations (-O0) when building Nut/OS to get
> sample httpd application working correctly on ethernut 1.3g board.
> Without disabling optimizations e1.3g wouldn't give response from
> Ethernet interface.
>
> So if you are having strange problems with WinAVR and Nut/OS, try to
> disable optimizations and see if that helps.
>
> I added "HWDEF += -O0" to UserConf.mk and rebuilt Nut/OS (make all &
> make install)
>
> And then rebuilding test application and programming it to board I got
> responses nicely from e1.3g.
I was able to trace it back to it's source. GCC is a bit too aggressive
about optimizations, I really don't see its rationale but it optimized
away NULL pointer checks in certain situations. I will continue
discussion on this issue with GCC developers but following switch gives
a cure "-fno-delete-null-pointer-checks".
I would propose this switch as a default compiler flag. Any objections?
In meanwhile when building Nut/OS you could use:
HWDEF += -fno-delete-null-pointer-checks
... in nut/UserConf.mk in build directory before issuing make all & make
install.
Problem code in a bit complex situation:
if ((ppv != NULL) && (*ppv != NULL)) {
First compare was omitted without this flag.
Thanks,
Vesa Jääskeläinen
More information about the En-Nut-Discussion
mailing list