Relocating to my code.
hi everyone,
I am working on a card based on PPC440EP, I am porting u-boot on this card. As I understand, the PPC initially boots from the flash and then relocates itself to RAM address where there is board_init_r() and main_loop() is called.
I have an application code that simply does a loop back on UART channel2. After all the initialization,
I want to knock off the relocation code, board_init_r() and main_loop() execution in u-boot and relocate it to my application
The application code will residing in flash. How can I do this.... anyone kindly help me in this regard...........
Regards,
Prathika R
Hi Prathika,
Quoted 5 lines
hi everyone,
I am working on a card based on PPC440EP, I am porting u-boot on this card. As I understand, the PPC initially boots from the flash and then relocates itself to RAM address where there isboard_init_r()andmain_loop()is called.
Correct. Running from flash makes writing to flash (i.e. updating images there) somewhat complicated.
Quoted 6 lines
I have an application code that simply does a loop back on UART channel2. After all the initialization,
I want to knock off the relocation code,board_init_r()andmain_loop()execution in u-boot and relocate it to my application
The application code will residing in flash. How can I do this.... anyone kindly help me in this regard...........
Why do you want to run from flash - what exactly are you trying to do? Did you think about the consequences, i.e. where will your code store local variables, etc.?
Why do you want to use U-Boot in the first place if you do not want to use its main functionality?
Cheers
Detlev
Signature · 8 lines
The mathematician's patterns, like the painter's or the poet's, must be beautiful; the ideas, like the colours or the words, must fit together in a harmonious way. Beauty is the first test: there is no permanent place in the world for ugly mathematics. -- G. H. Hardy -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
Hi Prathika,
Quoted 2 lines
I did not mean it should run from flash itself..My application will just reside in flash, I will read back from flash to a RAM location.
To be honest, I have trouble understanding this.
Quoted 5 lines
As I understand, in
board_init_f(), after calling theinit_sequence,relocate_code()is called and it is a must to callrelocate_code(), from where it branches tomain_loop(). My aim is to branch to my application code before calling relocate_code().My application code's executable address is0x40004.
Well, if you are working on a PowerPC platform, then 0x40004 is certainly a RAM address.
Quoted 2 lines
Is it that i can just give jump to
0x40004before callingrelocate_code()and it works?
I still don't get why you want to change *anything* inside U-Boot. Why not just use the commands that are available in the command line interpreter? Say you have your application stored at fc2e0000 (arbitrary address) and it is 64k in size. Then why not just do:
cp.b fc2e0000 40000 10000;go 40004
Setting bootenv to these commands will start your application on U-Boot timeout. Sticking them into preboot even runs them before the command line is started at all.
Cheers
Detlev
Signature · 7 lines
Those who do not understand Unix are condemned to reinvent it, poorly. - Henry Spencer, University of Toronto Unix hack -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
Quoted 30 lines · Detlev Zundel
Hi Prathika,
Quoted 3 lines
I did not mean it should run from flash itself..My application will just reside in flash, I will read back from flash to a RAM location.
To be honest, I have trouble understanding this.
Quoted 6 lines
As I understand, in
board_init_f(), after calling theinit_sequence,relocate_code()is called and it is a must to callrelocate_code(), from where it branches tomain_loop(). My aim is to branch to my application code before calling relocate_code().My application code's executable address is0x40004.Well, if you are working on a PowerPC platform, then
0x40004is certainly a RAM address.Quoted 3 lines
Is it that i can just give jump to
0x40004before callingrelocate_code()and it works?I still don't get why you want to change *anything* inside U-Boot. Why not just use the commands that are available in the command line interpreter? Say you have your application stored at
fc2e0000(arbitrary address) and it is 64k in size. Then why not just do:
Quoted 7 lines
cp.b
fc2e000040000 10000;go 40004Setting bootenv to these commands will start your application on U-Boot timeout. Sticking them into preboot even runs them before the command line is started at all.
--Thanks for your reply Detley. I think I was just trying to complicate things.I have got a better picture now.
Before calling relcoate_code() in board.c, ifI using the command
"cp.b fc2e0000 40000 10000;go 40004" should be fine.....
Thanks & Regards,
Prathika R
Hi Prathika,
Quoted 3 lines
--Thanks for your reply Detley. I think I was just trying to complicate things.I have got a better picture now.
Before callingrelcoate_code()inboard.c, ifI using the command
Uhm, well, actually you should not touch U-Boot code at all. It should simply work.
Quoted 1 line
"cp.b
fc2e000040000 10000;go 40004" should be fine.....
Don't forget to substitute fc2e0000 with the address for your setup ;)
Cheers
Detlev
Signature · 6 lines
Irrationality is the square root of all evil.
-- Douglas Hofstadter
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de