Sponsored By
Efika 5200B Project
RTEMS port for Efika

in category Operating Systems
proposed by kcg on 2nd February 2006 (accepted on 10th February 2006)
Project Summary
Hello,
I'd like to propose doing RTEMS[1] port to Efika. RTEMS is free software real-time OS, which is ported to many architectures including PowerPC (arm/x86/powerpc/mips/m68k etc). What's missing for Efika to work is so called BSP (board support package), which usually mean a lot of tweaking here and there to add support for some board.
Anyway, if Efika is quite cheap for target hardware, I find it ideal for learning basic of OS designs, especially if a lot of OSes will run on it. Here RTEMS comes as a nice and clean implementation/example of RTOS.
Cheers,
Karel

[1] http://www.rtems.com

Project Blog Entries

  Some progress?
posted by kcg on 1st June 2007


Slowly but steadily I'm making some progress on this project. First of all I've enhanced RTEMS build machinery to support building Efika BSP from the gen5200 BSP, so now --enable-rtemsbsp=efika is working. After this I started working on tweaking gen5200 to add some basic support for SmartFirmware and to be honest I'm going the most easiest route and hardwiring a lot of important values directly in the code just to have a port in prototype stage up'n'running. Anyway, I was surprised that well _nothing_ was working at all. :-) Next step was obvious: order few MPC5200 related books from nice Freescale support and wait till the pack arrive and start harder study of this PPC implementation. During that time I've made some experiments with as simple as possible assembler based tests and they were working nicely. So few weeks ago I've jumped again to the RTEMS and tried hard to find out what's going wrong and why RTEMS binary is not working at all, while it provides _exactly_ the same instructions at the beginning as my testing debugging example which is working as expected. For your information since Efika lacks JTAG support, I'm using "debug to the memory" method which is described here in a post by Aymeric Vincent.
And I found the reason. It seems Efika's SFW really refuses to start my RTEMS binary, it seems to be kind of confused by it when it contains following mpc5200 region declaration in its linkcmd file:


MEMORY
{
[...]
mpc5200_regs : org = 0xF0000000, l = 24K
}
SECTIONS
{
[...]
mpc5200_regs :
{
MBAR = .;
mpc5200 = .;
_mpc5200 = .;
. += (0x6000);
} > mpc5200_regs


the purpose of this is to have C struct laid over MPC5200 internal register map. When I remove this and tweak the sources to avoid unresolved symbol errors, I get to the stage where first instructions from the binary are really running well. Perhaps this is just some SFW bug, since the same is running probably well on other MPC5200 boards supported by RTEMS.
  first deadend...
posted by kcg on 15th December 2006


Playing with SmartFirmware I got to the "deadend" :-)

ok dump-chipset
marvel discovery:
cpu_exception:
SRR0 0x0100FA6C SRR1 0x00043030 MSR 0x00003030
LR 0x01004D1C CTR 0x0101A5F0 CR 0x20002084 XER 0x20000000
DAR 0x00000000 DSISR 0x00000000 Type 2
GPR[] 0x01004D10 0x017FFF00 0xFF3EFFF5 0x7C004B78 0x00000004 0x017FEEE0 0x0000000C 0x00000000
GPR[] 0x00000000 0x004B0000 0x00000000 0xFE801110 0x40002084 0xFFFFFBFF 0xFFFFFFDF 0xFA8F7EDE
GPR[] 0xE121DF53 0xFF7FFFEF 0xFEFFEF7F 0xF7CFDBFF 0x08000000 0x6E003039 0x07FFFFFC 0x6E003039
GPR[] 0x00000001 0x00000001 0x00000000 0x00000000 0x017FFF28 0xFFFFF26D 0x07C52BD8 0x07C00008
ibat0U 0x00001FFF ibat0L 0x00000012
ibat1U 0xF0001FFF ibat1L 0xF0000012
ibat2U 0x00000000 ibat2L 0x00000000
ibat3U 0x00000000 ibat3L 0x00000000
dbat0U 0xF0001FFF dbat0L 0xF000002A
dbat1U 0x80001FFF dbat1L 0x8000002A
dbat2U 0x00001FFF dbat2L 0x00000012
dbat3U 0xC0001FFF dbat3L 0xC000002A
HID0 0x0000C000
deadend:
  first startup...
posted by kcg on 14th December 2006


I was just curious if the serial console is really working as promised by Matt from Genesi. Well, yes it is. :-) The screenshot is of wterm running on Debian 3.0/AMD64 box. Inside wterm I'm using minicom to connect to Efika's serial console. By doing this quick experiment (everything assembled directly on the working desk) I've found that (1) my purchased null-modem cable is not the best since it does not provide necessary lines for HW controlled transfer and (2) that my PSU is noisy. I'll probably need to look for some PicoPSU in my neighbourhood.



  Efika received
posted by kcg on 13th December 2006


Many thanks to Genesi and FedEx! I've received the Efika today. I hope to the required shopping (null-modem cable, PSU, etc.) soon to see Efika booting. First I'll need to get some SFW user experience before going to experiment with the RTEMS port on the board. :-)
  first note...
posted by kcg on 17th February 2006


I'm glad to see RTEMS port to Efika was choosen to be supported by Genesi/Freescale. From the several looks into the RTEMS CVS sources, it seems I will need to enhance generic BSP for MPC5200 adding support for 5200B version and most importantly hack booting process to hook into the Efika's OpenFirmware. I prefer #ifdefing gen5200 BSP because of heavy code reuse and why is this bsp called ``generic'' 5200 then? :-)
So in the meantime while waiting for Efika to be delivered to my location, I'm playing with RTEMS's internals configuration just to get an idea how to add virtual BSP using gen5200 BSP.

Karel
Genesi Network: Genesi - Main Site Power2People PowerDeveloper