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
fccce4e4a8
commit
6f942f1266
|
@ -18,6 +18,10 @@ ifdef UIP_CONF_IPV6
|
|||
CFLAGS += -DWITH_UIP6=1
|
||||
endif
|
||||
|
||||
ifdef nodemac
|
||||
CFLAGS += -DMACID=$(nodemac)
|
||||
endif
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) $(CONTIKI_TARGET_MAIN)
|
||||
|
||||
MCU=msp430x2617
|
||||
|
|
|
@ -61,6 +61,7 @@ PROCESS_THREAD(burn_process, ev, data)
|
|||
watchdog_stop();
|
||||
leds_on(LEDS_RED);
|
||||
#if NODEID
|
||||
#warning "***** BURNING NODE ID"
|
||||
printf("Burning node id %d\n", NODEID);
|
||||
node_id_burn(NODEID);
|
||||
leds_on(LEDS_BLUE);
|
||||
|
|
|
@ -208,19 +208,6 @@ main(int argc, char **argv)
|
|||
slip_arch_init(BAUD2UBR(115200));
|
||||
#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();
|
||||
|
||||
|
@ -229,10 +216,23 @@ main(int argc, char **argv)
|
|||
* Hardware initialization done!
|
||||
*/
|
||||
|
||||
|
||||
/* Restore node id if such has been stored in external mem */
|
||||
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 */
|
||||
#ifdef IEEE_802154_MAC_ADDRESS
|
||||
|
@ -284,9 +284,6 @@ main(int argc, char **argv)
|
|||
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
|
||||
PRINTF("in WITH_UIP6\n"); //Enric
|
||||
|
|
Loading…
Reference in a new issue