sh architecture, "hello" sample doesn't work

Alberico Colpo alberico at
Fri Jun 25 14:29:38 UTC 2010

Alle venerdì 25 giugno 2010,Ralf Corsepius ha scritto:
> On 06/25/2010 10:03 AM, Steve Battazzo wrote:
> > Hi,
> >
> > We have very slightly modified the gensh2 bsp such that the code should
> > run on an SH7145 chip. The internal registers are mostly the same, so
> > for now the only thing that probably needed to be changed was an extra
> > write to disable individual module power down modes for SCI0 and SCI1
> > which didn't exist in the 7045 that the bsp was intended for.
> >
> > In the gensh2 source folder there is a README which provides
> > instructions on running hello.exe through gdb using gdbstubs.
> >
> > Using sh-elf-gcc and a gdbstub both provided by KPIT GNU tools, the code
> > can be loaded into RAM just fine with sh-rtems4.9-gdb, but when I try to
> > run it with the "continue" command, I get an Illegal Instruction signal
> > at 0x00400000 (the first address of SRAM).
> > I tried running objcopy to generate an s-record file, and loaded that
> > through sh-elf-gdb instead of the rtems gdb, this time no SIGILL, but
> > ran into a segfault a few hundred bytes into the code memory.
> >
> > I know the sh architecture probably has been untouched for quite a
> > while,
> Correct ... it's old and probably hasn't seen any real world testing for 
> a long time (I am co-author of the original sh-port).
> IMO, it's amongst the candidates to be considered for removal. discontinued.

I'm just doing some work to port rtems in our sh2 board ...

For Steve:

As Ralf said: nearly surely you need to compile with the rtems toolchain and 
the  memory layout (the linkcmds file )should reflect your hardware memory map.

Stated this, here's the main problems I recall to run "hello.exe" :

Overlap  of the gdbstub working memory by  loading the program.

Disassemble the start address and see if the program is correctly loaded.
depending on your gdbstub implementation, you may need to setup some cpu 
registers to fit the memory configuration before to load the executable.

Alberico Colpo

More information about the users mailing list