Hi all,
Just thought I'd post here in case this information helps anyone else.
I've been trying to port lwIP 1.3.0 to an ARM7 platform (LPC2148)
running TNKernel 2.5 as the OS and interfacing a DM9000 device. When I
ran the port I would keep getting data abort asserts, caused by trying
to read invalid memory locations (for a great description of how to
trap and diagnose these errors, see
http://www.embedded.com/192202641). This was especially apparent with
DHCP enabled (crashed immediately).
After a period of (slightly random!) tinkering with the code I found
that the problem (or maybe just **a** problem?) is due to the pointers
used in memory management (I’m using the default memory scheme). In
mem.h, if the memory pool is <64000 bytes, then uint16 pointers are
used. By forcing these to be uint32 pointers everything starts
working. Altered code:
//if MEM_SIZE > 64000l
*#if* 1
*typedef* u32_t mem_size_t;
*#else*
*typedef* u16_t mem_size_t;
*#endif* /* MEM_SIZE > 64000 */
Relevant lwipopts.h settings:
*#define* MEM_ALIGNMENT 4
*#define* ETH_PAD_SIZE 2
So now I have the lwIP stack running smoothly, pinging, telnet server,
(basic) http server, lovely! I haven’t had time to analyse exactly
what is going on or why this works, but it might be related to this:
http://lists.nongnu.org/archive/html/lwip-devel/2008-01/msg00181.html?
It also doesn’t seem like a clean solution – so if anyone has a better
fix please post it up.
Anyway, hope this helps someone else,
John Martindale