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: linker script for V850?


Hi,

I have solved a a similar problem as following:

Definition of memory map:

...
MEMORY
{
 eprom (rx) : ORIGIN = 0x0, LENGTH = 1M
 ram (rwx) : ORIGIN = 0x400000, LENGTH = 4M
}

The section .text of my executable is built from the .text 
sections of the objects:

...

.text  {
        _start_text = .;
         *(.text) 
        _stop_text = .;
        } > eprom 

Just after the .text section, I locate the ROM image of .data.
This ROM image must be copied by the code (it can be the startup
code or, as in my case, a C function executed at the very
beginning of the program).

 _start_rom_data = _stop_text;
 .data : AT (_start_rom_data) {
                               _start_data = .;
                               *(.data)
                               _end_data = .; } > ram

 _stop_rom_data = _start_rom_data + _end_data - _start_data;

The C code that makes the copy is summarized here:

...
extern unsigned int _start_rom_data;
extern unsigned int _stop_rom_data;

...
   for (src = (unsigned int)&_start_rom_data, 
        dst = (unsigned int)&_start_data;
           src < (unsigned int)&_stop_rom_data;
	           src++, dst++)
     {
      *(unsigned char *)dst = *(unsigned char *)src;
     }

I hope this helps.

Best Regards,
José Miguel


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