ioport: No longer need pcint to change the value
[simavr] / Makefile.common
index 77b1ad3..182c432 100644 (file)
@@ -34,32 +34,39 @@ ifeq (${shell uname}, Darwin)
 AVR_ROOT := "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/"
 AVR_INC := ${AVR_ROOT}/avr-4/
 AVR := ${AVR_ROOT}/bin/avr-
+LFLAGS += -L/opt/local/lib
 else
 AVR_ROOT := /usr/lib/avr
 AVR_INC := ${AVR_ROOT}
 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 -j .eeprom -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
 
@@ -69,7 +76,7 @@ ${OBJ}/%.o: %.c
        @echo CC $<
 
 ${OBJ}: 
-       mkdir -p ${OBJ}
+       @mkdir -p ${OBJ}
 
 # include the dependency files generated by gcc, if any
 -include ${wildcard ${OBJ}/*.d}