From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kate Alhola Date: Thu, 25 Mar 2004 11:13:53 +0200 Subject: [U-Boot-Users] Compiling relocatable code and DATA for PPC In-Reply-To: <20040324152226.5D224C0655@atlas.denx.de> References: <20040324152226.5D224C0655@atlas.denx.de> Message-ID: <4062A2D1.50901@iti.fi> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: >>All examples that i have found uses static addresses. Also using >>google i have not found any answers. >> >> > >You will either have to use PIC (which is not what U-Boot does), or >use a static link address (which is what U-Boot does for standalone >applications), or use relocatable code that you can (manually) >relocate to a target address of your choice (which is what U-Boot >does for the U-Boot code itself). > > The thing that i like to use is PIC and PID ( position independent data and code ). U-boot allows to load my code in any address and i really don't like to manually relocate it. I like to have ready compiled code parts in mass media ( flash ) and i like to to allow load them to any free address. There is this same problem allways if you use non-mmu processor like MPC555 and you like to load more than just one fixed program into memory. You should remember that the applications loaded with u-boot are not allways just "stand-alone" apps or Linux. Based on my knowledge there is not even Linux for mpc555. I our case i like to load my open source rtos kernel ( Katix ) and then applications for it. Becouse u-boot runs in many non-mmu processors i was just thinking that some u-boot user has had same problem and find already answer. I have searched all around internet to find answer but not yet find one. -fpic should make program code position independent and -msdata=eabi -G20000 should put all static data smaller than 20000 bytes to relative to r2(const data) or r13 . For some reason gcc says that -msdata=eabi and -fpic are incompatible and even -msdata=eabi does not make data references as register relative. Kate