Add stack monitor. Change internal uip address to 200 for RPL.

This commit is contained in:
dak664 2011-02-23 14:14:21 -05:00
parent 46297de770
commit ef4bb08c3e
3 changed files with 37 additions and 4 deletions

View file

@ -581,7 +581,22 @@ extern uip_ds6_netif_t uip_ds6_if;
PRINTF_P(PSTR(" * Configuration: %d, USB<->ETH is "), usb_configuration_nb); PRINTF_P(PSTR(" * Configuration: %d, USB<->ETH is "), usb_configuration_nb);
if (usb_eth_is_active == 0) PRINTF_P(PSTR("not ")); if (usb_eth_is_active == 0) PRINTF_P(PSTR("not "));
PRINTF_P(PSTR("active\n\r")); PRINTF_P(PSTR("active\n\r"));
#if CONFIG_STACK_MONITOR
/* See contiki-raven-main.c for initialization of the magic numbers */
{
extern uint16_t __bss_end;
uint16_t p=(uint16_t)&__bss_end;
do {
if (*(uint16_t *)p != 0x4242) {
printf_P(PSTR(" * Never-used stack > %d bytes\n\r"),p-(uint16_t)&__bss_end);
break;
}
p+=100;
} while (p<RAMEND-100);
}
#endif
break; break;
case 'e': case 'e':

View file

@ -99,6 +99,9 @@ unsigned long clock_seconds(void);
/* Starting address for code received via the codeprop facility. Not tested on Jackdaw */ /* Starting address for code received via the codeprop facility. Not tested on Jackdaw */
//#define EEPROMFS_ADDR_CODEPROP 0x8000 //#define EEPROMFS_ADDR_CODEPROP 0x8000
/* Simple stack monitor. Status is displayed from the USB menu with 'm' command */
#define CONFIG_STACK_MONITOR 1
/* ************************************************************************** */ /* ************************************************************************** */
//#pragma mark USB Ethernet Hooks //#pragma mark USB Ethernet Hooks
/* ************************************************************************** */ /* ************************************************************************** */
@ -349,7 +352,7 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
#define UIP_CONF_ND6_RETRANS_TIMER 10000 #define UIP_CONF_ND6_RETRANS_TIMER 10000
/* Save all the RAM we can */ /* Save all the RAM we can */
#define PROCESS_CONF_NO_PROCESS_NAMES 0 #define PROCESS_CONF_NO_PROCESS_NAMES 1
#undef QUEUEBUF_CONF_NUM #undef QUEUEBUF_CONF_NUM
#define QUEUEBUF_CONF_NUM 2 #define QUEUEBUF_CONF_NUM 2
#undef QUEUEBUF_CONF_REF_NUM #undef QUEUEBUF_CONF_REF_NUM

View file

@ -157,7 +157,8 @@ PROCESS_THREAD(border_router_process, ev, data)
memcpy_P(buf,dag_id,sizeof(dag_id)); memcpy_P(buf,dag_id,sizeof(dag_id));
dag = rpl_set_root((uip_ip6addr_t *)buf); dag = rpl_set_root((uip_ip6addr_t *)buf);
/* Assign bbbb::11 to the uip stack, and bbbb::1 to the host network interface, e.g. $ip -6 address add bbbb::1/64 dev usb0 */ /* Assign bbbb::200 to the uip stack, and bbbb::1 to the host network interface, e.g. $ip -6 address add bbbb::1/64 dev usb0 */
/* Note the jackdaw uip stack will get packets intended for usb if they have the same address! */
/* $ifconfig usb0 -arp on Ubuntu to skip the neighbor solicitations. Add explicit neighbors on other OSs */ /* $ifconfig usb0 -arp on Ubuntu to skip the neighbor solicitations. Add explicit neighbors on other OSs */
if(dag != NULL) { if(dag != NULL) {
PRINTF("created a new RPL dag\n"); PRINTF("created a new RPL dag\n");
@ -168,7 +169,7 @@ PROCESS_THREAD(border_router_process, ev, data)
#else #else
uip_ip6addr_t ipaddr; uip_ip6addr_t ipaddr;
uip_ip6addr(&ipaddr, 0xbbbb, 0, 0, 0, 0, 0, 0, 0x1); uip_ip6addr(&ipaddr, 0xbbbb, 0, 0, 0, 0, 0, 0, 0x200);
uip_ds6_addr_add(&ipaddr, 0, ADDR_MANUAL); uip_ds6_addr_add(&ipaddr, 0, ADDR_MANUAL);
rpl_set_prefix(dag, &ipaddr, 64); rpl_set_prefix(dag, &ipaddr, 64);
#endif #endif
@ -304,6 +305,20 @@ static void initialize(void) {
watchdog_init(); watchdog_init();
watchdog_start(); watchdog_start();
#if CONFIG_STACK_MONITOR
/* Simple stack pointer highwater monitor. The 'm' command in cdc_task.c
* looks for the first overwritten magic number.
*/
{
extern uint16_t __bss_end;
uint16_t p=(uint16_t)&__bss_end;
do {
*(uint16_t *)p = 0x4242;
p+=100;
} while (p<RAMEND-100);
}
#endif
/* Initialize hardware */ /* Initialize hardware */
// Checks for "finger", jumps to DFU if present. // Checks for "finger", jumps to DFU if present.
init_lowlevel(); init_lowlevel();