* Changing U-boot relocation addres to SRAM (instead of DRAM)
@ 2020-09-07 19:24 Yusuf Altıparmak
2020-09-08 11:33 ` Joakim Tjernlund
0 siblings, 1 reply; 2+ messages in thread
From: Yusuf Altıparmak @ 2020-09-07 19:24 UTC (permalink / raw)
To: u-boot
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 at h /* Source Address */*
*ori r4,r4,CONFIG_SYS_MONITOR_BASE at 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 at h).
What should be done to change it to point SRAM of t1042 after we initialize
it in board_init_f() function. ?
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Changing U-boot relocation addres to SRAM (instead of DRAM)
2020-09-07 19:24 Changing U-boot relocation addres to SRAM (instead of DRAM) Yusuf Altıparmak
@ 2020-09-08 11:33 ` Joakim Tjernlund
0 siblings, 0 replies; 2+ messages in thread
From: Joakim Tjernlund @ 2020-09-08 11:33 UTC (permalink / raw)
To: u-boot
On Mon, 2020-09-07 at 22:24 +0300, Yusuf Alt?parmak wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>
> 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 at h /* Source Address */*
> *ori r4,r4,CONFIG_SYS_MONITOR_BASE at 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 at h).
>
> What should be done to change it to point SRAM of t1042 after we initialize
> it in board_init_f() function. ?
I don't think you should change anything here. Just make gd->relocaddr point to somewhere in SRAM
Jocke
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-08 11:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 19:24 Changing U-boot relocation addres to SRAM (instead of DRAM) Yusuf Altıparmak
2020-09-08 11:33 ` Joakim Tjernlund
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.