init(netif) doesn’t exist in IwIP 1.1.0?
I tried to compile the SAM7 Rowley Web Demo(IwIP) but the board’s Ethernet didn’t show any signs of life.The other tasks seems to work O.K. After some search in the code and a few debug msgs on UART I found that the source of the problem was the code below:
In file netif.c
/* call user specified initialization function for netif */
if (init(netif) != ERR_OK) {
return NULL;
}
The code simply stuck here when the init(netif) is called. In project’s .elf file it jumps to an address that it doesn’t seem to have any meaning:
4718 bx r3
46C0 mov r8, r8
*
*/
void
pbuf_init(void)
{
B5F0 push {r4-r7, lr}
struct pbuf *p, *q = NULL;
u16_t i;
pbuf_pool = (struct pbuf *)&pbuf_pool_memory[0];
4810 ldr r0, [pc, #0x040]
4B10 ldr r3, [pc, #0x040]
6018 str r0, [r3, #0x00]
LWIP_ASSERT("pbuf_init: pool aligned", (mem_ptr_t)pbuf_pool % MEM_ALIGNMENT == 0);
#if PBUF_STATS
lwip_stats.pbuf.avail = PBUF_POOL_SIZE;
4910 ldr r1, [pc, #0x040]
2204 movs r2, #0x04
23A8 movs r3, #0xa8………
Maybe the compiler is trying to change mode Thumb–>ARM? I really don’t understand.
I searched a bit but I couldn’t find where’s the function’s code. Any clues anyone? Did anybody have the same problem?
init(netif) doesn’t exist in IwIP 1.1.0?
init() is a callback function supplied as a parameter to netif_add(). In the lwIP demo, init calls ethernetif_init() which is a standard lwIP function. ethernetif_init() in turn calls low_level_init() which is where the MAC/PHY initialisation specific to the hardware is performed. This will be where you code is not returning from, it contains the following loop:
while( xEMACInit() == NULL )
{
__asm( "NOP" );
}
which it runs at a low priority (so the other tasks continue to run while it is waiting for the MAC/PHY initialisation to complete).
init(netif) doesn’t exist in IwIP 1.1.0?
Thank you very much for the help I do appriciate that,but you didn’t tell me where’s the init’s code.
init(netif) doesn’t exist in IwIP 1.1.0?
You can just search the source code for xEMACInit or low_level_init then you find it. it all under demo/lwIP_Demo_Rowley_ARM7.