Hello,

I want to modify U-boot to relocate itself to on-board SRAM of chip (T1042
demo board) instead of DRAM.

At first, there is call list in u-boot/common/board_f.c and it has a line
to call dram_init. I will change this line with my custom sram_init
function.

[image: Capture.PNG]

The function board_f() is being called in start.S which is located at
u-boot/arch/powerpc/cpu/mpc85xx/

start.S file also includes a region to relocate itself by changing Link
Register. Code region is:

*/**
** void relocate_code(addr_sp, gd, addr_moni)*
***
** This "function" does not return, instead it continues in RAM*
** after relocating the monitor code.*
***
** r3 = dest*
** r4 = src*
** r5 = length in bytes*
** r6 = cachelinesize*
**/*
*.globl relocate_code*
*relocate_code:*
*mr r1,r3 /* Set new stack pointer */*
*mr r9,r4 /* Save copy of Init Data pointer */*
*mr r10,r5 /* Save copy of Destination Address */*

*GET_GOT*
*#ifndef CONFIG_SPL_SKIP_RELOCATE*
*mr r3,r5 /* Destination Address */*
*lis r4,CONFIG_SYS_MONITOR_BASE@h /* Source Address */*
*ori r4,r4,CONFIG_SYS_MONITOR_BASE@l*
*lwz r5,GOT(__init_end)*
*sub r5,r5,r4*
*li r6,CONFIG_SYS_CACHELINE_SIZE /* Cache Line Size */*


My question is, in above code, how relocate_code() function is calculating
the jump address of Link Register (CONFIG_SYS_MONITOR_BASE@h).

What should be done to change it to point SRAM of t1042 after we initialize
it in board_init_f() function. ?

Thanks.

Reply via email to