[nrf52_base]
; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files
platform =
  # renovate: datasource=custom.pio depName=platformio/nordicnrf52 packageName=platformio/platform/nordicnrf52
  platformio/nordicnrf52@10.11.0
extends = arduino_base
platform_packages =
  ; our custom Git version with C++17 support in platform.txt
  # TODO renovate
  platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino#master
  ; Don't renovate toolchain-gccarmnoneeabi
  platformio/toolchain-gccarmnoneeabi@~1.90301.0

extra_scripts =
  ${env.extra_scripts}
  extra_scripts/nrf52_extra.py
  pre:extra_scripts/nrf52_lto.py

build_type = release
build_flags =
  -include variants/nrf52840/cpp_overrides/lfs_util.h
  ${arduino_base.build_flags}
  -Wno-unused-variable
  -Isrc/platform/nrf52
  -DLFS_NO_ASSERT                      ; Disable LFS assertions , see https://github.com/meshtastic/firmware/pull/3818
  -DMESHTASTIC_EXCLUDE_AUDIO=1
  -DMESHTASTIC_EXCLUDE_PAXCOUNTER=1
  -Os
  -std=gnu++17
  -flto                 ; whole-image LTO (~-60KB) on every nrf52840 target; nrf52_lto.py (pre: extra_script) keeps the interrupt handlers out of LTO so they survive
  -fmerge-all-constants ; fold identical constants image-wide (~0.7KB; same flag stm32 uses)
build_unflags =
  -Ofast
  -Og
  -ggdb3
  -ggdb2
  -g3
  -g2
  -g
  -g1
  -g0
  -std=c++11
  -std=gnu++11

build_src_filter = 
  ${arduino_base.build_src_filter} -<platform/esp32/> -<platform/nrf54l15/> -<platform/stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<platform/rp2xx0> -<mesh/eth/> -<mesh/raspihttp> -<serialization/>

lib_deps=
  ${arduino_base.lib_deps}
  ${radiolib_base.lib_deps}
  # renovate: datasource=github-tags depName=meshtastic/Crypto packageName=meshtastic/Crypto
  https://github.com/meshtastic/Crypto/archive/1aa30eb536bd52a576fde6dfa393bf7349cf102d.zip

lib_ignore =
  BluetoothOTA
  lvgl
