aboutsummaryrefslogtreecommitdiff
path: root/examples/blink
diff options
context:
space:
mode:
Diffstat (limited to 'examples/blink')
-rw-r--r--examples/blink/.config (renamed from examples/blink/config.orig)1
-rw-r--r--examples/blink/Makefile39
-rw-r--r--examples/blink/config24
3 files changed, 23 insertions, 41 deletions
diff --git a/examples/blink/config.orig b/examples/blink/.config
index 529a7d3..52dfc53 100644
--- a/examples/blink/config.orig
+++ b/examples/blink/.config
@@ -5,6 +5,7 @@
MMCU="atmega328p"
ATMEGA328P=y
# ATTINY85 is not set
+# ATTINY4313 is not set
F_CPU=16000
#
diff --git a/examples/blink/Makefile b/examples/blink/Makefile
index 43941b6..ef7e205 100644
--- a/examples/blink/Makefile
+++ b/examples/blink/Makefile
@@ -4,13 +4,14 @@ PROJNAME = blink
SRC = blink.c
OBJ = $(patsubst %.c,%.o,$(SRC)) # This creates list of *.o files from *.c
+Q ?= @ # This can be overwritten to show commands
.PHONY: all
-ifneq ("$(wildcard config)","") # Checking if configuration exists
+ifneq ("$(wildcard .config)","") # Checking if configuration exists
all: $(PROJNAME).hex
@echo Now you can flash $< to your chip.
else
-all: help
+all: .config
endif
# Edit here help like you ever want
@@ -26,39 +27,43 @@ help:
.PHONY: clean
clean:
@echo " CLEAN OBJ"
- @$(RM) $(OBJ)
+ $(Q)$(RM) $(OBJ)
@echo " CLEAN $(PROJNAME).elf $(PROJNAME).hex"
- @$(RM) $(PROJNAME).elf $(PROJNAME).hex
- @$(MAKE) -C ../.. clean
+ $(Q)$(RM) $(PROJNAME).elf $(PROJNAME).hex
+ $(Q)$(MAKE) -C ../.. clean O=examples/blink
# Building targets are available only if configuration is generated
-ifneq ("$(wildcard config)","")
--include config
+ifneq ("$(wildcard .config)","")
+-include .config
# If you want change some standard CFLAGS, change them in configuration not here.
# Add here only options that should not be applied to avr-ioe also.
-CFLAGS = -I../../include -mmcu=$(MMCU) -imacros ../../.config.h \
+CFLAGS = -I../../include -mmcu=$(MMCU) -imacros build/config.h \
$(shell echo $(CONFCFLAGS)) $(shell echo -DF_CPU=$(F_CPU)000L)
-$(PROJNAME).elf: ../../libioe.a
+$(PROJNAME).elf: libioe.a
$(PROJNAME).elf: $(OBJ)
@echo " LD $@"
- @avr-gcc -Os -mmcu=$(MMCU) $^ -o $@ -L../.. -lioe
+ $(Q)avr-gcc -Os -mmcu=$(MMCU) $(filter %.o,$^) -o $@ -L. -lioe
$(PROJNAME).hex: $(PROJNAME).elf
@echo " OBJCOPY $@"
- @avr-objcopy -O ihex -R .eeprom $< $@
+ $(Q)avr-objcopy -O ihex -R .eeprom $< $@
-$(OBJ): %.o: %.c ../../libioe.a
+$(OBJ): %.o: %.c libioe.a
@echo " CC $@"
- @avr-gcc $(CFLAGS) -c -o $@ $<
+ $(Q)avr-gcc $(CFLAGS) -c -o $@ $<
-../../libioe.a: config
- @CONFIG=$$(readlink -f config) $(MAKE) -C ../.. libioe.a
+libioe.a: .config
+ $(Q)$(MAKE) -C ../.. examples/blink/libioe.a O=examples/blink
endif
+.config:
+ @echo Configuration for this example is missing. Probably deleted...
+ @exit 1
+
config:
- @CONFIG=$$(readlink -f config) $(MAKE) -C ../.. config
+ $(Q)$(MAKE) -C ../.. config O=examples/blink
.PHONY: menuconfig
menuconfig:
- @CONFIG=$$(readlink -f config) $(MAKE) -C ../.. menuconfig
+ $(Q)$(MAKE) -C ../.. menuconfig O=examples/blink
diff --git a/examples/blink/config b/examples/blink/config
deleted file mode 100644
index 09169d4..0000000
--- a/examples/blink/config
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Automatically generated file; DO NOT EDIT.
-# AVR-IOE configuration
-#
-MMCU=atmega328p
-ATMEGA328P=y
-# ATTINY85 is not set
-F_CPU=16000
-
-#
-# Compilation options
-#
-GNUTOOLCHAIN_PREFIX=avr-
-CONFCFLAGS=-Os -ffunction-sections -fdata-sections -fshort-enums -Wall
-MCUSUPPORT_IOPORTS=y
-CONFIG_IOPORTS=y
-MCUSUPPORT_PCINT0=y
-MCUSUPPORT_PCINT1=y
-MCUSUPPORT_PCINT2=y
-# CONFIG_IOPORTS_PCINT is not set
-MCUSUPPORT_SPI=y
-# CONFIG_SPI is not set
-MCUSUPPORT_USART=y
-# CONFIG_USART is not set