Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Klaehn
3a31e2bcb9 multi-app based on nrf52sdk 2020-03-14 11:30:36 +01:00

View File

@ -0,0 +1,79 @@
NRF_C_OBJS = $(patsubst $(NRF_PATH)%,$(OBJ_DIR)/%,$(patsubst %.c,%.o,$(NRF_C_SRCS)))
NRF_A_SRCS = $(NRF_PATH)modules/nrfx/mdk/gcc_startup_nrf52.S
NRF_A_OBJS = $(patsubst $(NRF_PATH)%,$(OBJ_DIR)/%,$(patsubst %.S,%.o,$(NRF_A_SRCS)))
C_FLAGS += -DBOARD_PCA10040
C_FLAGS += -DBSP_DEFINES_ONLY
C_FLAGS += -DCONFIG_GPIO_AS_PINRESET
C_FLAGS += -DFLOAT_ABI_HARD
C_FLAGS += -DNRF52
C_FLAGS += -DNRF52832_XXAA
C_FLAGS += -DNRF52_PAN_74
C_FLAGS += -DNRF_SD_BLE_API_VERSION=7
C_FLAGS += -DS132
C_FLAGS += -DSOFTDEVICE_PRESENT
C_FLAGS += -mcpu=$(CPU)
C_FLAGS += -mthumb -mabi=aapcs
C_FLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
C_FLAGS += -fno-builtin -fshort-enums
C_FLAGS += -D__HEAP_SIZE=8192
C_FLAGS += -D__HEAP_SIZE=8192
# Assembler flags common to all targets
A_FLAGS += -g$(OPT)
A_FLAGS += -mcpu=$(CPU)
A_FLAGS += -mthumb -mabi=aapcs
A_FLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
A_FLAGS += -DBOARD_PCA10040
A_FLAGS += -DBSP_DEFINES_ONLY
A_FLAGS += -DCONFIG_GPIO_AS_PINRESET
A_FLAGS += -DFLOAT_ABI_HARD
A_FLAGS += -DNRF52
A_FLAGS += -DNRF52832_XXAA
A_FLAGS += -DNRF52_PAN_74
A_FLAGS += -DNRF_SD_BLE_API_VERSION=7
A_FLAGS += -DS132
A_FLAGS += -DSOFTDEVICE_PRESENT
A_FLAGS += -D__HEAP_SIZE=8192
A_FLAGS += -D__HEAP_SIZE=8192
LINKER_SCRIPT = config/build/$(PLATFORM)/$(APPLICATION)/linker.ld
# Linker flags
LD_FLAGS += -O$(OPT) -g$(OPT)
LD_FLAGS += -mthumb -mabi=aapcs -L$(NRF_PATH)modules/nrfx/mdk -T$(LINKER_SCRIPT)
LD_FLAGS += -mcpu=$(CPU)
LD_FLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
LD_FLAGS += -Wl,--gc-sections
LD_FLAGS += --specs=nano.specs
.PHONY: package flash flash_softdevice erase
package: $(TARGET_HEX)
nrfutil pkg generate --hw-version 52 --application-version 1 --application $(TARGET_HEX) --sd-req 0xCB --sd-id 0xCB --key-file keys/private.key $(TARGET_PACKAGE)
flash: $(TARGET_HEX)
@echo Flashing: $(TARGET_HEX)
nrfjprog -f nrf52 --program $(TARGET_HEX) --sectorerase
nrfjprog -f nrf52 --reset
flash_softdevice: $(THIS_MAKEFILE)
@echo Flashing: $(NRF_PATH)/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex
nrfjprog -f nrf52 --program $(NRF_PATH)/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex --sectorerase
nrfjprog -f nrf52 --reset
erase:
nrfjprog -f nrf52 --eraseall
$(OBJ_DIR)/%.d: $(NRF_PATH)/%.S $(THIS_MAKEFILE)
@mkdir -p $(dir $@)
$(CPP) -MM -MF $@ -MP -MT $(patsubst %.d,%.o,$@) $(C_FLAGS) $(CPP_FLAGS) $(patsubst $(OBJ_DIR)/%.d,$(NRF_PATH)/%.S,$@)
$(OBJ_DIR)/%.o: $(NRF_PATH)/%.c $(THIS_MAKEFILE)
@mkdir -p $(dir $@)
$(CC) -std=c99 -MP -MD -c -o $@ $< $(C_FLAGS) $(CPP_FLAGS)
$(OBJ_DIR)/%.o: $(NRF_PATH)/%.S $(THIS_MAKEFILE)
@mkdir -p $(dir $@)
$(CC) -c $(ASMFLAGS) $< -o $@