This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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: Probleme with ram rom data sections



> -----Message d'origine-----
> De: Gary Thomas [mailto:gary@mlbassoc.com]
> Date: vendredi 10 octobre 2003 15:42
> À: Matthieu.GIRARDIN@fr.thalesgroup.com
> Cc: ecos-discuss@sources.redhat.com
> Objet: RE: [ECOS] Probleme with ram rom data sections
> 
> 
> On Fri, 2003-10-10 at 07:20, 
> Matthieu.GIRARDIN@fr.thalesgroup.com wrote:
> > > > Well good afternoon everybody !
> > > >
> > > > I tried to modify my memory layout. I want 4 Mo ROM at
> > > 0x4000000 and 2Mo RAM
> > > > at 0x000.
> > > > I modify my mlt files as follow :
> > > >
> > > > mlt_powerpc_mbx_rom.ldi:
> > > >    
> > > > MEMORY
> > > > {
> > > >     ram : ORIGIN = 0, LENGTH = 0x200000
> > > >     rom : ORIGIN = 0x4000000, LENGTH = 0x400000
> > > > }
> > > >
> > > > SECTIONS
> > > > {
> > > >     SECTIONS_BEGIN
> > > >     SECTION_vectors (rom, 0x4000000, LMA_EQ_VMA)
> > > >     SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA)
> > > >     SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA)
> > > >     SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA)
> > > >     SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA)
> > > >     SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
> > > >     SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA)
> > > >     CYG_LABEL_DEFN(__reserved_vectors) = 0; . =
> > > > CYG_LABEL_DEFN(__reserved_vectors) + 0x3000;
> > > >     CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x1); . =
> > > > CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200;
> > > >     CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x1); . =
> > > > CYG_LABEL_DEFN(__reserved_virtual_table) + 0x100;
> > > >     SECTION_data (ram, ALIGN (0x10), 
> FOLLOWING(.gcc_except_table))
> > > >     //SECTION_data (ram, ALIGN (0x10), AT(0x4200000))
> > > >     SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA)
> > > >     SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
> > > >     CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
> > > >     SECTIONS_END
> > > > }
> > > >
> > > >
> > > > mlt_powerpc_mbx_rom.h:
> > > >
> > > > #ifndef __ASSEMBLER__
> > > > #include <cyg/infra/cyg_type.h>
> > > > #include <stddef.h>
> > > >
> > > > #endif
> > > > #define CYGMEM_REGION_ram (0)
> > > > #define CYGMEM_REGION_ram_SIZE (0x200000)
> > > > #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R |
> > > CYGMEM_REGION_ATTR_W)
> > > > #define CYGMEM_REGION_rom (0x4000000)
> > > > #define CYGMEM_REGION_rom_SIZE (0x400000)
> > > > #define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R)
> > > > #ifndef __ASSEMBLER__
> > > > extern char CYG_LABEL_NAME (__reserved_vectors) [];
> > > > #endif
> > > > #define CYGMEM_SECTION_reserved_vectors (CYG_LABEL_NAME
> > > > (__reserved_vectors))
> > > > #define CYGMEM_SECTION_reserved_vectors_SIZE (0x3000)
> > > > #ifndef __ASSEMBLER__
> > > > extern char CYG_LABEL_NAME (__reserved_vsr_table) [];
> > > > #endif
> > > > #define CYGMEM_SECTION_reserved_vsr_table (CYG_LABEL_NAME
> > > > (__reserved_vsr_table))
> > > > #define CYGMEM_SECTION_reserved_vsr_table_SIZE (0x200)
> > > > #ifndef __ASSEMBLER__
> > > > extern char CYG_LABEL_NAME (__reserved_virtual_table) [];
> > > > #endif
> > > > #define CYGMEM_SECTION_reserved_virtual_table (CYG_LABEL_NAME
> > > > (__reserved_virtual_table))
> > > > #define CYGMEM_SECTION_reserved_virtual_table_SIZE (0x100)
> > > > #ifndef __ASSEMBLER__
> > > > extern char CYG_LABEL_NAME (__heap1) [];
> > > > #endif
> > > > #define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
> > > > #define CYGMEM_SECTION_heap1_SIZE (0x400000 - (size_t)
> > > CYG_LABEL_NAME
> > > > (__heap1))
> > > >
> > > > Well now, my problem is :
> > > > when I read the nm output from my file generated
> > > (powerpc-eabi-nm) I can see
> > > > (result 1 just under) the right symbol __rom_data_start at
> > > the end of the
> > > > rom but when I transform it into S-Record file (Motorola
> > > standard file)
> > > > before to flash it I can see (result 2 just under) that
> > > there is nothing
> > > > after this adress; as if the data section was empty...
> > > > If someone can help it would be great.
> > > >
> > > > Result 1:
> > > >
> > > > 04023498 V typeinfo name for std::bad_cast
> > > > 040234a4 V typeinfo name for std::type_info
> > > > 040234b4 W raise
> > > > 04023570 A _etext
> > > > 0402442c r hex.2
> > > > 040258ac A __FIXUP_START__
> > > > 04025a1c A __EXCEPT_END__
> > > > 04025a1c A __EXCEPT_START__
> > > > 04025a1c A __FIXUP_END__
> > > > 04025a20 A __rom_data_start
> > > >
> > > > Result 2:
> > > >
> > > > S3190402598004023364040233680402336C040233700402337CC6
> > > > S3190402599404023380040233840402338804023394040233981E
> > > > S319040259A80402339C040233A0040233AC040233B0040233B476
> > > > S319040259BC040233B8040233BC040233C0040233C4040233C8EE
> > > > S319040259D0040233CC040233D0040233D4040233D8040233DC76
> > > > S319040259E4040233E0040233E4040233E8040233EC040233F0FE
> > > > S319040259F8040233F4040233F8040233FC040234000402340484
> > > > S30D04025A0C040234080000000044                             
> > >     <-- the end
> > > > of the rom
> > > >    
> > > > nothing in data section
> > > > S31900003300000000003B9ACA00000000640400AA040400AC044A     
> > >     <-- the
> > > > beginning of the ram
> > > > S319000033140400D0E40400D0EC0400AD900400AD980400B05C8D
> > > > S319000033280400A9380400B08C0400B1A00400B2600400B398AC
> > > > S3190000333C0400D0E40400D0EC0400B5440400B56C0400B5D450
> > >
> > > What does "powerpc-eabi-objdump -h <FILE>.elf" show?
> > > What does your command to create the S-record file look like?
> > >
> > > --
> > > Gary Thomas <gary@mlbassoc.com>
> > > MLB Associates
> > >
> > 
> > Well, just under is the result of "powerpc-eabi-objdump -h 
> <FILE>.elf".
> > My command to create my S-Record is "dump -Rv -o map.dmp 
> <FILE>.elf".
> > So it seems the objdump give us a correct answer (or I'am 
> stupid...).
> > But I can't load my elf in flash because before when I read 
> my map.dmp
> > there is nothing in the data section.
> > Thanks if you can help.
> > 
> > powerpc-eabi-objdump:
> > 
> > perf.otr.rom.le.1010.a.1502.elf:     file format elf32-powerpc
> > 
> > Sections:
> > Idx Name          Size      VMA       LMA       File off  Algn
> >   0 .vectors      00002000  04000000  04000000  00010000  2**8
> >                   CONTENTS, ALLOC, LOAD, READONLY, CODE
> >   1 .text         00021570  04002000  04002000  00012000  2**3
> >                   CONTENTS, ALLOC, LOAD, READONLY, CODE
> >   2 .fini         00000000  04023570  04023570  00045694  2**0
> >                   CONTENTS
> >   3 .rodata1      00000000  04023570  04023570  00045694  2**0
> >                   CONTENTS
> >   4 .rodata       0000233c  04023570  04023570  00033570  2**2
> >                   CONTENTS, ALLOC, LOAD, READONLY, DATA
> >   5 .fixup        00000170  040258ac  040258ac  000358ac  2**2
> >                   CONTENTS, ALLOC, LOAD, DATA
> >   6 .gcc_except_table 00000000  04025a1c  04025a1c  00045694  2**0
> >                   CONTENTS
> >   7 .data         00002394  00003300  04025a20  00043300  2**3
> >                   CONTENTS, ALLOC, LOAD, CODE
> >   8 .sbss         000000d5  00005694  00005694  00005694  2**2
> >                   ALLOC
> >   9 .bss          000f792c  00005770  00005770  0000569b  2**4
> >                   ALLOC
> >  10 .comment      0000061e  00000000  00000000  00045694  2**0
> >                   CONTENTS, READONLY 
> 
> Have you tried to use objcopy to create the S-record file?
>   % powerpc-eabi-objcopy -O srec <FILE>.elf <FILE>.srec
> I know nothing of your "dump" program, but objcopy does the 
> right thing.
> 
> -- 
> Gary Thomas <gary@mlbassoc.com>
> MLB Associates
> 

Ok it works, yeaaaaaaaaaaaaaaaaaaaaaaaah !
In fact I think that my gnu tool dump is too old to generate a good s-record
from your elf files. It works with your dedicaced tool "powerpc-eabi-objcopy
-O srec".
So a big thanks to you for your help.
(I believe you'are the autor of mbx files : gthomas ? no)
Big thanks for your help and for eCos !

--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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