This is the mail archive of the ecos-patches@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: OpenRISC arch/platform fixes


[Away from email for awhile. Sorry for not responding sooner...]

Jonathan Larmour wrote:

+ + /* FIXME: libsupc++ is not needed by eCos, but it might be needed by apps linked w/ eCos.
+ However, it does not yet compile for OpenRISC. */


That's unfortunate. Normally at least libsupc++ compiles, even if not full libstdc++.

It may well be easy to fix. (I haven't invested any time in it.) If someone else can figure it out, please let me know and we can add libsupc++ back to the linker script.


***************
*** 270,276 ****
{ \
__SDATA_START__ = ABSOLUTE(.); \
FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
! } > _region_
#define SECTION_lit8(_region_, _vma_, _lma_) \
.lit8 _vma_ : _lma_ \
--- 273,281 ----
{ \
__SDATA_START__ = ABSOLUTE(.); \
FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
! } > _region_ \
! __ram_data_end = .; _edata = . ; \
! PROVIDE (edata = .);
#define SECTION_lit8(_region_, _vma_, _lma_) \
.lit8 _vma_ : _lma_ \
***************
*** 283,290 ****
{ \
FORCE_OUTPUT; *(.lit4) \
} > _region_ \
- __ram_data_end = .; _edata = . ; \
- PROVIDE (edata = .);
#define SECTION_sbss(_region_, _vma_, _lma_) \
.sbss _vma_ : _lma_ \


If C symbols have underscore prepended, you may want to change _edata to __edata to prevent possible namespace pollution (yes I know there are a few other examples already in the HALs and given time we'd get to those).

The attached patch changes _edata =>__edata and _end =>__end.


I'm slightly curious as to why you moved these lines from the bottom of lit4 to the bottom of sdata. The .lit sections (if they exist) are also initialized data so would need relocating too.

By "relocating", I assume that you're referring to copying from ROM to RAM, and not talking about some linker operation. I believe that the lit4 and lit8 sections contain only shared literals and are, hence, read-only. My thinking was that they would be retained in ROM (along with .rdonly, .ctors, and other read-only sections) with a ROM or ROMRAM configuration.


Incidentally, lit4 and lit8 aren't currently used for the OpenRISC architecture.

Index: orp/current/include/pkgconf/mlt_openrisc_orp_ram.ldi
===================================================================
RCS file: /export/CVS/dave/ecos/packages/hal/openrisc/orp/current/include/pkgconf/mlt_openrisc_orp_ram.ldi,v
retrieving revision 1.1.1.1
diff -s -c -r1.1.1.1 mlt_openrisc_orp_ram.ldi
*** orp/current/include/pkgconf/mlt_openrisc_orp_ram.ldi 22 May 2003 00:37:33 -0000 1.1.1.1
--- orp/current/include/pkgconf/mlt_openrisc_orp_ram.ldi 18 Jun 2003 02:55:53 -0000
***************
*** 11,38 ****
SECTIONS
{
SECTIONS_BEGIN
! SECTION_vectors (ram, 0x00000100, LMA_EQ_VMA)
SECTION_ROMISC (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_RELOCS (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_init (ram, ALIGN (0x8), LMA_EQ_VMA)
- SECTION_text (ram, 0x00008000, LMA_EQ_VMA)
SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA)
- SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_eh_frame (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_ctors (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_dtors (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_devtab (ram, ALIGN (0x8), LMA_EQ_VMA)
- SECTION_got (ram, ALIGN (0x8), LMA_EQ_VMA)
- SECTION_dynamic (ram, ALIGN (0x8), LMA_EQ_VMA)
- SECTION_sdata (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_lit8 (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_lit4 (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_sbss (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
SECTIONS_END
}
--- 11,40 ----
SECTIONS
{
SECTIONS_BEGIN
! SECTION_vectors (ram, 0x00000000, LMA_EQ_VMA)
! SECTION_text (ram, 0x00008000, LMA_EQ_VMA)
! ! SECTION_data (ram, ALIGN(0x8), LMA_EQ_VMA)
! SECTION_got (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_dynamic (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_sdata (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_sbss (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
SECTION_ROMISC (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_RELOCS (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_init (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_eh_frame (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_ctors (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_dtors (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_devtab (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_lit8 (ram, ALIGN (0x8), LMA_EQ_VMA)
SECTION_lit4 (ram, ALIGN (0x8), LMA_EQ_VMA)
! CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
SECTIONS_END
}


This is asking for trouble with future toolchains, or with C++ exception support down the line. If the sections are empty the order won't matter. If they're not empty, it's probably for a good reason.

When you say "this is asking for trouble", I assume you're referring to the re-ordering of sections. For the ROM linker script, I had to re-order the sections to aggregate those (read-only) sections which could remain in ROM versus those sections that were mutable and, hence, had to be copied to RAM. I re-used the resulting section ordering in the *_ram.ldi file. I can revert the section reordering for the *_ram.ldi file, but what should I do about the *_rom.ldi file ? (I would prefer to keep them similar, if possible).


Index: orp/current/include/pkgconf/mlt_openrisc_orp_rom.ldi
===================================================================
RCS file: /export/CVS/dave/ecos/packages/hal/openrisc/orp/current/include/pkgconf/mlt_openrisc_orp_rom.ldi,v
retrieving revision 1.1.1.1
diff -s -c -r1.1.1.1 mlt_openrisc_orp_rom.ldi
*** orp/current/include/pkgconf/mlt_openrisc_orp_rom.ldi 22 May 2003 00:37:33 -0000 1.1.1.1
--- orp/current/include/pkgconf/mlt_openrisc_orp_rom.ldi 18 Jun 2003 03:00:41 -0000
***************
*** 11,17 ****
SECTIONS
{
SECTIONS_BEGIN
! SECTION_vectors (rom, 0xF0000100, LMA_EQ_VMA)
SECTION_ROMISC (rom, ALIGN (0x8), LMA_EQ_VMA)
SECTION_RELOCS (rom, ALIGN (0x8), LMA_EQ_VMA)
SECTION_init (rom, ALIGN (0x8), LMA_EQ_VMA)
--- 11,31 ----
SECTIONS
{
SECTIONS_BEGIN
! ! SECTION_vectors (rom, 0xF0000000, LMA_EQ_VMA)
! ! // All eCos code is put in the .text section unless explicitly placed
! // into a section named section .text.ram*.
! SECTION_text_ram (ram, 0x00001000, AT(0xF0001000))
! SECTION_data (ram, ALIGN(0x8), FOLLOWING(.text.ram))
! SECTION_got (ram, ALIGN (0x8), FOLLOWING (.data))
! SECTION_dynamic (ram, ALIGN (0x8), FOLLOWING (.got))
! SECTION_sdata (ram, ALIGN (0x8), FOLLOWING (.dynamic))
! SECTION_sbss (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
! CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
! ! . = LOADADDR(.sdata) + SIZEOF(.sdata);
SECTION_ROMISC (rom, ALIGN (0x8), LMA_EQ_VMA)
SECTION_RELOCS (rom, ALIGN (0x8), LMA_EQ_VMA)
SECTION_init (rom, ALIGN (0x8), LMA_EQ_VMA)
***************
*** 21,38 ****
SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA)
SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA)
! SECTION_data (ram, 0x1000, FOLLOWING (.gcc_except_table))
! SECTION_eh_frame (ram, ALIGN (0x8), FOLLOWING (.data))
! SECTION_ctors (ram, ALIGN (0x8), FOLLOWING (.eh_frame))
! SECTION_dtors (ram, ALIGN (0x8), FOLLOWING (.ctors))
! SECTION_devtab (ram, ALIGN (0x8), FOLLOWING (.dtors))
! SECTION_got (ram, ALIGN (0x8), FOLLOWING (.devtab))
! SECTION_dynamic (ram, ALIGN (0x8), FOLLOWING (.got))
! SECTION_sdata (ram, ALIGN (0x8), FOLLOWING (.dynamic))
! SECTION_lit8 (ram, ALIGN (0x8), FOLLOWING (.sdata))
! SECTION_lit4 (ram, ALIGN (0x8), FOLLOWING (.lit8))
! SECTION_sbss (ram, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
! CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
SECTIONS_END
}
--- 35,46 ----
SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA)
SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA)
! SECTION_eh_frame (rom, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_ctors (rom, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_dtors (rom, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_devtab (rom, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_lit8 (rom, ALIGN (0x8), LMA_EQ_VMA)
! SECTION_lit4 (rom, ALIGN (0x8), LMA_EQ_VMA)
! SECTIONS_END
}


The same applies here with the ordering, although the change to rom is not unreasonable for all of these, with the exception of the .lit sections which must be relocated to ram like .data.

There's some outstanding issues from before:

* The invocation of cyg_hal_exception_handler doesn't look right... nothing is saved! Otherwise if you take an exception there's no saved register state to point at... vital for the GDB stub at least. This way CYGSEM_HAL_ROM_MONITOR will get used as it's meant to as well (since it isn't used at all right now ;)).

I answered this in some previous message sent to the list 4/28/03:


Scott Furman wrote:

All the exception state *is* stored before cyg_hal_exception_handler() is called. (Check out the expansion of the exception_vector assembly macro in vectors.S. ) I know that this "works" because I have hit gdb exceptions for illegal instructions, bus errors, etc. and stack backtraces were sensible-looking.


* If you're using this with RedBoot do you have a potted .ecm file to go with this? And also when we're done, remember to send me some prebuilt known good redboot images I can check in to our redboot image repository (ecos/images which isn't checked out by default so you won't have seen it).

I mentioned this last time: I'm not really clear on the process of creating a *.ecm file and how it differs from a *.ecc file. (Where is this documented ?)


If I use configtool and select template "ORP" and configuration "Redboot", I get a perfectly useable Redboot configuration. How can I take the huge *.ecc file generated and turn it into a *.ecm file ?

* I've also got to make the changes to ecos.db, and NEWS. But I also need info from you to get things at http://ecos.sourceware.org/hardware.html, particularly any board availability information (or is it simulator only?). I can also put in sponsorship info about Rosum there.

My understanding is that the prototyping boards are no longer available for purchase. My guess is that most developers will not use an off-the-shelf board, but will instead use a custom HW platform with a customized version of the OpenRISC (and will define their own eCos platform). Initially, though most will want to run on the simulator if they're not familiar with eCos.


* Is there any way to get eCos listed as a project at http://www.opencores.org/projects/or1k/Home with the other OS's?

Once these most recent changes are checked into the repository, I will pester the OpenCores folks to add eCos to their list of projects. I think they would be pleased to do so...


* Some sort of documentation would be good just so people can find out how to get going. Docbook would be good, but if nothing else a README.txt in one or both packages might be something.

There *is* an (admittedly very sparse) README.html file in the arch/current/doc subdir. I created bug 1000030 to reflect that additional introductory documentation needs to be written.


-Scott

Index: src/openrisc.ld
===================================================================
RCS file: /export/CVS/dave/ecos/packages/hal/openrisc/arch/current/src/openrisc.ld,v
retrieving revision 1.4
diff -c -r1.4 openrisc.ld
*** src/openrisc.ld	16 May 2003 19:10:57 -0000	1.4
--- src/openrisc.ld	2 Jul 2003 21:02:11 -0000
***************
*** 274,280 ****
      __SDATA_START__ = ABSOLUTE(.);                            \
        FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
      } > _region_                                              \
!     __ram_data_end = .; _edata = . ;                          \
      PROVIDE (edata = .);
  
  #define SECTION_lit8(_region_, _vma_, _lma_)    \
--- 274,280 ----
      __SDATA_START__ = ABSOLUTE(.);                            \
        FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \
      } > _region_                                              \
!     __ram_data_end = .; __edata = . ;                         \
      PROVIDE (edata = .);
  
  #define SECTION_lit8(_region_, _vma_, _lma_)    \
***************
*** 305,311 ****
        __bss_end = ABSOLUTE (.); }                           \
      > _region_
  
! #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
  
  #include <pkgconf/system.h>
  #include CYGHWR_MEMORY_LAYOUT_LDI
--- 305,311 ----
        __bss_end = ABSOLUTE (.); }                           \
      > _region_
  
! #define SECTIONS_END . = ALIGN(4); __end = .; PROVIDE (end = .);
  
  #include <pkgconf/system.h>
  #include CYGHWR_MEMORY_LAYOUT_LDI

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