commit 61dbffa3c201678f47969826cdda3e48f07e1f9b Author: Yihao.Che Date: Mon Dec 23 15:13:35 2024 +0800 for patch shared Change-Id: If25289663e180f1062e3cd2ea1c9cbf378eb2db6 diff --git a/psdkra/app_utils/utils/mem/src/app_mem_free_rtos.c b/psdkra/app_utils/utils/mem/src/app_mem_free_rtos.c index 3e26896b7..53966e627 100755 --- a/psdkra/app_utils/utils/mem/src/app_mem_free_rtos.c +++ b/psdkra/app_utils/utils/mem/src/app_mem_free_rtos.c @@ -189,7 +189,7 @@ int32_t appMemInit(app_mem_init_prm_t *prm) { g_app_mem_obj.target2SharedFxn = NULL; } -#endif +#endif for(heap_id = 0; heap_id < APP_MEM_HEAP_MAX; heap_id++) { @@ -251,7 +251,10 @@ int32_t appMemInit(app_mem_init_prm_t *prm) heap_prm->base = heap_buf; heap_prm->size = heap_size; - HeapP_construct(&heap_obj->rtos_heap_handle, heap_buf, heap_size); + + appLogPrintf("%s: %d: MEM: Init22-1 ... !!! heap_buf: %p, heap_size: 0x%x\n", __func__, __LINE__, heap_buf, heap_size); + HeapP_construct(&heap_obj->rtos_heap_handle, heap_buf, heap_size, &size1, &size2); + appLogPrintf("%s: %d: MEM: Init33 ... !!! heap_buf: %p, heap_size: 0x%x, size1: %d < size2: %d ?\n", __func__, __LINE__, heap_buf, heap_size, size1, size2); #endif appLogPrintf("MEM: Created heap (%s, id=%d, flags=0x%08x) @ %p of size %d bytes !!!\n", heap_prm->name, @@ -599,7 +602,7 @@ void appMemCacheInv(void *ptr, uint32_t size) CacheP_inv( ptr, APP_MEM_ALIGN32(size, APP_MEM_ALIGN_MIN_BYTES), - CacheP_TYPE_L1D); + CacheP_TYPE_L1D); #endif #endif appMemFence(); @@ -850,7 +853,7 @@ int32_t appMemAddrTranslate(app_mem_rat_prm_t *prm) HwiP_restore(key); } #ifdef LDRA_UNTESTABLE_CODE -/* TIOVX-1770- LDRA Uncovered Id: TIOVX_CODE_COVERAGE_MEM_FREE_RTOS_UM09 */ +/* TIOVX-1770- LDRA Uncovered Id: TIOVX_CODE_COVERAGE_MEM_FREE_RTOS_UM09 */ else { appLogPrintf("appMemAddrTranslate(): pRatRegs has not been set. Use appMemSetRatRegs function to set before calling\n"); diff --git a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/examples/kernel/dpl/dpl_demo/dpl_demo.c b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/examples/kernel/dpl/dpl_demo/dpl_demo.c index 1756df157..65a1f10a5 100755 --- a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/examples/kernel/dpl/dpl_demo/dpl_demo.c +++ b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/examples/kernel/dpl/dpl_demo/dpl_demo.c @@ -134,9 +134,10 @@ void dpl_demo_main(void *args) { void *ptr1; uint32_t size1 = 1023u; + size_t size2 = 0, size3 = 0; /* create heap */ - HeapP_construct(&gMyHeapObj, gMyHeapMem, MY_HEAP_MEM_SIZE); + HeapP_construct(&gMyHeapObj, gMyHeapMem, MY_HEAP_MEM_SIZE, &size2, &size3); DebugP_log("[DPL] Heap free size = %d bytes\r\n", (uint32_t)HeapP_getFreeHeapSize(&gMyHeapObj) diff --git a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/dpl/HeapP.h b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/dpl/HeapP.h index a3cdb298a..f2d2c3cee 100755 --- a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/dpl/HeapP.h +++ b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/dpl/HeapP.h @@ -90,7 +90,7 @@ typedef struct HeapP_Object_ { * \param heapAddr [in] Base address of memory to be used as heap * \param heapSize [in] Size of memory block that is to be used as heap */ -void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize ); +void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize, size_t *size1, size_t *size2); /** * \brief Delete the user defined heap diff --git a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/freertos/dpl/common/HeapP_freertos.c b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/freertos/dpl/common/HeapP_freertos.c index 8016c2879..921716328 100755 --- a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/freertos/dpl/common/HeapP_freertos.c +++ b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/freertos/dpl/common/HeapP_freertos.c @@ -29,21 +29,21 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - #include #include #include #include #include -void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize ) +void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize, size_t *size1, size_t *size2) { - DebugP_assert( sizeof(StaticHeap_t) < sizeof(HeapP_Object) ); - + DebugP_assert( sizeof(StaticHeap_t) < sizeof(HeapP_Object) ); + *size1 = sizeof(StaticHeap_t); + *size2 = sizeof(HeapP_Object); vHeapCreateStatic((StaticHeap_t*)heap, heapAddr, heapSize); } + void HeapP_destruct(HeapP_Object *heap) { vTaskSuspendAll(); diff --git a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/nortos/dpl/common/HeapP_nortos.c b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/nortos/dpl/common/HeapP_nortos.c index 42afaf050..9e377cf78 100755 --- a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/nortos/dpl/common/HeapP_nortos.c +++ b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/nortos/dpl/common/HeapP_nortos.c @@ -35,10 +35,11 @@ #include #include -void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize ) +void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize, size_t *size1, size_t *size2) { - DebugP_assert( sizeof(StaticHeap_t) < sizeof(HeapP_Object) ); - + //DebugP_assert( sizeof(StaticHeap_t) < sizeof(HeapP_Object) ); + *size1 = sizeof(StaticHeap_t); + *size2 = sizeof(HeapP_Object); vHeapCreateStatic((StaticHeap_t*)heap, heapAddr, heapSize); } diff --git a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/safertos/dpl/common/HeapP_safertos.c b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/safertos/dpl/common/HeapP_safertos.c index 41d8eaf0c..035f2eaaa 100644 --- a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/safertos/dpl/common/HeapP_safertos.c +++ b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/source/kernel/safertos/dpl/common/HeapP_safertos.c @@ -37,13 +37,15 @@ #include #include -void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize ) +void HeapP_construct( HeapP_Object *heap, void *heapAddr, size_t heapSize, size_t *size1, size_t *size2) { - DebugP_assert( sizeof(StaticHeap_t) < sizeof(HeapP_Object) ); - + //DebugP_assert( sizeof(StaticHeap_t) < sizeof(HeapP_Object) ); + *size1 = sizeof(StaticHeap_t); + *size2 = sizeof(HeapP_Object); vHeapCreateStatic((StaticHeap_t*)heap, heapAddr, heapSize); } + void HeapP_destruct(HeapP_Object *heap) { vTaskSuspendScheduler(); diff --git a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/test/kernel/dpl/test_dpl.c b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/test/kernel/dpl/test_dpl.c index 4e840a7bf..985c7ac39 100755 --- a/psdkra/mcu_plus_sdk_j722s_10_00_00_25/test/kernel/dpl/test_dpl.c +++ b/psdkra/mcu_plus_sdk_j722s_10_00_00_25/test/kernel/dpl/test_dpl.c @@ -545,9 +545,10 @@ void test_heap(void *args) uint32_t size[NUM_ALLOCS] = {255, 232, 255, 127, 63, 31, 15, 7, 3, 1}; uint32_t freeSize; int32_t i; + size_t size1 = 0, size2 = 0; /* create heap */ - HeapP_construct(&gMyHeap, gMyHeapMem, MY_HEAP_MEM_SIZE); + HeapP_construct(&gMyHeap, gMyHeapMem, MY_HEAP_MEM_SIZE, &size1, &size2); freeSize = HeapP_getFreeHeapSize(&gMyHeap);