Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: RE: linker/startup question for rockbox _running_ from flash

RE: linker/startup question for rockbox _running_ from flash

From: VanBaren, Gerald (AGRE) <"VanBaren,>
Date: Sat, 17 Jan 2004 06:56:20 -0700

With respect to the preinitialized data in the .data section, I'm pretty sure that requires special start up code, I don't believe gcc and the linker will do that automatically. I'm not a gcc/linker expert, but in my experience, special copy start up code has always been needed.

My suggestion would be to link with .data in the proper place. You then can write a script or utility program to extract the .data section, convert it into a bunch of "define bytes" in assembly (or a constant initialized array in C) and then re-link the program with the real initialization data. Incidentally, you could also compress the initialization data, probably substantially, and link in the compressed version

The initialization routine would then copy the initialization data (with decompression if that is used) to the real .data section in RAM.

Thumbnail sketch:
1) Create a file containing:
     const initsize = 0;
     const char *initdata = {0};
2) link
3) extract .data section from the elf file and turn it into
     const initsize = <actual nubmer of bytes of initialization data);
     const char *initdata = {<lots of real data, optionally compressed>};
4) link again using the real init data this time
5) On start up, copy *initdata to .data

I think this would be a big win. To bad I don't have a flash-based AJR :-(.

gvb


> -----Original Message-----
> From: owner-rockbox_at_cool.haxx.se [mailto:owner-rockbox_at_cool.haxx.se]On
> Behalf Of [IDC]Dragon
> Sent: Saturday, January 17, 2004 8:14 AM
> To: rockbox_at_cool.haxx.se
> Subject: linker/startup question for rockbox _running_ from flash
>
>
> Hi,
>
> yesterday I turned my head towards an experiment I have in
> mind since a
> longer time:
> To actually run rockbox from flash, so not having the loader
> decompress it
> from flash into DRAM, but executing directly from there (the loader is
> prepared to do that). This would save ~160K of RAM, but
> executes slower since the
> flash has only an 8 bit bus versus the DRAM has 16. I don't
> know if it's
> tolerable, have to find out.
>
> I'm struggling with the linker to teach that to him. The gnu
> linker docs
> didn't help me much. Attached is my first .lds file. But this
> won't work,
> because I somehow have to place the .data segment into DRAM,
> but have it
> initialized from flash, copied from a part in .rodata. Maybe
> this requires a special
> startup code to copy that, but I don't even know how to
> define the regions for
> the linker.
>
> BTW, we have a couple of arrays we'd better define as
> "const", else I would
> have them twice.
>
> Any ideas?
> Thanks,
> Jörg
>
> --
> +++ GMX - die erste Adresse für Mail, Message, More +++
> Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail
>



******************************************
The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email.
******************************************
Received on 2004-01-17

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy