When I run my application from SRAM, initially
msg_ptr = (REC_MESSAGE_PTR) _msg_alloc(msg_pool); returns null but not continuous returning null. So the audio packet dropped intermittently and after some time it is allocating message. SO i will get proper audio playback after some time. failing of memory allocation is not constant in every debug cycle. some time it will fail to allocate msg say 400 time if I power cycle the tower board and run, some time it will be 16000 times if I continue load and debug without power cycle. it is not constant.
According to my scatter file
| #define DATA_BASE_ADDR_START | 0x3f040000 |
| |
| #define DATA_BASE_ADDR_END | 0x3f07fff0 |
KERNEL_DATA_START DATA_BASE_ADDR_START ALIGN 16
;KERNEL_DATA_START +0 ALIGN 16
{
* (KERNEL_DATA_START) ; start of kernel data
* (SRAM_POOL_START)
* (UNCACHED_DATA_START)
}
msg_pool = _msgpool_create(sizeof(REC_MESSAGE),8, 8, 0); create message pool in DATA_BASE_ADDR range. It always allocate message in system memory pool that is DATA_BASE_ADDR range. SO I thought my application not able to allocate memory in system memory pool. That is why audio is getting skipped. SO I tried to move KERNAL_DATA to a another region in gfx-SRAM
| #define RESERVED_BASE_ADDR_START | 0x3F400000 |
| #define RESERVED_BASE_ADDR_END | 0x3F47FFF0 |
| #define RESERVED_SIZE | (DATA_BASE_ADDR_END - DATA_BASE_ADDR_START) |
RESERVED_START RESERVED_BASE_ADDR_START ALIGN 16
{
* (KERNEL_DATA_START) ; start of kernel data
}
RESERVED_END RESERVED_BASE_ADDR_END
{
* (KERNEL_DATA_END) ; end of kernel data
}
But while bootup application hangs in rtcs_init();
In my main() function I am calling rtcs_init(); to initalize ethernet stack to use in my application. This hang is happening only when I moved KERNAL_DATA to gfxSRAM.
When I debugged I found out that control is going to dispatch_gic.S
This happening while rtcs_init calls RTCS_msgq_send_blocked(message, RTCS_data_ptr->TCPIP_msg_pool) function from RTCS_cmd_issue(); function
Any idea why rtcs_init hangs when I move KERNAL_DATA to gfxSRAM.
Below paste the snaps of the code which execute before rtcs_init call in my main function
_mmu_add_vregion((pointer) 0x3f400000, (pointer) 0x3f400000, (_mem_size) 0x0007ffff, PSP_PAGE_TABLE_SECTION_SIZE(PSP_PAGE_TABLE_SECTION_SIZE_1MB) | PSP_PAGE_TYPE(PSP_PAGE_TYPE_CACHE_WBNWA) | PSP_PAGE_DESCR(PSP_PAGE_DESCR_ACCESS_RW_ALL));
_mmu_venable();
_DCACHE_ENABLE();
_ICACHE_ENABLE();
_DCACHE_FLUSH();
/* Initialise RTCS */
rtcs_init();
//Below this other application code follows
BR?-
Nihad