about Jump from Flash to RAM code in Colilo.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

about Jump from Flash to RAM code in Colilo.

1,464 Views
Jiandong
Contributor I
HI Freescale,
 
the following  code is  in boot.S in Colilo. and I am confused with the Jump.
 
#ifdef CONFIG_COLILO_SOLO
 move.l #0xFF800000, %a0 /* Colilo's in Boot flash */
#else
 move.l #0xE0000000, %a0 /* Colilo's in Code flash */
#endif
 move.l #0x1000000, %a1  /* RAM destination address */
 move.l #0x7FFC, %d0  /* 32K long = 128 Kb */
loop_copy:
 move.l %a0@+,%d1
 move.l %d1,%a1@+
 subq.l #1,%d0
 bne.s loop_copy
 
 move.l #real_start,%a0
 jmp (%a0) /* Jump to colilo start address in RAM */   What this mean?? I think the #real_start is still in Flash. So didn't jump to the RAM.
#endif
 /*
 * Disable the cache. Don't want it on just yet.
 */
real_start: 
 jsr disableCache
 
 jsr  mcf548x_init
 move.l #__SP_INIT, %SP
 /*
 * Most of the setup work is done in main().
 */
 jsr start_main
Labels (1)
0 Kudos
2 Replies

308 Views
Jiandong
Contributor I
After remap and code copying  , the RAM remap to Flash address at 0x00000000, So #real_start is in Ram after.
0 Kudos

308 Views
CompilerGuru
NXP Employee
NXP Employee
I dont know Colilo, but looking at the code it does make sence if
the labels are evaluated by the linker to RAM addresses.
Then the code before the JMP is assembled to a different address than it is executed from. The code starts out of flash, copies itself to RAM, and once this is done, it jumps there.
Can you decode/disassemble it and check to what #real_start actually evaluates, to a RAM or to a FLASH address?

Daniel
0 Kudos