R. Diez | 4 Jun 2012 21:10
Picon
Favicon

How to build a simple eCos demo app with a serial console shell

Hi all:

I have added to the orbuild framework the necessary steps to download and build eCos and test it under the
or1ksim simulator with a very simple test case.

The next step would be to write more complicated tests and to check out the new eCos ethernet driver too.

I would like to have some simple eCos-based demo app which provides a shell over a serial port. I wish to run it
under the simulator and be able to interactively type commands like "ping" and maybe set the IP address and
so on.

Is there such a simple demo app for eCos somewhere, and if not, how can I build one with minimum effort? I have
no experience whatsoever with eCos and I wouldn't want to invest much time learning it at the moment. I
tried with google and I also looked at the eCos documentation, but I couldn't find an easy shell demo app. I
saw in the newsgroups some people asking for an interactive shell a while back.

I had a quick look at the default ecos.ecc for the ORPSoC platform, it looks like there are (or there can be) 2
serial ports, one for a GDB connection and one for a diagnostics console. Can someone tell me the short
'ecosconfig' magic in order to add a bidirectional serial port for the new interactive debug console?

If eCos doesn't cut it, what other embedded OS would you recommend for OpenRISC in order to interactively
help test the ethernet connection?

Thanks,
  rdiez
Peter Skrzypek | 4 Jun 2012 21:35
Picon

Re: How to build a simple eCos demo app with a serial console shell

Hello

The shortest way to achieve it is to build RedBoot. RedBoot provides a 
nice console with history. It works over UART and Ethernet. To build 
RedBoot for ORPSoC (with ethmac driver):

ecosconfig new orpsoc redboot
ecosconfig add CYGPKG_IO_ETH_DRIVERS
#Here you can optionally adjust ecc file
ecosconfig tree
make

The elf binary is built here:
install/bin/redboot.elf

By default, RedBoot tries to get IP over DHCP. It is possible to 
interrupt this and set IP manually. You can change this behavior by 
editing the ecc file (either manually or via configtool). If you want to 
adjust some other parameters, like baud rate, bus frequency, 
hardware/software math etc., you also need to do it in the ecc file.

Please let me know if you have any other problems

Best regards
Piotr

W dniu 2012-06-04 21:10, R. Diez pisze:
> Hi all:
>
>
(Continue reading)

R. Diez | 8 Jun 2012 19:59
Picon
Favicon

Re: How to build a simple eCos demo app with a serial console shell

Hallo Piotr:

 > The shortest way to achieve it is to build RedBoot.
 > [...]

Thanks for your  help.

The first thing I wanted to do is to see redboot's serial console. This 
is the serial port I have configured in the or1ksim simulator:

section uart
   enabled  = 1
   baseaddr = 0x90000000
   irq      = 2
   16550    = 1
   /* channel  = "xterm:" */
   channel = "tcp:10084"
end

I couldn't work out how to configure the serial port in redboot, can you 
help? The magical "ecosconfig add" command would be ideal.

There seem to be 2 serial ports in the redboot configuration, one for 
GDB and another one probably for the console. I guess the baud rate and 
so on don't really matter when running in a simulator.

I didn't see the serial port's base address 0x90000000 anywhere in the 
ecos.ecc file. The Ethernet controller's base address is normally 
0x92000000, but I couldn't find that address either in the configuration 
file.
(Continue reading)

Piotr Skrzypek | 8 Jun 2012 20:28
Picon

Re: How to build a simple eCos demo app with a serial console shell

Hello

W dniu 2012-06-08 19:59, R. Diez pisze:
> Hallo Piotr:
>
>  > The shortest way to achieve it is to build RedBoot.
>  > [...]
>
> Thanks for your help.
>
> The first thing I wanted to do is to see redboot's serial console. This
> is the serial port I have configured in the or1ksim simulator:
>
> section uart
> enabled = 1
> baseaddr = 0x90000000
> irq = 2
> 16550 = 1
> /* channel = "xterm:" */
> channel = "tcp:10084"
> end
>
>
> I couldn't work out how to configure the serial port in redboot, can you
> help? The magical "ecosconfig add" command would be ideal.

By default, one serial port is enabled. The parameters are as follows: 
115200 8N1. It is possible to change the baud rate in the ecc file. 
RedBoot's console is attached to this port. That should work out of the 
box. Your UART configuration in or1ksim is OK.
(Continue reading)

R. Diez | 10 Oct 2012 20:52
Picon
Favicon

eCos assumes R0 is zero on start-up

Hi Piotr:

I am trying to get eCos up and running on my OR10 CPU, which does not 
have jump delay slots. I'm starting with a Redboot test project that I 
was playing with some months ago.

I noticed that routine FUNC_START(start) in vectors.S assumes that R0 is 
initialised to zero on start-up, which is not always the case.

Could you add the following instruction before "l.ori r3,r0,SPR_SR_SM" 
in that function?

   l.movhi	r0, 0

If you're still maintaining the eCos port I'll post a few other minor 
issues I've seen so far.

Thanks,
   rdiez

Piotr Skrzypek | 10 Oct 2012 22:35
Picon

Re: eCos assumes R0 is zero on start-up

Hello,

Thanks for spotting that, indeed, the reset vector routine does not set 
R0 to zero. I will correct that. All other issues are more than 
welcomed! If you can send them before the weekend we can mention them on 
the project meeting.

I think we could add a configuration option for eCos to build code 
without delay slots. Diffs describing your modifications will help a lot 
if you could be so kind and share them.

Best regards!
Piotr

W dniu 2012-10-10 20:52, R. Diez pisze:
> Hi Piotr:
>
> I am trying to get eCos up and running on my OR10 CPU, which does not
> have jump delay slots. I'm starting with a Redboot test project that I
> was playing with some months ago.
>
> I noticed that routine FUNC_START(start) in vectors.S assumes that R0 is
> initialised to zero on start-up, which is not always the case.
>
> Could you add the following instruction before "l.ori r3,r0,SPR_SR_SM"
> in that function?
>
>    l.movhi    r0, 0
>
> If you're still maintaining the eCos port I'll post a few other minor
(Continue reading)

R. Diez | 11 Oct 2012 13:20
Picon
Favicon

Re: eCos assumes R0 is zero on start-up


> Thanks for spotting that, indeed, the reset vector routine does not set 
> R0 to zero. I will correct that. All other issues are more than 
> welcomed! If you can send them before the weekend we can mention them on 
> the project meeting.

Good, let's start with redboot_linux_exec.c . I've rewritten the "asm volatile" section so that it's
compatible with CPUs with and without jump delay slots, please see the attached file. I hope you don't mind
the small performance loss. I've added some comments and done some reformatting in order to make the code
easier to understand. I haven't managed to make Redboot work yet, so I think you should review any changes
carefully and maybe test them locally.

Other than that, I've only made changes to vectors.S , I didn't see any other hand-writen assembly code that
used jump delay slots. I'll post about that later on in a separate e-mail.

> I think we could add a configuration option for eCos to build code 
> without delay slots. Diffs describing your modifications will help a lot 
> if you could be so kind and share them.

I'm going to need some help here. I believe there is no easy way to set eCos configuration options from the
command line, or is there? I'm building eCos automatically (with a build script that starts from scratch,
downloading a fresh source repository). I could generate a default configuration file and then patch it,
but maintaining such patches is pain. Is there a way to pass CFLAGS from outside, or do they get overwritten
by CYGBLD_GLOBAL_CFLAGS? I need to use Peter Gavin's toolchain with -mcompat-delay . I also had to modify
packages/hal/openrisc/orpsoc/current/cdl/hal_openrisc_orpsoc.cdl ,
CYGBLD_GLOBAL_COMMAND_PREFIX, as Peter Gavin's toolchain uses "or1k-elf" instead of "or32-elf".

Thanks,
  rdiez
(Continue reading)

Stefan Kristiansson | 5 Jun 2012 06:30
Picon
Picon
Favicon

Re: How to build a simple eCos demo app with a serial console shell

On Mon, Jun 04, 2012 at 08:10:18PM +0100, R. Diez wrote:
> Hi all:
> 
> 
> I have added to the orbuild framework the necessary steps to download and build eCos and test it under the
or1ksim simulator with a very simple test case.
> 
> The next step would be to write more complicated tests and to check out the new eCos ethernet driver too.
> 
> I would like to have some simple eCos-based demo app which provides a shell over a serial port. I wish to run
it under the simulator and be able to interactively type commands like "ping" and maybe set the IP address
and so on.
> 
> Is there such a simple demo app for eCos somewhere, and if not, how can I build one with minimum effort? I have
no experience whatsoever with eCos and I wouldn't want to invest much time learning it at the moment. I
tried with google and I also looked at the eCos documentation, but I couldn't find an easy shell demo app. I
saw in the newsgroups some people asking for an interactive shell a while back.
> 
> I had a quick look at the default ecos.ecc for the ORPSoC platform, it looks like there are (or there can be) 2
serial ports, one for a GDB connection and one for a diagnostics console. Can someone tell me the short
'ecosconfig' magic in order to add a bidirectional serial port for the new interactive debug console?
> 
> If eCos doesn't cut it, what other embedded OS would you recommend for OpenRISC in order to interactively
help test the ethernet connection?
> 

An alternative option would be to use u-boot.
In git://openrisc.net/stefan/u-boot there is a generic
board called openrisc-generic, which has ethernet support and is meant to be run
under or1ksim.
(Continue reading)


Gmane