adafruit / Adafruit_nRF52_Bootloader

USB-enabled bootloaders for the nRF52 BLE SoC chips
MIT License
445 stars 401 forks source link

Add dualstack softdevice support #151

Open huddy987 opened 4 years ago

huddy987 commented 4 years ago

Due to licensing, add a compile switch for creating dualstack softdevice builds. Anyone who wishes to build the dualstack-supported bootloader MUST obtain their own copy of the softdevice from thisisant.com. For evaluation purposes this is free, but anyone who wishes to use the dualstack softdevice commerically must purchase an ANT license.

These builds should be cross-compatible within dualstack softdevices, as long as they are compiled against the dualstack headers (i.e. if the bootloader is built against the s340 headers, the user SHOULD be able to load any s3xx series softdevice and maintain all bootloader functionality).

Single ANT stack support is not added. I was able to disable OTA DFU, but was not able to properly re-enable seiral DFU. This is something I can look at in the future if anyone files an issue requesting it.

Verifed with S140 and S340 v6.1.1 that I am able to:

  1. Jump to app
  2. Enter serial DFU mode
  3. Enter OTA DFU mode and connect via nRF connect

One note on this: If it wasn't for the licensing issue we could have made this a runtime check, but defining ANT_LICENSE_KEY is not allowed by us (the user must download the softdevice and define that themselves in the correct API file).

huddy987 commented 4 years ago

Build is failing because of https://github.com/adafruit/Adafruit_nRF52_Bootloader/pull/149 (the build no longer attempts to create the _build directory). Either that commit needs to be reverted or updated.

hathach commented 4 years ago

as said in #146 , Softdevice is not part of bootloader anymore. There is no need to build and merged with SD, you just flashed it with jlink or uf2. Unless there is anything else I am not aware of, this PR is not likely to got merged.

huddy987 commented 4 years ago

@hathach sd_softdevice_enable will fault on S3xx builds if you do not include the ANT_LICENSE_KEY argument. It does not matter if it is or is not a part of the bootloader, you need to build against the correct softdevice headers to get proper bootloader functionality on S3xx softdevices.

Without this change OTA DFU will not be functional with dualstack softdevices.

That call jumps into softdevice, so technically, no you can't just upload any softdevice you want. The APIs are different for dualstack softdevices. It might work ok for serial, but as soon as you try to do OTA DFU, you will have major issues.

Its the same API name, but the implementations are different...

huddy987 commented 4 years ago

Agreed. I will update the PR to allow users to enter an SD name.

huddy987 commented 4 years ago

With this change it should be pretty easy to add new softdevices. We just need to add a new "else ifeq" for the new softdevice then add another "else ifeq" for the SoCs that support the new softdevice.