You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I'm surprised you hit issues with --overlap=replace - my understanding was that's only really needed if the hex files overlap - and if they're overlapping generally that's probably going to cause you some problems as something is too big?

    On the debug front, it's a nightmare with nRF52 because the softdevice tries to restart if it realises the CPU is halted for much time. There is a wdt_off GDB macro at https://github.com/espruino/Espruino/blob/master/.gdbinit#L31-L33 that you can call the very first time you break execution after the softdevice is started and I believe that will stop the reboot, but bluetooth connections will still completely break as soon as you start breakpointing stuff.

  • There is a wdt_off GDB macro at https://github.com/espruino/Espruino/blo­b/master/.gdbinit#L31-L33 that you can call the very first time you break execution after the softdevice is started

    Well that is useful if one has watchdog started but is not so much related to softdevice
    https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/wdt.html?cp=5_2_0_39_3_6#register.CONFIG - there is a bit that pauses watchdog when being debugged. EDIT: however I am not sure what writing value 1 done by wdt_off there can fix, from description clearing both bits 0 and 3 could help?

    Found the PRIMASK stuff, discussed here https://devzone.nordicsemi.com/f/nordic-q-a/477/can-i-debug-ble-program/2498 with some gdb hooks EDIT: oh i see now that it is already there in .gdbinit

  • I'm surprised you hit issues with --overlap=replace

    overlap=METHOD
    What to do when data in files overlapped.
    replace -- use data from last file that contains data at overlapped address

    That does sound very bad :/

    I should probably look into that.

  • Ok so i don't think i'm running into a "error" --overlap. It seems like it part of the build script?

    So there seems to be two types of defines

    • BOOTLOADER
    • USE_BOOTLOADER

    And in my python board file i have 'bootloader' : 1. This one is sets USE_BOOTLOADER to true.

    As for BOOTLOADER

    • BOOTLOADER=1 make the bootloader (not Espruino)

    link to code

    $(PROJ_NAME).hex: $(PROJ_NAME).app_hex
     ifdef USE_BOOTLOADER
      ifdef BOOTLOADER
    	@echo Bootloader - leaving hex file as-is
    	@mv $(PROJ_NAME).app_hex $(PROJ_NAME).hex
    	# for testing:
    	[#python](https://forum.espruino.com/search/?q=%23python) scripts/hexmerge.py --overlap=replace $(SOFTDEVICE) $(PROJ_NAME).app_hex -o $(PROJ_NAME).hex
      else
    	@echo Merging SoftDevice and Bootloader
    	@# build a DFU settings file we can merge in... family can be NRF52840 or NRF52
    	nrfutil settings generate --family $(BOOTLOADER_SETTINGS_FAMILY) --application $(PROJ_NAME).app_hex --app-boot-validation VALIDATE_GENERATED_CRC --application-version 0xff --bootloader-version 0xff --bl-settings-version 2 $(OBJDIR)/dfu_settings.hex
    	@echo FIXME - had to set --overlap=replace
    	python scripts/hexmerge.py --overlap=replace $(SOFTDEVICE) $(NRF_BOOTLOADER) $(PROJ_NAME).app_hex $(OBJDIR)/dfu_settings.hex -o $(PROJ_NAME).hex
      endif
     else
    	@echo Merging SoftDevice
    	python scripts/hexmerge.py $(SOFTDEVICE) $(PROJ_NAME).app_hex -o $(PROJ_NAME).hex
     endif # USE_BOOTLOADER
    

    ```

About

Avatar for Gordon @Gordon started