We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi again
I am still struggling with debugging my code in DDR3 memory using the Keil uLink2. I have created a .ini file for the uLink2 to execute which initializes the DDR3 for use, load my code to DDR3, and attempts to change the pc and sp to that memory. The last thing is not working. the code definitely is in the DDR3 memory OK. Below is the the script function.
The code was linked to 0xA0000000
This is a microsemi cortex m3 FPGA arm.
Can anyone see a reason why this would not work? or why the uLink2 jumps away to undefined memory space? I assume people have debugged out of external RAM before
Thanks :-)
FUNC void SetupPC_SP (void) { // Stack pointer and vector table offset // registers are set to 0x00000000 // Setup Stack Pointer SP = _RDWORD(0xA0000000); // Setup Stack Pointer // Program Counter is set to (0x00000004 -1) PC = _RDWORD(0xA0000004-1); // Setup Program Counter // change vector table address to 0 _WDWORD(0xE000ED08, 0x0); // 0xE000ED08 SCB->VTOR = readonly_region_base; }
Hi
I have finally gotten to the point in my bootloader where I have loaded my code into the DDR from external Flash and need to remap and jump to the start address. Pre the Microsemi cortex M3 ARM app notes this is the order that the registers are to be set BUT once the remapping happens the two instructions to load the SP and PC registers cannot be executed because the memory is no longer there to fetch them. Its DDR.
Has anyone does this successfully somehow?
__asm void BootJump(INT32U firmwareStartAddress) { MOVS R1, #0x0 STR R1, [R0,#0x0] ; SYSREG->ESRAM_CR = 0u STR R1, [R0,#0x10] ; SYSREG->ENVM_REMAP_BASE_CR = 0u MOVS R2, #0x01 ; SYSREG->DDR_CR = 1u STR R2, [R0,#0x08] ; Remap DDR to address 0 LDR SP, [R1] ;Load new stack pointer address LDR PC, [R1, #4] ;Load new program counter address } void Jump_to_executable(void) { SCB->VTOR = 0x00000000; BootJump((INT32U)0x40038000); }
So is the boot loader in SRAM? Is it accessible from a shadow/normal address (0x20000000 ?) and is that currently mapped at ZERO? If it's at zero then you'd probably want to transfer control to the higher address code before you remap the memory underneath yourself.