[libretiny] Trim the LN882x zero-size allocation comments

This commit is contained in:
J. Nick Koston
2026-10-04 18:50:42 -05:00
parent e2bae54644
commit 372f13ccce
2 changed files with 6 additions and 16 deletions
+1 -3
View File
@@ -491,9 +491,7 @@ async def component_to_code(config):
# Not enabled on RTL87xx/LN882x — costs more heap than it saves there.
cg.add_build_flag("-DconfigSUPPORT_STATIC_ALLOCATION=1")
# LN882x: route FreeRTOS allocations through ln882x_zero_malloc.c, which
# turns a zero-size request into one byte so it cannot trip the SDK's
# malloc-failed hook (an LN_ASSERT spin until the watchdog resets).
# LN882x: a zero-size allocation must not trip the SDK's assert (see ln882x_zero_malloc.c).
if config[CONF_COMPONENT_ID] == COMPONENT_LN882X:
cg.add_build_flag("-Wl,--wrap=pvPortMalloc")
@@ -1,17 +1,9 @@
/*
* LN882x: never ask the FreeRTOS heap for zero bytes.
*
* The LN882H SDK builds FreeRTOS with configUSE_MALLOC_FAILED_HOOK, and its
* hook (components/kernel/FreeRTOS/hooks.c) ends in LN_ASSERT(0), which spins
* until the watchdog resets the chip. heap_5 returns NULL for a zero-size
* request, so a harmless malloc(0) runs that hook. LibreTiny's scan handler
* makes exactly that request when a scan finds no networks, which is what
* happens right after an access point drops the device: the chip hangs and
* resets about ten seconds later.
*
* Linked with -Wl,--wrap=pvPortMalloc for LN882x only, so every caller,
* LibreTiny's malloc wrappers included, goes through here. Drop this once
* LibreTiny stops allocating zero entries in its LN882H scan handler.
* LN882x: heap_5 returns NULL for a zero-size request, and the SDK's
* malloc-failed hook ends in LN_ASSERT(0), which spins until the watchdog
* resets the chip. LibreTiny's scan handler asks for zero entries when a scan
* finds no networks. Linked with -Wl,--wrap=pvPortMalloc so every allocation
* comes through here; drop it once LibreTiny no longer allocates zero entries.
*/
#ifdef USE_LN882X