previous two e-mails are RFC/demonstration!
Best Regards,
Reinhard
Dear Reinhard Meyer,
and - do they compile? Do they work?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Es ist nicht genug zu wissen, man mu? auch anwenden; es ist nicht ge- nug zu wollen, man mu? auch tun. -- Goethe, Maximen und Reflexionen
Dear Wolfgang Denk,
Quoted 3 lines
Dear Reinhard Meyer,
and - do they compile? Do they work?
Compile and work on top9000 = at91sam9xe = arm926ejs.
Since no tricks are used anymore, it is very likely this will work on all other ARM variants or even on all architectures with a similar GLOBAL_DATA method.
I made this patch as demo/reference to show how simple it is. Honestly, it should have sprung into someones' eyes long ago, but sometimes simple solutions hide themselves well :)
TODOs:
1. I am quite sure that in arm/lib/board.c__asm__ __volatile__("": : :"memory");
was never needed and definitely is not needed anymore. Can anyone shed some light on why this was added? Probably just copied from other architectures where some trickery around gd was done?
2. All board config files (for ARM) should be similarly updated:
-#define CONFIG_SYS_INIT_SP_ADDR \
- (ATMEL_BASE_SRAM + 0x4000 - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR (ATMEL_BASE_SRAM + 0x4000) However, having the subtraction does not hurt except for wasted memory.
3. After this, GENERATED_GBL_DATA_SIZE is not needed anymore (for ARM).
4. start.S need just set the SP to CONFIG_SYS_INIT_SP_ADDR, if one wants to be over-cautious extra alignment *can* be done.
5. Test the change for other architectures.
Best Regards,
Reinhard
Le 14/11/2010 20:42, Reinhard Meyer a ?crit :
Quoted 6 lines
1. I am quite sure that in
arm/lib/board.c__asm____volatile__("": : :"memory");
was never needed and definitely is not needed anymore. Can anyone shed some light on why this was added? Probably just copied from other architectures where some trickery around gd was done?
This kind of barrier is needed when the compiler might reorder code without seeing a dependency (I met such a case in the Marvell egiga driver code). Here, I don't see the reason offhand.
Quoted 2 lines
4.
start.Sneed just set the SP toCONFIG_SYS_INIT_SP_ADDR, if one wants to be over-cautious extra alignment *can* be done.
Currently start.S sets the stack twice, once before calling board_init_f, and once in relocate_code. Are you suggesting we remove the second sp setting?
Quoted 2 lines
Best Regards,
Reinhard
Amicalement,
Signature · 1 line
Albert.
Dear Albert ARIBAUD,
Quoted 9 lines
Le 14/11/2010 20:42, Reinhard Meyer a ?crit :
Quoted 6 lines
1. I am quite sure that in
arm/lib/board.c__asm____volatile__("": : :"memory");
was never needed and definitely is not needed anymore. Can anyone shed some light on why this was added? Probably just copied from other architectures where some trickery around gd was done?
Quoted 6 lines
This kind of barrier is needed when the compiler might reorder code without seeing a dependency (I met such a case in the Marvell egiga driver code). Here, I don't see the reason offhand.
Quoted 2 lines
4.
start.Sneed just set the SP toCONFIG_SYS_INIT_SP_ADDR, if one wants to be over-cautious extra alignment *can* be done.Currently
start.Ssets the stack twice, once before callingboard_init_f, and once inrelocate_code. Are you suggesting we remove the second sp setting?
No, of course not.
Extra alignment code need not be added (to the first setting of SP) anymore since CONFIG_SYS_INIT_SP_ADDR is well aligned when set to the end of the storage area.
Adding extra alignment code was proposed in discussions a few days ago, when GENERATED_GBL_DATA_SIZE was still subtracted.
Best Regards,
Reinhard
Dear Albert ARIBAUD,
Quoted 4 lines · In message <[email protected]> you wrote:
Currently
start.Ssets the stack twice, once before callingboard_init_f, and once inrelocate_code. Are you suggesting we remove the second sp setting?
As relocation can move the stack to some completely different location the SP has to be re-initialized (in this setup, after copying the global data to their new location).
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "A little knowledge is a dangerous thing." - Doug Gwyn
Dear All,
Quoted 11 lines
Dear Albert ARIBAUD,
Quoted 4 lines · In message<[email protected]> you wrote:
Currently
start.Ssets the stack twice, once before callingboard_init_f, and once inrelocate_code. Are you suggesting we remove the second sp setting?As relocation can move the stack to some completely different location the SP has to be re-initialized (in this setup, after copying the global data to their new location).
In the *most general* case stack and gd will have to be relocated to SDRAM, since the pre-relocation memory *could* be locked data cache or some buffer memory that is not free anymore when u-boot is up.
Of course, on SoCs like AT91SAM9 where several (4k - 32k) of SRAM are available it would be tempting to keep stack and gd just in SRAM. But we don't want to specialize, we want to generalize...
Best regards,
Reinhard