CROSS_COMPILE ?= arm-none-eabi-
CC = $(CROSS_COMPILE)gcc
+#DEBUG = -g
+LD_DEBUG = $(DEBUG)
FOPTS = -fno-builtin -ffunction-sections -fdata-sections -ffreestanding
-CFLAGS = -Wall -g -O2 -mthumb -mcpu=$(CPU) $(FOPTS)
-LINKOPTS = -static -g -nostartfiles -nostdlib \
+CFLAGS = -Wall -O2 $(DEBUG) -mthumb -mcpu=$(CPU) $(FOPTS)
+LDFLAGS = -static $(LD_DEBUG) -nostartfiles -nostdlib -Tlpc_link_$(LPC).ld \
-Wl,--gc-sections -Wl,--build-id=none \
- -Wl,-Map=$(TARGET_DIR)/lpc_map_$(LPC).map -Tlpc_link_$(LPC).ld
+ -Wl,-Map=$(TARGET_DIR)/lpc_map_$(LPC).map
APPS = $(subst apps/,,$(wildcard apps/*/*))
.PRECIOUS: %.elf
%.elf: $(OBJS) $(NAME_OBJS)
@echo "Linking $(MODULE)/$(NAME) ..."
- @$(CC) $(LINKOPTS) $(OBJS) $(NAME_OBJS) -o $@
+ @$(CC) $(LDFLAGS) $(OBJS) $(NAME_OBJS) -o $@
%.bin: %.elf
@echo "Creating image : \e[32m$@\e[39m"