Re: ARM position-independent code problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, but you've kind of lost me there.  I don't understand what you mean by "write two programs".  It's only one program, with the bootloader contained in a flash section until I need to use it.  Do you mean to build a version with the bootloader section already located in RAM (which works), make that bootloader section part of the flash image in a build that does not have the bootloader located in RAM, then copy that section into RAM when it's needed and jump to it?  I'm trying something like that with the -fPIC option, but it doesn't seem to be truly position-independent; it can find some of the global variables correctly, but not all.  I can't find this "file2c" utility for Windows.



-----Original Message-----

From: Wojciech Puchar [mailto:wojtek@xxxxxxxxxx]

Sent: Thursday, January 31, 2019 12:17 PM

To: David Sherman <DSherman@xxxxxxxxxxxxxxx<mailto:DSherman@xxxxxxxxxxxxxxx>>

Subject: Re: ARM position-independent code problem



> Hi, I'm hoping someone might be able to shed some light on this.  I'm developing a bootloader for an ARM M4 core.  The GCC is built into an Eclipse environment, but I'm hoping the info might be relevant.  I had originally built the bootloader without the -fPIC switch, which I didn't know was an option in the builder.  In the first incarnation, I used a macro to calculate the entry points into the bootloader section after it was copied to RAM.  It worked, except I discovered that there were a few lines where there were absolute jumps to the code which was linked into flash.  Doesn't work so well if the flash image being programmed doesn't match.



write two programs.



first - actual bootloader, relocated to target address. then use file2c to convert it to const char[] table, and #include in preloader that simply copy it to RAM and jumps.



That's how i already made it on BLE chip.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux