I am using the eclipse/gcc toolchain as explained in this tutorial. I am able to generate and flash my application code and softdevice separately using hex format.
I am using the flash
and flash_softdevice
targets defined in the makefiles of nRF51 SDK:
flash: $(MAKECMDGOALS)
@echo Flashing: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
nrfjprog --reset --program $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
## Flash softdevice
flash_softdevice:
@echo Flashing: s110_softdevice.hex
nrfjprog --reset --program ../../../../../../components/softdevice/s110/hex/s110_softdevice.hex
I do not know why, but although the flashing process of the two hex files works ok, the application in BLE Nano does not work.
If I merge the two files using the nRF51 tools, the app keeps not workig on my BLE Nano.
mergehex.exe --merge ../../../../../../components/softdevice/s110/hex/s110_softdevice.hex $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex --output $(OUTPUT_BINARY_DIRECTORY)/merge_$(OUTPUT_FILENAME).hex
nrfjprog --reset --program $(OUTPUT_BINARY_DIRECTORY)/merge_$(OUTPUT_FILENAME).hex
However the hex file generated in the previous step is a good one. I can upload it to BLE Nano using the MK-20 USB dongle and drag&drop in the BLE Nano drive. Once flashed, the app is properly installed and I can use it.
From this moment (after flashing once with MK_20 dongle), I can recompile my app in eclipse/gcc and generate a new $(OUTPUT_FILENAME).hex file and flash it to BLE Nano from eclipse or command line with the flash
target (no need to use the BLE Nano dongle).
I believe that I am missing some paratmeters (bootloader?) or commands (reset?) when trying to flash from eclipse. Any help about what do I need to do to upload the merged HEX file from eclipse/command line?