Move crc table in ram when we using bootloader.
[bertos.git] / bertos / rules.mk
index fcf62f27fa5f9a7acdd543ec59e8c9d53854e18f..effc3eca0b5414de6145754a17784b732563c5c6 100644 (file)
@@ -121,7 +121,7 @@ endif
 ifneq ($$($(1)_CROSS),)
        #deprecated: use PREFIX, SUFFIX and HOSTED mechanism instead
        $(1)_PREFIX = $$($(1)_CROSS)
-       $(1)_SUFFIX = ""
+       $(1)_SUFFIX =
 endif
 
 $(1)_CC      ?= $$($(1)_PREFIX)$$(CC)$$($(1)_SUFFIX)
@@ -242,17 +242,62 @@ $$(OUTDIR)/$(1)_whole.elf: bumprev $$($(1)_SRC) $$($(1)_LDSCRIPT)
        $Q $$($(1)_CC) $$($(1)_SRC) $$(CFLAGS) $$($(1)_CFLAGS) $$(LIB) $$(LDFLAGS) $$($(1)_LDFLAGS) -o $$@
 
 # Flash target
-# NOTE: we retry in case of failure because the STK500 programmer is crappy
 .PHONY: flash_$(1)
-flash_$(1): $(OUTDIR)/$(1).s19 flash_$(1)_local
-       if ! $(AVRDUDE) $(DPROG) -p $$($(1)_MCU) -U flash:w:$$< ; then \
-            $(AVRDUDE) $(DPROG) -p $$($(1)_MCU) -U flash:w:$$< ; \
+flash_$(1): $(OUTDIR)/$(1).hex flash_$(1)_local
+       $L "$(1): Flashing target"
+       $Q if [ ! -f $$($(1)_FLASH_SCRIPT) ] ; then \
+               printf "CLDLG: No flash script found.\n" ; \
+               exit 1 ; \
        fi
-       #avarice --mkII -j usb --erase --program --verify --file images/triface.elf
+       $Q if [ ! "$$($(1)_PROGRAMMER_TYPE)" == "none" ] ; then \
+               PROGRAMMER_CPU=$$($(1)_PROGRAMMER_CPU) PROGRAMMER_TYPE=$$($(1)_PROGRAMMER_TYPE) \
+               PROGRAMMER_PORT=$$($(1)_PROGRAMMER_PORT) IMAGE_FILE=$$< \
+               $$($(1)_FLASH_SCRIPT) ; \
+       else \
+               printf "CLDLG: No programmer interface configured, see http://dev.bertos.org/wiki/ProgrammerInterface\n" ; \
+               exit 1 ; \
+       fi 
 
 .PHONY: flash_$(1)_local
 flash_$(1)_local:
 
+.PHONY: stopflash_$(1)
+stopflash_$(1): 
+       $L "$(1): Stopping target flashing"
+       $Q if [ ! -f $$($(1)_STOPFLASH_SCRIPT) ] ; then \
+               printf "CLDLG: No stopflash script found.\n" ; \
+               exit 1 ; \
+       fi
+       $Q $$($(1)_STOPFLASH_SCRIPT) ;
+
+
+# Debug target
+.PHONY: debug_$(1)
+debug_$(1): $(OUTDIR)/$(1).elf
+       $L "$(1): Debugging target"
+       $Q if [ ! -f $$($(1)_DEBUG_SCRIPT) ] ; then \
+               printf "CLDLG: No debug script found.\n" ; \
+               exit 1 ; \
+       fi
+       $Q if [ ! "$$($(1)_PROGRAMMER_TYPE)" == "none" ] ; then \
+               PROGRAMMER_CPU=$$($(1)_PROGRAMMER_CPU) PROGRAMMER_TYPE=$$($(1)_PROGRAMMER_TYPE) \
+               PROGRAMMER_PORT=$$($(1)_PROGRAMMER_PORT) GDB_PORT=3333 \
+               ELF_FILE=$$< \
+               $$($(1)_DEBUG_SCRIPT) ; \
+       else \
+               printf "CLDLG: No programmer interface configured, see http://dev.bertos.org/wiki/ProgrammerInterface\n" ; \
+               exit 1 ; \
+       fi
+
+.PHONY: stopdebug_$(1)
+stopdebug_$(1): 
+       $L "$(1): Stopping debugger"
+       $Q if [ ! -f $$($(1)_STOPDEBUG_SCRIPT) ] ; then \
+               printf "CLDLG: No stopdebug script found.\n" ; \
+               exit 1 ; \
+       fi
+       $Q $$($(1)_STOPDEBUG_SCRIPT) ;
+
 .PHONY: fuses_$(!)
 fuses_$(1):
        if [ ! -z "$$($(1)_efuse)" ] ; then \