This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: sigh... newlib startup


Dave and group:

It works!!  I'll put this in the archives now, so in case I forget or
someone ELSE needs to know this :)

I'm doing powerpc-eabi (8245).

To recap: I have a section of FLASH and a bunch of code and data that
will run out of ROM.  When the bootloader (custom) boots up, it starts
executing the image it finds in ROM.  The "real" executable must be
copied from ROM to RAM, along with all its data, and then execution
starts in RAM at "_start".

_start needs a bunch of stuff from .got2 and .fixup, apparently.  I'm
ignorant as to what all this is for, and haven't taken the time to
figure out what all's in there, except that I do know it clears the bss.

What I *was* doing that was not working was putting .got2 and .fixup in
their own output sections from my linker script, but not copying them.
What works right now is that I put them in the .text output section.
Voile!

My .text output section is like this:

.text (0x0) : AT (LOADADDR(.header) + SIZEOF (.header)) {
	*(.vector)
	. = 0x2000;
	*(.text)
	*(.rodata)
	*(.rodata.*)
	*(.eh_frame)		/* why do I need this?? */
	*(.got2)
	*(.fixup)
}

That works well for now.  When I get the rest of my app running, I have
no idea what changes I'll need to make.  We'll cross that bridge later.

I may have to make my boot code relocate .got2 and .fixup separately,
but I have to find the rules that define where they go, but Dave Korn
mentioned they need to go close to the .text segment.

I don't know if many people use newlib for something like what I'm doing
(no OS, just ISR's, app code and newlib), but everything works (I tested
it using sprintf, printf and sin()).

If anyone else out there would like to add anything to this, correct my
ignorance, etc, I'd appreciate it, and I bet others in the future would,
too.

Thanks, Dave!

Regards,

Matt Gessner


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]