From 531058489f569e6791831c07cc0eca9233671560 Mon Sep 17 00:00:00 2001 From: geeksville Date: Fri, 10 Jul 2020 11:20:03 -0700 Subject: [PATCH 1/3] Fix to not incorrectly include TINYUSB on nrf52832 targets Rather than checking the name of the board check the name of the chip which allows this code to work properly on any nrf52832. This processor does not include a USB controller. --- adafruit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit.py b/adafruit.py index 3d5c7b5..350a1b8 100644 --- a/adafruit.py +++ b/adafruit.py @@ -217,7 +217,7 @@ usb_path = join(CORE_DIR, "TinyUSB") if isdir(usb_path): - if env.subst("$BOARD") != "adafruit_feather_nrf52832": + if board.get("build.mcu") != "nrf52832": env.Append( CPPDEFINES=[ "USBCON", From 9d11b9edbf8785c92717abf6ae803dfeb8c608f5 Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 7 Sep 2020 12:39:07 -0700 Subject: [PATCH 2/3] Update based on ardafruit nrf52 arduino platform.txt Fixes platformio builds --- adafruit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adafruit.py b/adafruit.py index 350a1b8..191a11a 100644 --- a/adafruit.py +++ b/adafruit.py @@ -105,6 +105,7 @@ CPPPATH=[ join(CORE_DIR, "cmsis", "include"), + join(CORE_DIR, "cmsis", "Core", "Include"), join(NORDIC_DIR), join(NORDIC_DIR, "nrfx"), join(NORDIC_DIR, "nrfx", "hal"), @@ -168,7 +169,9 @@ env.Append( CPPPATH=[ join(NORDIC_DIR, "softdevice", - "%s_nrf52_%s_API" % (softdevice_name, softdevice_version), "include") + "%s_nrf52_%s_API" % (softdevice_name, softdevice_version), "include"), + join(NORDIC_DIR, "softdevice", + "%s_nrf52_%s_API" % (softdevice_name, softdevice_version), "include", "nrf52") ], CPPDEFINES=[ softdevice_name.upper(), From 1cd8dca3269359670844100c676b9641867e465a Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 15 Apr 2021 11:32:46 +0800 Subject: [PATCH 3/3] Add crypto lib to nrf52840 builds --- adafruit.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/adafruit.py b/adafruit.py index 191a11a..71e9cf9 100644 --- a/adafruit.py +++ b/adafruit.py @@ -253,6 +253,22 @@ ] ) +# NRF52840 has a new crypto lib +crypto_path = join(FRAMEWORK_DIR, "libraries", "Adafruit_nRFCrypto", "src") +if isdir(crypto_path): + if board.get("build.mcu") == "nrf52840": + env.Append( + CPPPATH=[ + join(crypto_path), + ], + LIBPATH=[ + join(crypto_path, "cortex-m4", "fpv4-sp-d16-hard") + ], + LIBS=[ + join("nrf_cc310_0.9.13-no-interrupts") + ] + ) + cpp_flags = env.Flatten(env.get("CPPDEFINES", [])) if "CFG_DEBUG" not in cpp_flags: