From 88f9d790535c4de5fba0d03205923fed5a6d5c6b Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Fri, 22 Nov 2013 15:53:30 +0100 Subject: [PATCH 1/2] Enable the silent compilation mode from the latest Contiki --- cpu/mc1322x/Makefile.mc1322x | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cpu/mc1322x/Makefile.mc1322x b/cpu/mc1322x/Makefile.mc1322x index d04e3ecf7..6d62d95a4 100644 --- a/cpu/mc1322x/Makefile.mc1322x +++ b/cpu/mc1322x/Makefile.mc1322x @@ -81,26 +81,32 @@ else endif $(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S | $(OBJECTDIR) - $(CPP) $(CPPFLAGS) $< > $@ + $(TRACE_CC) + $(Q)$(CPP) $(CPPFLAGS) $< > $@ $(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c | $(OBJECTDIR) - $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ %.o: %.c - $(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) - $(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@ CUSTOM_RULE_S_TO_OBJECTDIR_O = yes $(OBJECTDIR)/%.o: %.S | $(OBJECTDIR) - $(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $(AFLAGS) $(ARM_FLAGS) $< -c -o $@ CUSTOM_RULE_C_TO_CO=yes %.co: %.c - $(CC) $(CFLAGS) -DAUTOSTART_ENABLE $(THUMB_FLAGS) $< -c -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $(THUMB_FLAGS) $< -c -o $@ .PRECIOUS: %.bin %_$(TARGET).bin @@ -114,6 +120,7 @@ CUSTOM_RULE_C_TO_CO=yes @ %.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/mc1322x.lds - $(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a %.lds,$^) $(filter %.a,$^) $(filter %.a,$^) + $(TRACE_CC) + $(Q)$(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a %.lds,$^) $(filter %.a,$^) $(filter %.a,$^) From 7a310935d845918904eed0340c7f0df2377ba6bb Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Fri, 22 Nov 2013 15:54:06 +0100 Subject: [PATCH 2/2] An implementation of the mc1322x watchdog --- cpu/mc1322x/watchdog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpu/mc1322x/watchdog.c b/cpu/mc1322x/watchdog.c index 7c25f449b..542a68022 100644 --- a/cpu/mc1322x/watchdog.c +++ b/cpu/mc1322x/watchdog.c @@ -34,30 +34,38 @@ */ #include "dev/watchdog.h" +#include +#include /*---------------------------------------------------------------------------*/ void watchdog_init(void) { + cop_timeout_ms(1000); } /*---------------------------------------------------------------------------*/ void watchdog_start(void) { + CRM->COP_CNTLbits.COP_EN = 1; } /*---------------------------------------------------------------------------*/ void watchdog_periodic(void) { + cop_service(); } /*---------------------------------------------------------------------------*/ void watchdog_stop(void) { + CRM->COP_CNTLbits.COP_EN = 0; } /*---------------------------------------------------------------------------*/ void watchdog_reboot(void) { + watchdog_start(); + while(1); } /*---------------------------------------------------------------------------*/