Skip to contentSkip to conversation

ARM926EJ-S: defining TEXT_BASE

U-Boot Roman Mashak 2 participants 2 messages Dec 21, 2008

lore
Share & tools
lore
#0 lore raw

Hello

I have a trouble defining a valid TEXT_BASE value. On my chip, after reset 0x0 and before remap points at NOR flash, RAM is mapped to 0x1000_0000. Therefore, U-Boot image should be linked to 0x0000_0000 address to properly start off the flash, i.e. TEXT_BASE defined in $(uboot)/board/my_board/config.mk should be 0x00000000, right?

But uboot usually copies itself to RAM, which is at 0x1000_0000 in my case -- it won't work as I understand, as my image is linked to 0x0000_0000. Then if we do remap first (making RAM at 0x0000_0000), then copy image to RAM, then there will no be a room for 'malloc' area (which uboot allocates at lower addresses), as we specified TEXT_BASE=0x0, and this is the address U-Boot copies itself in memory at.

How should I do then?

My guess is that ARM's startup code should be position independent, but I have not found any compiler or linker options doing this (like -fpic or -pie etc.). Perhaps I misunderstand something in a work of U-Boot...

Thanks.

Signature · 1 line
Roman Mashak
#1 lore raw

Dear Roman,

Quoted 6 lines · In message <[email protected]> you…

I have a trouble defining a valid TEXT_BASE value. On my chip, after reset 0x0 and before remap points at NOR flash, RAM is mapped to 0x1000_0000. Therefore, U-Boot image should be linked to 0x0000_0000 address to properly start off the flash, i.e. TEXT_BASE defined in $(uboot)/board/my_board/config.mk should be 0x00000000, right?

NO. On ARM (where proper relocation has never been implemented yet) TEXT_BASE points to the start address *after* copying the image to RAM,
i. e. it is an address in RAM.

Quoted 1 line

How should I do then?

Fix your TEXT_BASE.

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
"UNIX was not designed to stop you from doing stupid things,  because
that would also stop you from doing clever things."       - Doug Gwyn