2015-02-28 06:20:04 -05:00
|
|
|
BUILD = bootmgr/build/$(BOARD)/$(BTYPE)
|
2015-02-06 09:35:48 -05:00
|
|
|
|
|
|
|
BOOT_INC = -Ibootmgr
|
|
|
|
BOOT_INC += -Ibootmgr/sl
|
|
|
|
BOOT_INC += -Ihal
|
|
|
|
BOOT_INC += -Ihal/inc
|
2015-02-21 14:55:57 -05:00
|
|
|
BOOT_INC += -I../drivers/cc3100/inc
|
2015-02-25 16:38:33 -05:00
|
|
|
BOOT_INC += -Imisc
|
2015-02-25 05:08:51 -05:00
|
|
|
BOOT_INC += -Imods
|
2015-02-06 09:35:48 -05:00
|
|
|
BOOT_INC += -Isimplelink
|
|
|
|
BOOT_INC += -Isimplelink/oslib
|
|
|
|
BOOT_INC += -Iutil
|
|
|
|
BOOT_INC += -I..
|
|
|
|
BOOT_INC += -I.
|
|
|
|
BOOT_INC += -I$(BUILD)
|
|
|
|
|
|
|
|
BOOT_CPPDEFINES = -Dgcc -DBOOTLOADER -DTARGET_IS_CC3200 -DSL_TINY
|
|
|
|
|
|
|
|
BOOT_HAL_SRC_C = $(addprefix hal/,\
|
|
|
|
cpu.c \
|
|
|
|
interrupt.c \
|
2015-03-15 05:05:15 -04:00
|
|
|
pin.c \
|
2015-02-06 09:35:48 -05:00
|
|
|
prcm.c \
|
|
|
|
shamd5.c \
|
|
|
|
spi.c \
|
|
|
|
startup_gcc.c \
|
|
|
|
systick.c \
|
|
|
|
utils.c \
|
|
|
|
)
|
|
|
|
|
2015-02-21 14:55:57 -05:00
|
|
|
BOOT_CC3100_SRC_C = $(addprefix drivers/cc3100/,\
|
|
|
|
src/device.c \
|
|
|
|
src/driver.c \
|
|
|
|
src/flowcont.c \
|
|
|
|
src/fs.c \
|
|
|
|
src/netapp.c \
|
|
|
|
src/netcfg.c \
|
|
|
|
src/nonos.c \
|
|
|
|
src/socket.c \
|
|
|
|
src/spawn.c \
|
|
|
|
src/wlan.c \
|
|
|
|
)
|
|
|
|
|
2015-02-25 16:38:33 -05:00
|
|
|
BOOT_MISC_SRC_C = $(addprefix misc/,\
|
|
|
|
mperror.c \
|
|
|
|
)
|
|
|
|
|
2015-02-06 09:35:48 -05:00
|
|
|
BOOT_SL_SRC_C = $(addprefix simplelink/,\
|
|
|
|
cc_pal.c \
|
|
|
|
)
|
|
|
|
|
|
|
|
BOOT_UTIL_SRC_C = $(addprefix util/,\
|
|
|
|
hash.c \
|
|
|
|
)
|
|
|
|
|
|
|
|
BOOT_MAIN_SRC_C = \
|
|
|
|
bootmgr/main.c
|
|
|
|
|
|
|
|
BOOT_MAIN_SRC_S = \
|
|
|
|
bootmgr/runapp.s
|
|
|
|
|
|
|
|
BOOT_PY_SRC_C = $(addprefix py/,\
|
|
|
|
pfenv.c \
|
|
|
|
pfenv_printf.c \
|
|
|
|
)
|
|
|
|
|
|
|
|
BOOT_STM_SRC_C = $(addprefix stmhal/,\
|
|
|
|
printf.c \
|
|
|
|
)
|
2015-04-05 14:44:20 -04:00
|
|
|
|
|
|
|
BOOT_LIB_SRC_C = $(addprefix lib/,\
|
|
|
|
libc/string0.c \
|
|
|
|
)
|
|
|
|
|
2015-02-26 09:29:47 -05:00
|
|
|
OBJ = $(addprefix $(BUILD)/, $(BOOT_HAL_SRC_C:.c=.o) $(BOOT_SL_SRC_C:.c=.o) $(BOOT_CC3100_SRC_C:.c=.o) $(BOOT_UTIL_SRC_C:.c=.o) $(BOOT_MISC_SRC_C:.c=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(BOOT_MAIN_SRC_C:.c=.o) $(BOOT_MAIN_SRC_S:.s=.o) $(BOOT_PY_SRC_C:.c=.o) $(BOOT_STM_SRC_C:.c=.o))
|
2015-04-05 14:44:20 -04:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(BOOT_LIB_SRC_C:.c=.o)
|
2015-02-06 09:35:48 -05:00
|
|
|
|
|
|
|
# Add the linker script
|
|
|
|
LINKER_SCRIPT = bootmgr/bootmgr.lds
|
|
|
|
LDFLAGS += -T $(LINKER_SCRIPT)
|
|
|
|
|
|
|
|
# Add the bootloader specific CFLAGS
|
|
|
|
CFLAGS += $(BOOT_CPPDEFINES) $(BOOT_INC)
|
|
|
|
|
|
|
|
# Disable strict aliasing for the simplelink driver
|
2015-02-21 14:55:57 -05:00
|
|
|
$(BUILD)/drivers/cc3100/src/driver.o: CFLAGS += -fno-strict-aliasing
|
2015-02-06 09:35:48 -05:00
|
|
|
|
|
|
|
# Check if we would like to debug the port code
|
|
|
|
ifeq ($(BTYPE), release)
|
|
|
|
# Optimize everything and define the NDEBUG flag
|
|
|
|
CFLAGS += -Os -DNDEBUG
|
|
|
|
else
|
|
|
|
ifeq ($(BTYPE), debug)
|
|
|
|
# Define the DEBUG flag
|
|
|
|
CFLAGS += -DDEBUG=DEBUG
|
|
|
|
# Optimize the stable sources only
|
|
|
|
$(BUILD)/hal/%.o: CFLAGS += -Os
|
2015-02-25 16:38:33 -05:00
|
|
|
$(BUILD)/misc/%.o: CFLAGS += -Os
|
2015-02-06 09:35:48 -05:00
|
|
|
$(BUILD)/simplelink/%.o: CFLAGS += -Os
|
2015-02-22 11:48:13 -05:00
|
|
|
$(BUILD)/drivers/cc3100/%.o: CFLAGS += -Os
|
2015-02-06 09:35:48 -05:00
|
|
|
$(BUILD)/py/%.o: CFLAGS += -Os
|
|
|
|
$(BUILD)/stmhal/%.o: CFLAGS += -Os
|
|
|
|
else
|
|
|
|
$(error Invalid BTYPE specified)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
SHELL = bash
|
|
|
|
BOOT_GEN = bootmgr/bootgen.sh
|
|
|
|
HEADER_BUILD = $(BUILD)/genhdr
|
|
|
|
|
|
|
|
all: $(BUILD)/bootloader.bin
|
|
|
|
|
|
|
|
$(BUILD)/bootmgr.axf: $(OBJ) $(LINKER_SCRIPT)
|
|
|
|
$(ECHO) "LINK $@"
|
|
|
|
$(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
|
|
|
|
$(Q)$(SIZE) $@
|
|
|
|
|
|
|
|
$(BUILD)/bootmgr.bin: $(BUILD)/bootmgr.axf
|
|
|
|
$(ECHO) "Create $@"
|
|
|
|
$(Q)$(OBJCOPY) -O binary $< $@
|
|
|
|
|
|
|
|
$(BUILD)/bootloader.bin: $(BUILD)/bootmgr.bin
|
|
|
|
$(ECHO) "Create $@"
|
2015-02-28 06:20:04 -05:00
|
|
|
$(Q)$(SHELL) $(BOOT_GEN) $(BOARD) $(BTYPE)
|
2015-02-06 09:35:48 -05:00
|
|
|
|
|
|
|
# Create an empty "qstrdefs.generated.h" needed by py/mkrules.mk
|
|
|
|
$(HEADER_BUILD)/qstrdefs.generated.h: | $(HEADER_BUILD)
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
# Create an empty "py-version.h" needed by py/mkrules.mk
|
|
|
|
$(HEADER_BUILD)/py-version.h: | $(HEADER_BUILD)
|
|
|
|
touch $@
|