# Programmer type
# see local pgm_config.mk for programmer customization.
-include pgm_config.mk
-DPROG ?= -V -c stk500 -P /dev/ttyS0
OPTCFLAGS = -ffunction-sections -fdata-sections
#OPTCFLAGS = -funsafe-loop-optimizations
# If we use the GCC compiler we should pass some flags.
CORE_CPU = "atmega103"
+include("avr_post.common")
# If we use the GCC compiler we should pass some flags.
CORE_CPU = "atmega128"
+include("avr_post.common")
# If we use the GCC compiler we should pass some flags.
CORE_CPU = "atmega1281"
+include("avr_post.common")
# If we use the GCC compiler we should pass some flags.
CORE_CPU = "atmega168"
+include("avr_post.common")
# If we use the GCC compiler we should pass some flags.
CORE_CPU = "atmega32"
+include("avr_post.common")
# If we use the GCC compiler we should pass some flags.
CORE_CPU = "atmega64"
+include("avr_post.common")
# If we use the GCC compiler we should pass some flags.
CORE_CPU = "atmega8"
+include("avr_post.common")
HW_DIR = CPU_DIR + "avr/hw/"
DRV_DIR = CPU_DIR + "avr/drv/"
+FLASH_SCRIPT = SCRIPT_DIR + "flash.sh"
+DEBUG_SCRIPT = SCRIPT_DIR + "debug.sh"
# Common GCC flags.
CPP_FLAGS = [ "-Os", "-fno-strict-aliasing", "-I" + CPU_DIR + "avr/"]
--- /dev/null
+
+# CPU type used for flashing
+PROGRAMMER_CPU = CORE_CPU
+
--- /dev/null
+#!/usr/bin/env bash
+
+avrdude -p ${PROGRAMMER_CPU} -c ${PROGRAMMER_TYPE} -P ${PROGRAMMER_PORT} -U ${IMAGE_FILE}
# 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:$$< ; \
- fi
- #avarice --mkII -j usb --erase --program --verify --file images/triface.elf
+flash_$(1): $(OUTDIR)/$(1).hex flash_$(1)_local
+ PROGRAMMER_CPU=$$($(1)_PROGRAMMER_CPU) PROGRAMMER_TYPE=$(PROGRAMMER_TYPE) \
+ PROGRAMMER_PORT=$(PROGRAMMER_PORT) IMAGE_FILE=$$< \
+ $$($(1)_FLASH_SCRIPT)
.PHONY: flash_$(1)_local
flash_$(1)_local:
triface_PCSRC += bertos/mware/formatwr.c
-
triface_CFLAGS = -O2 -D'ARCH=(ARCH_TRIFACE)' -D'CPU_FREQ=(14745600UL)' -D'WIZ_AUTOGEN' -fno-strict-aliasing -Iexamples/triface -Ibertos/cpu/avr
triface_LDFLAGS = -Wl
+triface_PROGRAMMER_CPU = atmega1281
+triface_FLASH_SCRIPT = bertos/cpu/avr/scripts/flash.sh
# Set to 1 for debug builds
boot_DEBUG = 0
boot_LDFLAGS = -Wl,--relax -Wl,--section-start=.text=$(BOOT_ADDR_START)
+boot_PROGRAMMER_CPU = atmega1281
+boot_FLASH_SCRIPT = bertos/cpu/avr/scripts/flash.sh