127 lines
4.6 KiB
C
127 lines
4.6 KiB
C
#pragma once
|
|
#include <helpers/CompanionReaderConfig.h>
|
|
#include <helpers/ota/OtaMemoryPolicy.h>
|
|
|
|
// STM32WL has only 224 KiB of application flash. Keep its established image
|
|
// within that boundary; larger targets provide the programmable alert engine.
|
|
#ifndef COMPANION_FEATURE_NOTIFICATIONS
|
|
#if defined(STM32_PLATFORM)
|
|
#define COMPANION_FEATURE_NOTIFICATIONS 0
|
|
#else
|
|
#define COMPANION_FEATURE_NOTIFICATIONS 1
|
|
#endif
|
|
#endif
|
|
|
|
// The role terminal is also used by WebConfig on WiFi-only Companions. Its
|
|
// parser and reply tracking do not require a physical USB transport.
|
|
#if defined(ENABLE_USB_INTERFACE) \
|
|
|| (defined(ESP32_PLATFORM) && defined(WIFI_SSID) && !defined(WEBCONFIG_DISABLED))
|
|
#define COMPANION_FEATURE_TEXT_TERMINAL 1
|
|
#else
|
|
#define COMPANION_FEATURE_TEXT_TERMINAL 0
|
|
#endif
|
|
|
|
// Features are selected independently so adding a transport or changing an
|
|
// image-size profile cannot accidentally remove unrelated Companion behavior.
|
|
// Keep the legacy umbrella as a compatibility input for existing target files;
|
|
// application code must use the capability macros below.
|
|
#if defined(COMPANION_RADIO_FULL)
|
|
#ifndef COMPANION_FEATURE_TEMP_RADIO
|
|
#define COMPANION_FEATURE_TEMP_RADIO 1
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_OTA_CLI
|
|
#define COMPANION_FEATURE_OTA_CLI 1
|
|
#endif
|
|
#if defined(ESP32_PLATFORM)
|
|
#ifndef COMPANION_FEATURE_NETWORK_TERMINAL
|
|
#define COMPANION_FEATURE_NETWORK_TERMINAL 1
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_MEMORY_DIAGNOSTICS
|
|
#define COMPANION_FEATURE_MEMORY_DIAGNOSTICS 1
|
|
#endif
|
|
#endif
|
|
#if defined(MESH_DUAL_CDC_LOGGING)
|
|
#ifndef COMPANION_FEATURE_DEDICATED_USB_LOGGING
|
|
#define COMPANION_FEATURE_DEDICATED_USB_LOGGING 1
|
|
#endif
|
|
#endif
|
|
// A Full Companion cannot leave its line-oriented terminal active while the
|
|
// serial folder source exchanges binary request/reply frames on that same
|
|
// stream. Both nRF52 CDC and ESP32's inherited OTA_FOLDER_SERIAL transport
|
|
// therefore use the exclusive USB mOTA owner state in main.cpp.
|
|
#if defined(OTA_FOLDER_SERIAL) \
|
|
&& (defined(NRF52_PLATFORM) || defined(ESP32_PLATFORM))
|
|
#ifndef COMPANION_FEATURE_USB_MOTA_SOURCE
|
|
#define COMPANION_FEATURE_USB_MOTA_SOURCE 1
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef COMPANION_FEATURE_TEMP_RADIO
|
|
#define COMPANION_FEATURE_TEMP_RADIO 0
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_OTA_CLI
|
|
#define COMPANION_FEATURE_OTA_CLI 0
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_NETWORK_TERMINAL
|
|
#define COMPANION_FEATURE_NETWORK_TERMINAL 0
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_MEMORY_DIAGNOSTICS
|
|
#define COMPANION_FEATURE_MEMORY_DIAGNOSTICS 0
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_USB_MOTA_SOURCE
|
|
#define COMPANION_FEATURE_USB_MOTA_SOURCE 0
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_BLE_MOTA_SOURCE
|
|
#define COMPANION_FEATURE_BLE_MOTA_SOURCE 0
|
|
#endif
|
|
#ifndef COMPANION_FEATURE_DEDICATED_USB_LOGGING
|
|
#define COMPANION_FEATURE_DEDICATED_USB_LOGGING 0
|
|
#endif
|
|
|
|
#if COMPANION_FEATURE_OTA_CLI && !defined(ENABLE_OTA)
|
|
#error "COMPANION_FEATURE_OTA_CLI requires ENABLE_OTA"
|
|
#endif
|
|
|
|
#if COMPANION_FEATURE_NETWORK_TERMINAL && !defined(ENABLE_USB_INTERFACE)
|
|
#error "COMPANION_FEATURE_NETWORK_TERMINAL requires ENABLE_USB_INTERFACE"
|
|
#endif
|
|
|
|
#if COMPANION_FEATURE_NETWORK_TERMINAL \
|
|
&& !(defined(ESP32_PLATFORM) && defined(WIFI_SSID) \
|
|
&& defined(ENABLE_OTA))
|
|
#error "COMPANION_FEATURE_NETWORK_TERMINAL requires ESP32 WiFi and the OTA source overlay"
|
|
#endif
|
|
|
|
#if COMPANION_FEATURE_USB_MOTA_SOURCE \
|
|
&& !((defined(NRF52_PLATFORM) || defined(ESP32_PLATFORM)) \
|
|
&& defined(OTA_FOLDER_SERIAL) && defined(ENABLE_USB_INTERFACE) \
|
|
&& defined(ENABLE_OTA))
|
|
#error "COMPANION_FEATURE_USB_MOTA_SOURCE requires a USB serial folder source"
|
|
#endif
|
|
|
|
#if COMPANION_FEATURE_BLE_MOTA_SOURCE \
|
|
&& !(defined(COMPANION_RADIO_FULL) && defined(NRF52_PLATFORM) \
|
|
&& defined(BLE_PIN_CODE) && defined(ENABLE_OTA))
|
|
#error "COMPANION_FEATURE_BLE_MOTA_SOURCE requires an nRF52 Full Companion with BLE and OTA"
|
|
#endif
|
|
|
|
#if COMPANION_FEATURE_MEMORY_DIAGNOSTICS && !defined(ESP32_PLATFORM)
|
|
#error "COMPANION_FEATURE_MEMORY_DIAGNOSTICS requires ESP32"
|
|
#endif
|
|
|
|
#if COMPANION_FEATURE_DEDICATED_USB_LOGGING \
|
|
&& !(defined(MESH_DUAL_CDC_LOGGING) \
|
|
&& defined(ENABLE_USB_INTERFACE))
|
|
#error "COMPANION_FEATURE_DEDICATED_USB_LOGGING requires nRF52 dual-CDC USB"
|
|
#endif
|
|
|
|
#if defined(MESHCORE_REQUIRES_COMPANION_RADIO_FULL) \
|
|
&& !defined(COMPANION_RADIO_FULL)
|
|
#error "This target requires build.sh to apply the Full Companion profile"
|
|
#endif
|
|
|
|
#if defined(COMPANION_RADIO_FULL) && !defined(BLE_PIN_CODE)
|
|
#error "COMPANION_RADIO_FULL requires the Bluetooth Companion transport"
|
|
#endif
|