Hello,
Thank you for your response.
Ok, but your RAM is after power on reset/destructive full of ECC errors. So you have to initialize it.
It just wont keep the data if the power is lost. This is the reason for entering the IVOR when you access un-initialized RAM.
I have modified the startup script to initialize my no init but only in the case of destructive reset as I don't want it to clear the memory when jumping between apps as I have stated before the jumping is done by jumping to the value inside cpu0 reset vector
;# Fill SRAM with writes of 32GPRs
sram_loop:
e_stmw r0, 0(r5) ;# Write all 32 registers to SRAM
e_addi r5, r5, 128 ;# Increment the RAM pointer to next 128bytes
e_bdnz sram_loop ;# Loop for all of SRAM
.equ MC_RGM_DES, 0xFFFA8000 /* Destructive Event Status Register */
.equ MC_RGM_POR_MSK, 0x00000001 /* POR flag is bit 0 */
e_lis r3, MC_RGM_DES@h
e_or2i r3, MC_RGM_DES@l
e_li r4,0
e_lwz r4, 0(r3)
/* if POR==0 (warm), skip over the entire clear */
e_li r6, 1
and. r4, r4, r6
e_beq skip_clear;
/* zero the 256 B noinit bank in two 128 B bursts */
e_lis r5, __noinit_start__@h
e_or2i r5, __noinit_start__@l
e_li r6, 2
mtctr r6
e_li r0,0
e_li r3,0
e_li r4,0
e_li r6,0
clear_noinit_ecc:
e_stmw r0, 0(r5) ; #write registers R0–R31 128 bytes of zero
e_stw r0, 20(r5)
e_addi r5, r5, 128 ; #advance pointer by 128
e_bdnz clear_noinit_ecc ; #loop until CTR==0
skip_clear:
e_li r5,0
Is this conceptually correct to just initialize it here or must I also reinitialize it in that function of the startup.c?
/*FUNCTION**********************************************************************
*
* Function Name : init_data_bss
* Description : Make necessary initializations for RAM.
* - Copy the vector table from ROM to RAM.
* - Copy initialized data from ROM to RAM.
* - Copy code that should reside in RAM from ROM
* - Clear the zero-initialized data section.
*
* Tool Chains:
* __GNUC__ : GNU Compiler Collection
* __ghs__ : Green Hills ARM Compiler
* __ICCARM__ : IAR ARM Compiler
* __DCC__ : Wind River Diab Compiler
* __ARMCC_VERSION : ARMC Compiler
*
* Implements : init_data_bss_Activity
*END**************************************************************************/
void init_data_bss(void)
Best Regards,
Ahmed