diff --git a/Makefile b/Makefile index c5491fd..cea263f 100644 --- a/Makefile +++ b/Makefile @@ -305,7 +305,7 @@ $(info ASFLAGS $(ASFLAGS)) $(info ) endif -.PHONY: all clean flash dfu-flash sd erase gdbflash gdb +.PHONY: all clean flash dfu-flash sd gdbflash gdb # default target to build all: $(BUILD)/$(OUT_FILE)-nosd.out $(BUILD)/$(MERGED_FILE).hex @@ -332,10 +332,6 @@ sd: @echo Flashing: $(SD_HEX) $(NRFJPROG) --program $(SD_HEX) -f nrf52 --chiperase --reset -erase: - @echo Erasing chip - $(NRFJPROG) --eraseall -f nrf52 - gdbflash: $(BUILD)/$(MERGED_FILE).hex @echo Flashing: $< @$(GDB_BMP) -nx --batch -ex 'load $<' -ex 'compare-sections' -ex 'kill' @@ -369,7 +365,7 @@ $(BUILD)/$(OUT_FILE)-nosd.out: $(BUILD) $(OBJECTS) @$(SIZE) $@ #------------------- Binary generator ------------------- -.PHONY: genhex genpkg combinehex +.PHONY: genhex genpkg ## Create binary .hex file from the .out file genhex: $(BUILD)/$(OUT_FILE)-nosd.hex @@ -379,8 +375,6 @@ $(BUILD)/$(OUT_FILE)-nosd.hex: $(BUILD)/$(OUT_FILE)-nosd.out @$(OBJCOPY) -O ihex $< $@ # merge bootloader and sd hex together -combinehex: $(BUILD)/$(MERGED_FILE).hex - $(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_FILE)-nosd.hex @echo CR $(MERGED_FILE).hex @mergehex -q -m $< $(SD_HEX) -o $@ diff --git a/README.md b/README.md index 1ff105d..6c65816 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,7 @@ both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to a ## How to compile and build You should only continue if you are looking to develop bootloader for your own. -You must have have a J-Link available to "unbrick" your device. - -### Option 1: Build with Makefile +You must have have a J-Link available to "unbrick" your device. Prerequisites @@ -117,7 +115,7 @@ Prerequisites To build: ``` -make BOARD=feather_nrf52840_express all combinehex +make BOARD=feather_nrf52840_express all ``` To flash the bootloader with JLink: @@ -138,12 +136,6 @@ To flash SoftDevice (and chip erase): make BOARD=feather_nrf52840_express sd ``` -To erase all of flash: - -``` -make BOARD=feather_nrf52840_express erase -``` - For the list of supported boards, run `make` without `BOARD=` : ``` @@ -167,13 +159,11 @@ make: *** [_build/main.o] Error 127 ``` ... you may need to pass the location of the GCC ARM toolchain binaries to `make` using -the variable `GNU_INSTALL_ROOT` as below: +the variable `CROSS_COMPILE` as below: ``` -$ make GNU_INSTALL_ROOT=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/ BOARD=feather_nrf52832 all +$ make CROSS_COMPILE=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi- BOARD=feather_nrf52832 all ``` -_Please note that the path needs a trailing path separator (a `/`)_ - #### 2. `mergehex: No such file or directory` Make sure that `mergehex` is available from the command-line. This binary is @@ -184,22 +174,3 @@ part of Nordic's nRF5x Command Line Tools. Make sure that `nrfjprog` is available from the command-line. This binary is part of Nordic's nRF5x Command Line Tools. -On POSIX-type systems you can temporarily add the path to `nrfjprog` via a -variation on the following command: - -``` -$ export PATH=$PATH:/location/of/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog -``` - -### Option 2: Build using Segger Embedded Studio - -For easier debugging you can also use [SES](https://www.segger.com/products/development-tools/embedded-studio/). -The project file is located at `src/segger/Adafruit_nRF52_Bootloader.emProject`. - -> **Note**: SES only flashes the bootloader when you click download, not the SoftDevice. -You need to flash the SoftDevice beforehand if you haven't already done so. -As mentioned above do something like: - -``` -make BOARD=feather_nrf52840_express sd -``` diff --git a/tools/build_all.py b/tools/build_all.py index 0243724..24640f5 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -34,7 +34,7 @@ for board in all_boards: os.makedirs(bin_directory, exist_ok=True) start_time = time.monotonic() - make_result = subprocess.run("make -j 4 BOARD={} combinehex genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + make_result = subprocess.run("make -j 4 BOARD={} all genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) build_duration = time.monotonic() - start_time flash_size = "-"