CONFIG_BOOTBINFUNC for AT91RM9200
Dear Wolfgang,
Quoted 3 lines · you
Instead of doing all this which is really non-trivial and also ineffficient you could just boot from flash. I've just checked in the necessary patches for the AT91RM9200DK and
CMC_PU2boards ...
IIUC then part of this code is in cpu/at91rm9200/start.S wrapped in #ifdef CONFIG_BOOTBINFUNC.
As you know I'd like to move the at91rm9200 stuff into cpu/arm920t/at91rm9200. The start.S already calls memsetup if CONFIG_INIT_CRITICAL is defined.
Do you mind moving out the at91 specific stuff?
You already call something like lowlevelinit. Clock init could be done there.
So I'd like to move out the clock specific stuff into
a) board depended memsetup.S or clocksetup.S or
b) a cpu dependend cpu/(arm920t/)at91rm9200/clock.{c,S}.
What do you think?
And:
I don't think CONFIG_BOOTBINFUNC is a good name!
U-Boot should not "include the functionality of boot.bin in u-boot" but include lowlevel, hardware dependend init functionality!
I don't know why Atmel introduced this two stage boot process with gzipped compressed u-boot images without clock or memory setup functions. And actually I don't wanna know.
There already is CONFIG_INIT_CRITICAL. We can add CONFIG_INIT_CLOCKS or CONFIG_INIT_MEMORY or CONFIG_INIT_SDRAM or CONFIG_INIT_LOWLEVEL...
regards,
Steven Scholz
Dear Wolfgang,
is there a standard way in U-Boot to prevent to the startup code from relocating into RAM?
I know that arm920t figures out the currebt address. compares it to _TEXT_BASE and decides wether to relocate or not.
relocate: /* relocate U-Boot to RAM */
adr r0, _start /* r0 <- current position of code */
ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */
So there might be no need for a define like CFG_DONT_RELOCATE. But how about other cpus?
(I am asking cause you wrapped the relocate code in cpu/at91rm9200/start.S with CONFIG_BOOTBINFUNC instead of using the above technique.
Thanks,
Steven
Quoted 3 lines · In message <[email protected]> you wrote:
is there a standard way in U-Boot to prevent to the startup code from relocating into RAM?
No. U-Boot will always relocate itself to RAM. Well, nearly always - in any halfway sane implementation.
Quoted 7 lines
I know that arm920t figures out the currebt address. compares it to
_TEXT_BASEand decides wether to relocate or not.relocate: /* relocate U-Boot to RAM */
adr r0,_start/* r0 <- current position of code */
ldr r1,_TEXT_BASE/* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */
I wish that code was never written.
Quoted 2 lines
So there might be no need for a define like
CFG_DONT_RELOCATE. But how about other cpus?
All CPUs always relocate the code to RAM. This is the general case. Anything else is not supported.
Quoted 2 lines
(I am asking cause you wrapped the relocate code in
cpu/at91rm9200/start.SwithCONFIG_BOOTBINFUNCinstead of using the above technique.
Please consider the CONFIG_BOOTBINFUNC as an optimization of effort and effect (read: quick & dirty hack). Feel free to clean up as long the result is working code, too.
Best regards,
Wolfgang Denk
Signature · 5 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Fools ignore complexity. Pragmatists suffer it. Some can avoid it.
Geniuses remove it.
- Perlis's Programming Proverb #58, SIGPLAN Notices, Sept. 1982Quoted 12 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:
is there a standard way in U-Boot to prevent to the startup code from relocating into RAM?
No. U-Boot will always relocate itself to RAM. Well, nearly always - in any halfway sane implementation.
Quoted 3 lines
I know that arm920t figures out the currebt address. compares it to
_TEXT_BASEand decides wether to relocate or not.
Quoted 7 lines
Quoted 4 lines
relocate: /* relocate U-Boot to RAM */
adr r0,_start/* r0 <- current position of code */
ldr r1,_TEXT_BASE/* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */I wish that code was never written.
Why is that so bad? It makes it possible to debug U-Boot with just loading the image into RAM using BDI2000.
Quoted 2 lines
All CPUs always relocate the code to RAM. This is the general case. Anything else is not supported.
But how would you debug U-Boot?
I though the common way is to disabled relocation and memsetup, load that U-Boot image with an BDI2000 into RAM and execute it - skipping the init code...
--
Steven
Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines
I wish that code was never written.
Why is that so bad? It makes it possible to debug U-Boot with just loading the image into RAM using BDI2000.
Which is an unsupported mode of operation which works for a handfull of experts and causes confusion with many, many newbees.
Quoted 1 line
But how would you debug U-Boot?
As I always do. Attach the BDI, burn to flash, start in GDB.
Quoted 2 lines
I though the common way is to disabled relocation and memsetup, load that U-Boot image with an BDI2000 into RAM and execute it - skipping the init code...
No. This is not the way things should be done. You can do this if you know exactly what you're doing, but it does not help you nor will it save you any time. On contrary. It will cost additional time.
Anyway, this is a FAQ, so please RTFM.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Consultants are mystical people who ask a company for a number and then give it back to them.
Quoted 6 lines · In message <[email protected]> you wrote:
So I'd like to move out the clock specific stuff into
a) board dependedmemsetup.Sorclocksetup.Sor
b) a cpu dependend cpu/(arm920t/)at91rm9200/clock.{c,S}.What do you think?
If you submit a patch, and I find that it works on all systems I can test, then it is OK with me.
Quoted 4 lines
And:
I don't thinkCONFIG_BOOTBINFUNCis a good name!
U-Boot should not "include the functionality of boot.bin in u-boot" but include lowlevel, hardware dependend init functionality!
OK, ok, ok.
Quoted 2 lines
There already is
CONFIG_INIT_CRITICAL. We can addCONFIG_INIT_CLOCKSorCONFIG_INIT_MEMORYorCONFIG_INIT_SDRAMorCONFIG_INIT_LOWLEVEL...
The current setup allows to change a single #define to switch between two different modes of operation: using boot.bin, and not using boot.bin. I don't really care about the name of theis variable as long as it's decoumented and works. But please don;t split it into 15 different names that must be set in a consistent way.
Best regards,
Wolfgang Denk
Signature · 5 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "We have the right to survive!" "Not be killing others." -- Deela and Kirk, "Wink of An Eye", stardate 5710.5
Quoted 3 lines · Wolfgang Denk
Quoted 2 lines
And:
I don't thinkCONFIG_BOOTBINFUNCis a good name!OK, ok, ok.
;-)
Quoted 8 lines
Quoted 2 lines
There already is
CONFIG_INIT_CRITICAL. We can addCONFIG_INIT_CLOCKSorCONFIG_INIT_MEMORYorCONFIG_INIT_SDRAMorCONFIG_INIT_LOWLEVEL...The current setup allows to change a single #define to switch between two different modes of operation: using boot.bin, and not using boot.bin. I don't really care about the name of theis variable as long as it's decoumented and works. But please don;t split it into 15 different names that must be set in a consistent way.
Then I think CONFIG_INIT_CRITICAL is the best choice!
--
Steven
Quoted 2 lines · In message <[email protected]> you wrote:
Then I think
CONFIG_INIT_CRITICALis the best choice!
Definitely not - CONFIG_INIT_CRITICAL is such an ugly name that I wonder who accepted a patch to introduce such a name ;-)
There is no documentation what it does or means; there is not even a
definitian what "sys-critical inits" might be - all the
initializations are "system critical". This is bullsh*i.
We should not use this name, but try to get rid of it.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "To take a significant step forward, you must make a series of finite improvements." - Donald J. Atwood, General Motors
Quoted 5 lines · Wolfgang Denk
Quoted 1 line · In message <[email protected]> you wrote:
Then I think
CONFIG_INIT_CRITICALis the best choice!
Quoted 8 lines
Definitely not -
CONFIG_INIT_CRITICALis such an ugly name that I wonder who accepted a patch to introduce such a name ;-)There is no documentation what it does or means; there is not even a
definitian what "sys-critical inits" might be - all the
initializations are "system critical". This is bullsh*i.We should not use this name, but try to get rid of it.
Hmm. So I suggest replacing it with CONFIG_INIT_LOWLEVEL or CONFIG_LOWLEVEL_INIT.
But then: these init steps (clocks and memory) are vital for U-Boot to run. So why do we need this define anyway if these steps should be done always... ?
Signature · 1 line
Steven Scholz
Quoted 2 lines · In message <[email protected]> you wrote:
Hmm. So I suggest replacing it with
CONFIG_INIT_LOWLEVELorCONFIG_LOWLEVEL_INIT.
Hmmm.. CONFIG or CFG? And what exactly is low (vs. high?) level here?
Quoted 2 lines
But then: these init steps (clocks and memory) are vital for U-Boot to run. So why do we need this define anyway if these steps should be done always... ?
Good question. The only reason I can think of is to allob such a two-stage boot loader as used by Atmel on the AT91RM9200DK.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There's no sense in being precise when you don't even know what you're talking about. -- John von Neumann
Quoted 8 lines · Wolfgang Denk
Quoted 1 line · In message <[email protected]> you wrote:
Hmm. So I suggest replacing it with
CONFIG_INIT_LOWLEVELorCONFIG_LOWLEVEL_INIT.Hmmm.. CONFIG or CFG? And what exactly is low (vs. high?) level here?
Quoted 6 lines
Quoted 2 lines
But then: these init steps (clocks and memory) are vital for U-Boot to run. So why do we need this define anyway if these steps should be done always... ?
Good question. The only reason I can think of is to allob such a two-stage boot loader as used by Atmel on the AT91RM9200DK.
So we check if all other arm920t boards have an implementation of memsetup(). Then kick out CONFIG_INIT_CRITICAL and introduce CONFIG_DO_NOT_MAKE_LOWLEVEL_INIT or something like that !? ;-)
Signature · 1 line
Steven Scholz
Quoted 4 lines · In message <[email protected]> you wrote:
So we check if all other arm920t boards have an implementation of
memsetup(). Then kick outCONFIG_INIT_CRITICALand introduceCONFIG_DO_NOT_MAKE_LOWLEVEL_INITor something like that !? ;-)
Sounds like a plan to me - but let's use a better name, please.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Why can you only have two doors on a chicken coop? If it had four it would be a chicken sedan.