From 961357a44d70a3e724336e10e0a3de7e427bd9f6 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Sat, 5 Dec 2026 18:09:30 -0600 Subject: [PATCH] Build SITL with its flash size, and fail the build when a target has none common.h turns features on and off by MCU_FLASH_SIZE, but SITL never defined it. The preprocessor reads an undefined macro as 0, so SITL was built as a 512 KB board: no CLI help text, no 34 channels, no FFPV VTX, no SmartPort master. cmake now passes MCU_FLASH_SIZE=2048 for SITL, as it does for every hardware MCU, and common.h stops the build if a target has no MCU_FLASH_SIZE. With the flash size right, SITL gets USE_HOTT_TEXTMODE but not HoTT telemetry, which text mode is part of; HoTT text mode is now dropped for any target without HoTT telemetry. --- cmake/sitl.cmake | 1 + src/main/target/common.h | 5 +++++ src/main/target/common_post.h | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/cmake/sitl.cmake b/cmake/sitl.cmake index 1983175c8de..b5128e6d4a4 100644 --- a/cmake/sitl.cmake +++ b/cmake/sitl.cmake @@ -84,6 +84,7 @@ endif() set(SITL_DEFINITIONS SITL_BUILD + MCU_FLASH_SIZE=2048 ) function (target_sitl name) diff --git a/src/main/target/common.h b/src/main/target/common.h index 6990cfd4415..0b099822947 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -17,6 +17,11 @@ #pragma once +// The preprocessor reads an undefined MCU_FLASH_SIZE as 0, which would quietly build a target as a 512 KB board +#ifndef MCU_FLASH_SIZE +#error "MCU_FLASH_SIZE (KiB) must be defined by the MCU's cmake file" +#endif + #if defined(STM32F7) || defined(STM32H7) #define USE_ITCM_RAM #endif diff --git a/src/main/target/common_post.h b/src/main/target/common_post.h index ccd14d35a4a..3e9acd735e1 100644 --- a/src/main/target/common_post.h +++ b/src/main/target/common_post.h @@ -29,6 +29,11 @@ extern uint8_t __config_end; # undef USE_OLED_UG2864 #endif +// HoTT text mode is part of HoTT telemetry +#if !defined(USE_TELEMETRY_HOTT) +# undef USE_HOTT_TEXTMODE +#endif + // Make sure DEFAULT_I2C_BUS is valid #ifndef DEFAULT_I2C_BUS