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


Scott Furman wrote:
A long time ago, jifl graciously reviewed the OpenRISC port of eCos and made a number of suggestions and improvements. It's been on my plate since then to respond. Some of his changes to the architecture
linker script broke compilation (as he warned they might) and the attached patches fix that.

Yep, I suspected that might happen, sorry, although see below.


+ + /* 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++.


***************
*** 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).


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.

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.


Although I did say I was going to not include the small data sections in my checkin, but I forgot to eliminate them evidently. They are harmless for the above reason though.

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 ;)).

* You add a comment in hal_openrisc_orp.cdl about CYGNUM_HAL_RTC_PERIOD which should be calculated not default_value. Indeed that's what the CDL option CYGNUM_KERNEL_COUNTERS_CLOCK_OVERRIDE_PERIOD is for, so I suggest just making this a calculated after all.

* 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'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.

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

* 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.

If there are any issues here you don't feel able to tackle, then please at least put them into Bugzilla: http://bugs.ecos.sourceware.org/

Either way I'll wait for feedback from you before I do anything.

Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


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