Merge pull request #459 from adamdunkels/push/mc1322x-stuff

MC1322x additions
This commit is contained in:
Mariano Alvira 2013-11-29 11:59:04 -08:00
commit 5fbefbd87b
2 changed files with 22 additions and 7 deletions

View file

@ -81,26 +81,32 @@ else
endif endif
$(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S | $(OBJECTDIR) $(OBJECTDIR)/%.lds: $(CONTIKI_CPU)/%.lds.S | $(OBJECTDIR)
$(CPP) $(CPPFLAGS) $< > $@ $(TRACE_CC)
$(Q)$(CPP) $(CPPFLAGS) $< > $@
$(OBJECTDIR)/isr.o: $(CONTIKI_CPU)/src/isr.c | $(OBJECTDIR) $(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 %.o: %.c
$(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c $(TRACE_CC)
$(Q)$(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) $(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 CUSTOM_RULE_S_TO_OBJECTDIR_O = yes
$(OBJECTDIR)/%.o: %.S | $(OBJECTDIR) $(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 CUSTOM_RULE_C_TO_CO=yes
%.co: %.c %.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 .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 %.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,$^)

View file

@ -34,30 +34,38 @@
*/ */
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include <mc1322x.h>
#include <board.h>
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_init(void) watchdog_init(void)
{ {
cop_timeout_ms(1000);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_start(void) watchdog_start(void)
{ {
CRM->COP_CNTLbits.COP_EN = 1;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_periodic(void) watchdog_periodic(void)
{ {
cop_service();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_stop(void) watchdog_stop(void)
{ {
CRM->COP_CNTLbits.COP_EN = 0;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_reboot(void) watchdog_reboot(void)
{ {
watchdog_start();
while(1);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/