Skip to content

Commit

Permalink
pkg/nordic_softdevice_ble: reset memory in the .hex file
Browse files Browse the repository at this point in the history
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff
according to #5893 and testing. However, the addresses [0x8bc, 0x3000[ are not
set in softdevice.hex.

So use a modified hex file with all the memory set to 0xff as it is the rom
reset value anyway.

This change updates the `.hex` file instead on relying on erasing the
memory.
  • Loading branch information
cladmi committed Aug 12, 2019
1 parent e5fe868 commit f3e7200
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion boards/common/nrf52/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ifeq (jlink,$(PROGRAMMER))

# special options when using SoftDevice
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
export JLINK_PRE_FLASH := erase\nloadfile $(BINDIR)/softdevice.hex
export JLINK_PRE_FLASH := loadfile $(BINDIR)/softdevice.hex
export FLASH_ADDR := 0x1f000
export LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld
# murdock: softdevice.hex file is used for flashing
Expand Down
5 changes: 4 additions & 1 deletion pkg/nordic_softdevice_ble/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ prepare: $(PKG_SRCDIR)/.extracted
$(BINDIR)/ble_6lowpan.a: $(PKG_SRCDIR)/.extracted
cp $(PKG_SRCDIR)/$(BLE_6LOWPAN_LIB) $@

# softdevice.hex has the `[0x8bc, 0x3000[` addresses not set.
# However, it requires that the value at `0x2000` is 0xFFFFFFFF
# We just put all the undefined memory to 0xff as it is the rom reset value anyway.
$(BINDIR)/softdevice.hex: $(PKG_SRCDIR)/.extracted
cp $(PKG_SRCDIR)/$(SOFTDEVICE) $@
$(Q)$(OBJCOPY) $(OFLAGS) -Oihex --gap-fill 0xff $(PKG_SRCDIR)/$(SOFTDEVICE) $@

$(PKG_SRCDIR)/.extracted: $(PKG_BUILDDIR)/$(PKG_FILE)
rm -rf $(@D)
Expand Down

0 comments on commit f3e7200

Please sign in to comment.