demo_LDFLAGS = $(EMUL_LDFLAGS)
# Debug stuff
-ifeq ($(demo_DEBUG),1)
- demo_CFLAGS += -D_DEBUG
- demo_CXXFLAGS += -D_DEBUG
- demo_CSRC += bertos/drv/kdebug.c
-else
+ifeq ($(demo_DEBUG),0)
demo_CFLAGS += -Os
demo_CXXFLAGS += -Os
endif
triface_MCU = atmega64
triface_CROSS = avr-
-# Debug stuff
-ifeq ($(triface_DEBUG),1)
- triface_CFLAGS += -D_DEBUG
- triface_PCSRC += bertos/drv/kdebug.c
-endif
-
# Set to 1 for debug builds
boot_DEBUG = 0
bertos/drv/timer.c \
bertos/algo/crc.c \
bertos/mware/hex.c \
- bertos/kern/kfile.c \
- #
+ bertos/kern/kfile.c \
+ #
boot_CROSS = avr-
boot_CPPFLAGS = -D'ARCH=(ARCH_TRIFACE|ARCH_BOOT)' -Iapp/triface/boot -Ibertos/cpu/avr
boot_CFLAGS = -Os -mcall-prologues
boot_LDSCRIPT = app/triface/boot/boot.ld
boot_LDFLAGS = -Wl,--relax
-
-# Debug stuff
-ifeq ($(boot_DEBUG),1)
- boot_CFLAGS += -D_DEBUG
- boot_PCSRC += bertos/drv/kdebug.c bertos/mware/formatwr.c
-endif
-
$(1)_LDFLAGS += -Wl,-T$$($(1)_LDSCRIPT)
endif
+# Debug stuff
+ifeq ($$($(1)_DEBUG),1)
+ # AVR is an harvard processor
+ # and needs debug module
+ # to be compiled in program memory
+ ifeq ($$(findstring avr, $$($(1)_CROSS)),avr)
+ $(1)_DEBUGSRC = $(1)_PCSRC
+ else
+ $(1)_DEBUGSRC = $(1)_CSRC
+ endif
+
+ $$($(1)_DEBUGSRC) += bertos/drv/kdebug.c
+
+ # Also add formatwr.c (printf) if not already present
+ ifneq ($$(findstring formatwr.c, $$($$($(1)_DEBUGSRC))),formatwr.c)
+ $$($(1)_DEBUGSRC) += bertos/mware/formatwr.c
+ endif
+
+ $(1)_CFLAGS += -D_DEBUG
+ $(1)_CXXFLAGS += -D_DEBUG
+endif
+
$(1)_CC = $$($(1)_CROSS)$$(CC)
$(1)_CXX = $$($(1)_CROSS)$$(CXX)
$(1)_AS = $$($(1)_CROSS)$$(AS)