Skip to content

Commit a62ef21

Browse files
ladyadadeanm1278
authored andcommitted
fix makefile for easier programming
1 parent cd52f71 commit a62ef21

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

bootloaders/zero/Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
# Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
23
# Copyright (c) 2015 Arduino LLC. All right reserved.
34
#
@@ -98,6 +99,17 @@ SOURCES= \
9899
sam_ba_monitor.c \
99100
sam_ba_serial.c
100101

102+
=======
103+
IDE_PATH="../../../../.."
104+
ARM_GCC_PATH=$(IDE_PATH)/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin
105+
CC=$(ARM_GCC_PATH)/arm-none-eabi-gcc
106+
CFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -c -g -Os -w -std=gnu99 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500
107+
LDFLAGS=-mthumb -mcpu=cortex-m0plus -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
108+
BLD_EXTA_FLAGS=-D__SAMD21G18A__
109+
BUILD_PATH=build
110+
INCLUDES=-I$(IDE_PATH)/hardware/tools/CMSIS/CMSIS/Include/ -I$(IDE_PATH)/hardware/tools/CMSIS/Device/ATMEL/ -I./drivers/ -I./utils/ -I./utils/preprocessor/ -I./utils/interrupt
111+
SOURCES=main.c sam_ba_monitor.c startup_samd21.c usart_sam_ba.c drivers/cdc_enumerate.c drivers/uart_driver.c utils/interrupt/interrupt_sam_nvic.c
112+
>>>>>>> fix makefile for easier programming
101113
OBJECTS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.o))
102114
DEPS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.d))
103115

@@ -109,10 +121,16 @@ else
109121
AS_CLEAN=
110122
endif
111123

124+
<<<<<<< HEAD
112125
LD_SCRIPT=bootloader_samd21x18.ld
126+
=======
127+
NAME=samd21_sam_ba
128+
EXECUTABLE=$(NAME).bin
129+
>>>>>>> fix makefile for easier programming
113130

114131
all: print_info $(SOURCES) $(BIN) $(HEX) $(AS_BUILD)
115132

133+
<<<<<<< HEAD
116134
$(ELF): Makefile $(BUILD_PATH) $(OBJECTS)
117135
@echo ----------------------------------------------------------
118136
@echo Creating ELF binary
@@ -171,3 +189,17 @@ clean: $(AS_CLEAN)
171189
-rmdir $(BUILD_PATH)
172190

173191
.phony: print_info $(BUILD_PATH)
192+
=======
193+
all: $(SOURCES) $(EXECUTABLE)
194+
195+
$(EXECUTABLE): $(OBJECTS)
196+
$(CC) -L$(BUILD_PATH) $(LDFLAGS) -Os -Wl,--gc-sections -save-temps -Tsamd21j18a_flash.ld -Wl,-Map,$(BUILD_PATH)/$(NAME).map --specs=nano.specs --specs=nosys.specs -o $(BUILD_PATH)/$(NAME).elf $(OBJECTS) -Wl,--start-group -lm -Wl,--end-group
197+
$(ARM_GCC_PATH)/arm-none-eabi-objcopy -O binary $(BUILD_PATH)/$(NAME).elf $@
198+
199+
$(BUILD_PATH)/%.o: %.c
200+
-@mkdir -p $(@D)
201+
$(CC) $(CFLAGS) $(BLD_EXTA_FLAGS) $(INCLUDES) $< -o $@
202+
203+
clean:
204+
del $(EXECUTABLE) $(subst /,\,$(OBJECTS)) $(subst /,\,$(BUILD_PATH)/$(NAME).*)
205+
>>>>>>> fix makefile for easier programming

0 commit comments

Comments
 (0)