AP_Networking: disable assert messages for production builds

The string description for the asserts was costing us a lot of flash
for not a lot of gain. By not displaying those strings in production
builds we save about 11k
This commit is contained in:
Andrew Tridgell
2025-11-26 19:06:56 +11:00
committed by Thomas Watson
parent b048354907
commit ec806af44f
2 changed files with 13 additions and 1 deletions

View File

@@ -470,10 +470,17 @@ const char *AP_Networking::address_to_str(uint32_t addr)
}
#ifdef LWIP_PLATFORM_ASSERT
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || defined(HAL_DEBUG_BUILD)
void ap_networking_platform_assert(const char *msg, int line)
{
AP_HAL::panic("LWIP: %s: %u", msg, line);
AP_HAL::panic("LWIP:%u %s", line, msg);
}
#else
void ap_networking_platform_assert(int line)
{
AP_HAL::panic("LWIP:%u", line);
}
#endif
#endif
#ifdef LWIP_HOOK_IP4_ROUTE

View File

@@ -400,8 +400,13 @@ void sys_check_core_locking(void);
#ifndef LWIP_PLATFORM_ASSERT
/* Define LWIP_PLATFORM_ASSERT to something to catch missing stdio.h includes */
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || defined(HAL_DEBUG_BUILD)
void ap_networking_platform_assert(const char *msg, int line);
#define LWIP_PLATFORM_ASSERT(x) ap_networking_platform_assert(x, __LINE__)
#else
void ap_networking_platform_assert(int line);
#define LWIP_PLATFORM_ASSERT(x) ap_networking_platform_assert(__LINE__)
#endif
#endif
/*