Commit 883eee82 by PrithviRaj Narendra

BMP command to upload the program and eraseall added to the Makefile. Recover,…

BMP command to upload the program and eraseall added to the Makefile. Recover, pinreset and reset aren't available yet.
parent 63ecc3ce
......@@ -218,19 +218,19 @@ $(BUILD_DIRS) :
# Create objects from C source files
$(OBJ_DIR)/%.o : %.c
@echo "Build header dependencies & compiling file: " $<
@echo "CC " $<
$(Q)$(CC) $(CFLAGS) -M $< -MF "$(@:.o=.d)" -MT $@
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
## Assemble .S files
$(OBJ_DIR)/%.o : %.S
@echo "Compiling: " $<
@echo "CC " $<
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
## Link C and assembler objects to an .elf file
$(OUTPUT_DIR)/$(OUTPUT_NAME).elf : $(BUILD_DIRS) $(C_OBJ) $(ASSEMBLY_OBJ)
@echo
@echo "Linking object files to create $(OUTPUT_DIR)/$(OUTPUT_NAME).elf"
@echo "LD $(OUTPUT_DIR)/$(OUTPUT_NAME).elf"
$(Q)$(CC) $(LDFLAGS) $(C_OBJ) $(ASSEMBLY_OBJ) -o $(OUTPUT_DIR)/$(OUTPUT_NAME).elf
## Create binary .bin file from the .elf file
......@@ -245,26 +245,58 @@ $(OUTPUT_DIR)/$(OUTPUT_NAME).hex : $(OUTPUT_DIR)/$(OUTPUT_NAME).elf
$(Q)$(OBJCOPY) -O ihex $(OUTPUT_DIR)/$(OUTPUT_NAME).elf $(OUTPUT_DIR)/$(OUTPUT_NAME).hex
@if [ "$(SD_USED_LC)" != "blank" ]; then\
echo "Create combined $(SD_USED) and $(APPLN).hex file $(OUTPUT_FLASHING).hex "; \
srec_cat $(PWD)/$(SOFTDEVICE) -Intel $(PWD)/$(OUTPUT_DIR)/$(OUTPUT_NAME).hex -Intel -O $(PWD)/$(OUTPUT_DIR)/$(OUTPUT_FLASHING).hex -Intel --line-length=44; \
srec_cat $(PWD)/$(SOFTDEVICE) -Intel $(PWD)/$(OUTPUT_DIR)/$(OUTPUT_NAME).hex -Intel -O $(PWD)/$(OUTPUT_DIR)/$(OUTPUT_FLASHING).hex -Intel --line-length=44; \
fi
## Program device
upload:
$(RM) $(OUTPUT_DIR)/upload.jlink
echo "device $(JLINKDEVICE)\nw4 $(NVMC_CONFIG_ADRS) 1\nloadfile $(PWD)/$(OUTPUT_DIR)/$(OUTPUT_FLASHING).hex\nr\ng\nqc\n" > $(OUTPUT_DIR)/upload.jlink
@echo "Starting uploading"
$(JLINK) $(OUTPUT_DIR)/upload.jlink
@echo "Done uploading"
@if [ "$(DEBUGGER)" = "JLINK" ]; then\
$(RM) $(OUTPUT_DIR)/upload.jlink; \
echo "device $(JLINKDEVICE)\nw4 $(NVMC_CONFIG_ADRS) 1\nloadfile $(PWD)/$(OUTPUT_DIR)/$(OUTPUT_FLASHING).hex\nr\ng\nqc\n" > $(OUTPUT_DIR)/upload.jlink; \
$(JLINK) $(OUTPUT_DIR)/upload.jlink; \
elif [ "$(DEBUGGER)" = "BMP" ]; then \
arm-none-eabi-gdb -q -ex 'target extended-remote /dev/ttyBmpGdb' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'load' -ex 'detach' -ex 'quit' $(OUTPUT_DIR)/$(OUTPUT_FLASHING).hex; \
else\
echo "Use the DEBUGGER variable to specify the debugger to be used for uploading"; \
fi
# Erase all the flash, UICR and disables the read back protection mechanism if enabled
recover:
$(NRFJPROG) --recover
@if [ "$(DEBUGGER)" = "JLINK" ]; then\
$(NRFJPROG) --recover;\
elif [ "$(DEBUGGER)" = "BMP" ]; then \
echo "Recover is not possible with Black Magic Probe yet."; \
else\
echo "Use the DEBUGGER variable to specify the debugger to be used for the recover operation"; \
fi
eraseall:
$(NRFJPROG) --eraseall
eraseall:
@if [ "$(DEBUGGER)" = "JLINK" ]; then\
$(NRFJPROG) --eraseall; \
elif [ "$(DEBUGGER)" = "BMP" ]; then \
arm-none-eabi-gdb -q -ex 'target extended-remote /dev/ttyBmpGdb' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'mon erase_mass' -ex 'detach' -ex 'quit'; \
else\
echo "Use the DEBUGGER variable to specify the debugger to be used for the erase all operation"; \
fi
pinreset:
$(NRFJPROG) --pinresetenable
$(NRFJPROG) --pinreset
@if [ "$(DEBUGGER)" = "JLINK" ]; then\
$(NRFJPROG) --pinresetenable;\
$(NRFJPROG) --pinreset;\
elif [ "$(DEBUGGER)" = "BMP" ]; then \
echo "Pin reset is not possible with Black Magic Probe yet."; \
else\
echo "Use the DEBUGGER variable to specify the debugger to be used for the pin reset operation"; \
fi
reset:
@if [ "$(DEBUGGER)" = "JLINK" ]; then\
$(NRFJPROG) --reset;\
elif [ "$(DEBUGGER)" = "BMP" ]; then \
arm-none-eabi-gdb -q -ex 'target extended-remote /dev/ttyBmpGdb' -ex 'monitor swdp_scan' -ex 'attach 1' ; \
else\
echo "Use the DEBUGGER variable to specify the debugger to be used for the reset operation"; \
fi
doc:
( cat $(DOC_DIR)/Appiko.doxyfile ; echo "$(DOXY_EDITS)" ) | doxygen -
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment