Forum Discussion
Altera_Forum
Honored Contributor
21 years agoLWIP doesn't work...
Hi! I have tested stand-alone lwip with Nios2 standard example design, and it works fine. I implemented multiprocessor environment where is three standard nios 2 processors. One processor is go...
Altera_Forum
Honored Contributor
21 years agoHi Coolman,
Modify you mac_addr.c file to look something like this.#include "alt_types.h"# include "io.h"# include "lwip/netif.h"
/*
* read_mac_address
*
* Read the MAC address in a board specific way
*
*/
err_t read_mac_address(struct netif *netif)
{
err_t ret_code = ERR_IF;
alt_u32 signature;
/*
* Our board has the MAC address stored at 0x7f000 in flash
*/# if defined(ALTERA_NIOS_DEV_BOARD_CYCLONE_1C20) ||
defined(ALTERA_NIOS_DEV_BOARD_STRATIX_1S10) ||
defined(ALTERA_NIOS_DEV_BOARD_STRATIX_1S10_ES) ||
defined(ALTERA_NIOS_DEV_BOARD_STRATIX_1S40)
signature = IORD_32DIRECT(0x7f0000, 0);
if (signature != 0x00005afe)
{
fprintf(stderr, "\n-- FIX THIS -- Can't read the MAC address from flash -- FIX THIS -- .\nSetting MAC address to default FF:FF:FF:FF:FF:FF\n");
netif->hwaddr_len = 6;
netif->hwaddr = 0xFF;
netif->hwaddr = 0xFF;
netif->hwaddr = 0xFF;
netif->hwaddr = 0xFF;
netif->hwaddr = 0xFF;
netif->hwaddr = 0xFF;
ret_code = ERR_OK;
}
else
{
/* Set MAC hardware address length */
netif->hwaddr_len = 6;
netif->hwaddr = IORD_8DIRECT(0x7f0000, 4);
netif->hwaddr = IORD_8DIRECT(0x7f0000, 5);
netif->hwaddr = IORD_8DIRECT(0x7f0000, 6);
netif->hwaddr = IORD_8DIRECT(0x7f0000, 7);
netif->hwaddr = IORD_8DIRECT(0x7f0000, 8);
netif->hwaddr = IORD_8DIRECT(0x7f0000, 9);
ret_code = ERR_OK;
}# else
fprintf(stderr, "Not an Altera board.\nYou need to modify the function read_mac_address to set a MAC address for your board.\n");# endif
return ret_code;
} Here you simply replace the FF's with the correct MAC address. NOTE this is an UGLY hack just to get it working. It CAN NOT / SHOULD NOT be used in a production system. It should at least give you an idea of where to look for your problem