From e6e56ceb51c385530194bc25a93ecf4c33ada433 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 4 Jan 2026 14:21:43 +0000 Subject: [PATCH] firmware: make lc_open_from_mem() optional Define HAVE_LC_OPEN_FROM_MEM if the target implements lc_open_from_mem(). Make HAVE_CODEC_BUFFERING depend on this feature. Change-Id: If5f70db58963dcdc33848b860c028841ac380ab2 --- firmware/export/config.h | 6 +++++- firmware/export/lc-dlopen.h | 11 ----------- firmware/export/lc-rock.h | 2 ++ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/firmware/export/config.h b/firmware/export/config.h index 65bf9c164f..f9a2ca26ea 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -689,8 +689,12 @@ Lyre prototype 1 */ # endif #endif +#if CONFIG_BINFMT == BINFMT_ROCK +# define HAVE_LC_OPEN_FROM_MEM +#endif + /* Codec buffering requires the ability to load code from RAM */ -#if CONFIG_PLATFORM & PLATFORM_NATIVE +#if defined(HAVE_LC_OPEN_FROM_MEM) # define HAVE_CODEC_BUFFERING #endif diff --git a/firmware/export/lc-dlopen.h b/firmware/export/lc-dlopen.h index c92ffce4ce..ef3b88d2a0 100644 --- a/firmware/export/lc-dlopen.h +++ b/firmware/export/lc-dlopen.h @@ -27,15 +27,4 @@ void *lc_open(const char *filename, unsigned char *buf, size_t buf_size); void *lc_get_header(void *handle); void lc_close(void *handle); -#ifdef APPLICATION -/* App doesn't simulate code loading from a buffer */ -static inline void * lc_open_from_mem(void *addr, size_t blob_size) -{ - return NULL; - (void)addr; (void)blob_size; -} -#else -void *lc_open_from_mem(void* addr, size_t blob_size); -#endif - #endif /* __LC_DLOPEN_H__ */ diff --git a/firmware/export/lc-rock.h b/firmware/export/lc-rock.h index bd4101cb03..43fd815f3a 100644 --- a/firmware/export/lc-rock.h +++ b/firmware/export/lc-rock.h @@ -25,6 +25,7 @@ void *lc_open(const char *filename, unsigned char *buf, size_t buf_size); +#if defined(HAVE_LC_OPEN_FROM_MEM) /* header is always at the beginning of the blob, and handle actually points * to the start of the blob (the header is there) */ static inline void *lc_open_from_mem(void* addr, size_t blob_size) @@ -34,6 +35,7 @@ static inline void *lc_open_from_mem(void* addr, size_t blob_size) commit_discard_idcache(); return addr; } +#endif /* HAVE_LC_OPEN_FROM_MEM */ static inline void *lc_get_header(void *handle) {