@@ -5024,21 +5024,23 @@ void k_heap_free(struct k_heap *h, void *mem);
50245024#define Z_HEAP_MIN_SIZE (sizeof(void *) > 4 ? 56 : 44)
50255025
50265026/**
5027- * @brief Define a static k_heap
5027+ * @brief Define a static k_heap in the specified linker section
50285028 *
50295029 * This macro defines and initializes a static memory region and
5030- * k_heap of the requested size. After kernel start, &name can be
5031- * used as if k_heap_init() had been called.
5030+ * k_heap of the requested size in the specified linker section.
5031+ * After kernel start, &name can be used as if k_heap_init() had
5032+ * been called.
50325033 *
50335034 * Note that this macro enforces a minimum size on the memory region
50345035 * to accommodate metadata requirements. Very small heaps will be
50355036 * padded to fit.
50365037 *
50375038 * @param name Symbol name for the struct k_heap object
50385039 * @param bytes Size of memory region, in bytes
5040+ * @param in_section __attribute__((section(name))
50395041 */
5040- #define K_HEAP_DEFINE (name , bytes ) \
5041- char __noinit_named(kheap_buf_##name) \
5042+ #define Z_HEAP_DEFINE_IN_SECT (name , bytes , in_section ) \
5043+ char in_section \
50425044 __aligned(8) /* CHUNK_UNIT */ \
50435045 kheap_ ##name[MAX(bytes, Z_HEAP_MIN_SIZE)]; \
50445046 STRUCT_SECTION_ITERABLE(k_heap, name) = { \
@@ -5048,6 +5050,41 @@ void k_heap_free(struct k_heap *h, void *mem);
50485050 }, \
50495051 }
50505052
5053+ /**
5054+ * @brief Define a static k_heap
5055+ *
5056+ * This macro defines and initializes a static memory region and
5057+ * k_heap of the requested size. After kernel start, &name can be
5058+ * used as if k_heap_init() had been called.
5059+ *
5060+ * Note that this macro enforces a minimum size on the memory region
5061+ * to accommodate metadata requirements. Very small heaps will be
5062+ * padded to fit.
5063+ *
5064+ * @param name Symbol name for the struct k_heap object
5065+ * @param bytes Size of memory region, in bytes
5066+ */
5067+ #define K_HEAP_DEFINE (name , bytes ) \
5068+ Z_HEAP_DEFINE_IN_SECT(name, bytes, \
5069+ __noinit_named(kheap_buf_##name))
5070+
5071+ /**
5072+ * @brief Define a static k_heap in uncached memory
5073+ *
5074+ * This macro defines and initializes a static memory region and
5075+ * k_heap of the requested size in uncache memory. After kernel
5076+ * start, &name can be used as if k_heap_init() had been called.
5077+ *
5078+ * Note that this macro enforces a minimum size on the memory region
5079+ * to accommodate metadata requirements. Very small heaps will be
5080+ * padded to fit.
5081+ *
5082+ * @param name Symbol name for the struct k_heap object
5083+ * @param bytes Size of memory region, in bytes
5084+ */
5085+ #define K_HEAP_DEFINE_NOCACHE (name , bytes ) \
5086+ Z_HEAP_DEFINE_IN_SECT(name, bytes, __nocache)
5087+
50515088/**
50525089 * @}
50535090 */
0 commit comments