lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] [lwip] Porting problems


From: Jason Morgan
Subject: [lwip-users] [lwip] Porting problems
Date: Wed, 08 Jan 2003 22:06:26 -0000

Hi,

We're still testing our port of lwIP to the C165, only to find what could be
a serious bug.

Its in mem.c and regards the assumption that variable storage in memory is
in ascending order compared
to the order that the variables are declared within the code.

The Keil compiler 'sorts' the non-automatic variables to conserve memory by
fitting storage sizes to fit the segmented
memory, the same is true of many C compilers targeted at micro controllers
where memory usage is important.

This means that the lines (circa line 83 in mem.c)

static char ram[MEM_SIZE];
static struct mem ram_end;

And the later comparisons similar to line 116 (approx) of the same code

if(mem != nmem && nmem->used == 0 && (char *)nmem != (char *)&ram_end)
{
        if(lfree == nmem)
        {
                lfree = mem;
        }


Are not necessarily going to work successfully.  This assumption is made
elsewhere in mem.c too.....

We can fix mem.c (I think) but we need to know if anybody is aware of the
same variable ordering assumption being
made elsewhere in the code so that we can remove it from there too.

We could fudge it be removing the variable ordering from the compiler, but
this would be inefficient and non-portable, it
would be better to fix the code properly.



Jason Morgan - Development Engineer
CITEL Technologies Ltd.
Wheatcroft Business Park
Landmere Lane, Edwalton
NOTTINGHAM, NG12 4DG, UK
Tel: +44 (0) 115 940 5444  Ext 204
Direct: +44 (0) 115 931 5104
Fax: +44 (0) 115 940 5664
mailto:address@hidden
WebSite http://www.citel.com

[This message was sent through the lwip discussion list.]




reply via email to

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