Added MAC overwriting/burning capability to the Z1
Added compilation parameter "nodemac=1234" that can be used to overwrite the MAC at compilation time, and that combined with the burn-nodeid app can record a prestablished MAC on ext. mem.
This commit is contained in:
parent
659f36eb79
commit
43db4fd10e
3 changed files with 20 additions and 18 deletions
|
@ -18,6 +18,10 @@ ifdef UIP_CONF_IPV6
|
||||||
CFLAGS += -DWITH_UIP6=1
|
CFLAGS += -DWITH_UIP6=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef nodemac
|
||||||
|
CFLAGS += -DMACID=$(nodemac)
|
||||||
|
endif
|
||||||
|
|
||||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) $(CONTIKI_TARGET_MAIN)
|
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) $(CONTIKI_TARGET_MAIN)
|
||||||
|
|
||||||
MCU=msp430x2617
|
MCU=msp430x2617
|
||||||
|
|
|
@ -61,6 +61,7 @@ PROCESS_THREAD(burn_process, ev, data)
|
||||||
watchdog_stop();
|
watchdog_stop();
|
||||||
leds_on(LEDS_RED);
|
leds_on(LEDS_RED);
|
||||||
#if NODEID
|
#if NODEID
|
||||||
|
#warning "***** BURNING NODE ID"
|
||||||
printf("Burning node id %d\n", NODEID);
|
printf("Burning node id %d\n", NODEID);
|
||||||
node_id_burn(NODEID);
|
node_id_burn(NODEID);
|
||||||
leds_on(LEDS_BLUE);
|
leds_on(LEDS_BLUE);
|
||||||
|
|
|
@ -208,20 +208,7 @@ main(int argc, char **argv)
|
||||||
slip_arch_init(BAUD2UBR(115200));
|
slip_arch_init(BAUD2UBR(115200));
|
||||||
#endif /* WITH_UIP */
|
#endif /* WITH_UIP */
|
||||||
|
|
||||||
/* XXX hack: Fix it so that the 802.15.4 MAC address is compatible
|
|
||||||
with an Ethernet MAC address - byte 0 (byte 2 in the DS ID)
|
|
||||||
cannot be odd. */
|
|
||||||
//Enric node_mac[2] &= 0xfe;
|
|
||||||
node_mac[0] = 0x00;
|
|
||||||
node_mac[1] = 0x12;
|
|
||||||
node_mac[2] = 0x76;
|
|
||||||
node_mac[3] = 0x01;
|
|
||||||
node_mac[4] = 0x02;
|
|
||||||
node_mac[5] = 0x03;
|
|
||||||
node_mac[2] = 0x04;
|
|
||||||
node_mac[7] = 0x05;
|
|
||||||
|
|
||||||
|
|
||||||
xmem_init();
|
xmem_init();
|
||||||
|
|
||||||
rtimer_init();
|
rtimer_init();
|
||||||
|
@ -229,10 +216,23 @@ main(int argc, char **argv)
|
||||||
* Hardware initialization done!
|
* Hardware initialization done!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Restore node id if such has been stored in external mem */
|
/* Restore node id if such has been stored in external mem */
|
||||||
node_id_restore();
|
node_id_restore();
|
||||||
|
|
||||||
|
/* Overwrite node MAC if desired at compile time */
|
||||||
|
#ifdef MACID
|
||||||
|
#warning "***** CHANGING DEFAULT MAC *****"
|
||||||
|
node_mac[0] = 0xC1; // Hardcoded for Z1
|
||||||
|
node_mac[1] = 0x0C; // Hardcoded for Revision C
|
||||||
|
node_mac[2] = 0x00; // Hardcoded to arbitrary even number so that the 802.15.4 MAC address
|
||||||
|
// is compatible with an Ethernet MAC address - byte 0 (byte 2 in the DS ID)
|
||||||
|
node_mac[3] = 0x00; // Hardcoded
|
||||||
|
node_mac[4] = 0x00; // Hardcoded
|
||||||
|
node_mac[5] = 0x00; // Hardcoded
|
||||||
|
node_mac[6] = MACID >> 8;
|
||||||
|
node_mac[7] = MACID & 0xff;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* for setting "hardcoded" IEEE 802.15.4 MAC addresses */
|
/* for setting "hardcoded" IEEE 802.15.4 MAC addresses */
|
||||||
#ifdef IEEE_802154_MAC_ADDRESS
|
#ifdef IEEE_802154_MAC_ADDRESS
|
||||||
|
@ -284,9 +284,6 @@ main(int argc, char **argv)
|
||||||
PRINTF("Node id is not set.\n");
|
PRINTF("Node id is not set.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Enric printf("MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
|
||||||
//Enric node_mac[0], node_mac[1], node_mac[2], node_mac[3],
|
|
||||||
//Enric node_mac[4], node_mac[5], node_mac[6], node_mac[7]);
|
|
||||||
|
|
||||||
#if WITH_UIP6
|
#if WITH_UIP6
|
||||||
PRINTF("in WITH_UIP6\n"); //Enric
|
PRINTF("in WITH_UIP6\n"); //Enric
|
||||||
|
|
Loading…
Reference in a new issue