Hi,
I am using MT48LC4M32B2P-128MBit ram on the board. It is interfaced with 32bit databus. I am able to write and read from the ram, hence I am sure the initialisation is proper.
When I use internal ram with heap
4.c my code runs perfectly fine, but when I use heap5.c to use the external ram as heap, I get a hardfault. I did step by step debugging and found that whenever there is a xTaskCreate or xQueueCreate call, there is some activity in the Ram, I can see it in the memory window, I am assuming there is no problem in creation of Queues and Task. On further stepping through I found that the code goes to hard fault at the svc 0 instruction in prvStartFirstTask.
I am initialising the heap as below and then calling the function in main before any calls to RTOS functions.
static void prvInitialiseHeap( void )
{
const HeapRegion_t xHeapRegions[] =
{
{(uint8_t*)0x28000000UL,0x20000},
{ NULL, 0 }
};
vPortDefineHeapRegions( xHeapRegions );
}
Hardfault come here
__asm void prvStartFirstTask( void )
{
PRESERVE8
/* Use the NVIC offset register to locate the stack. */
ldr r0, =0xE000ED08
ldr r0, [r0]
ldr r0, [r0]
/* Set the msp back to the start of the stack. */
msr msp, r0
/* Globally enable interrupts. */
cpsie i
cpsie f
dsb
isb
/* Call SVC to start the first task. */
svc 0 <--------<--------<-------<-------<--------<
nop
nop
}
Can anybody help regarding the issue? Thanks.