AVR := avr-
endif
+# The code is compiled "optimized" to the max.
+#
+# The wierd "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"
+# is used to tell the linker not to discard the .mmcu section,
+# otherwise the --gc-sections will delete it.
+
%.hex: %.axf
- @${AVR}objcopy -j .text -j .data -O ihex ${<} ${@}
+ @${AVR}objcopy -j .text -j .data -O ihex ${<} ${@}
%.s: %.axf
- @${AVR}objdump -j .text -j .data -j .bss -d ${<} > ${@}
+ @${AVR}objdump -j .text -j .data -j .bss -d ${<} > ${@}
-# --mcall-prologues
+# --mcall-prologues can be used here, but messes up debugging a little
%.axf: %.c
- @echo AVR-CC ${<}
- @part=${<} ; part=$${part/_*}; \
- ${AVR}gcc -Wall -gdwarf-2 -Os -std=gnu99 \
- -mmcu=$$part \
- -DF_CPU=8000000 \
- -fno-inline-small-functions \
- -ffunction-sections -fdata-sections \
- -Wl,--relax,--gc-sections \
- -Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000 \
- -I../include -I../../include \
- ${<} -o ${@}
- @${AVR}size ${@}|sed '1d'
+ @echo AVR-CC ${<}
+ @part=${<} ; part=$${part/_*}; \
+ ${AVR}gcc -Wall -gdwarf-2 -Os -std=gnu99 \
+ -mmcu=$$part \
+ -DF_CPU=8000000 \
+ -fno-inline-small-functions \
+ -ffunction-sections -fdata-sections \
+ -Wl,--relax,--gc-sections \
+ -Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000 \
+ -I../include -I../../include \
+ ${<} -o ${@}
+ @${AVR}size ${@}|sed '1d'
OBJ = obj
@echo CC $<
${OBJ}:
- mkdir -p ${OBJ}
+ @mkdir -p ${OBJ}
# include the dependency files generated by gcc, if any
-include ${wildcard ${OBJ}/*.d}
sim = ${wildcard sim/sim_*.c} ${wildcard sim/avr_*.c}
sim_o = ${patsubst sim/%.c, obj/%.o, ${sim}}
-VPATH = .
-VPATH += cores
+VPATH = cores
VPATH += sim
-IPATH = .
-IPATH += sim
+IPATH = sim
IPATH += ../../shared
IPATH += ../include
-IPATH += /opt/local/include
+# Thats for MacPorts libelf
+IPATH += /opt/local/include
LFLAGS = -L/opt/local/lib/
all: obj libsimavr.a ${target}
# And compile it into an ELF binary.
# It also disassemble it for debugging purposes.
#
-# The code is compiled "optimized" to the max.
-#
-# The wierd "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"
-# is used to tell the linker not to discard the .mmcu section,
-# otherwise the --gc-sections will delete it.
#
# Copyright 2008, 2009 Michel Pollet <buserror@gmail.com>
#