RTEMS Coldfire Development Environment on the CESR Control System

Overview

Instrumentation in the CESR control system frequently uses the RTEMS operating system running on the uCdimm Coldfire module uC5282 by Arcturus Networks.
It is based on a Freescale Coldfire MFC5282 processor and integrates RAM, Flash, Ethernet and CAN bus support.

5282pic.jpg

The operating system and BSP used is RTEMS and the toolchain is provided by GNU gcc suite including gdb, binutils and newlib.
The following sections explain how to use the RTEMS development environment to build an example application which can be loaded to the uCdimm module and eventually flashed to ROM.
Note, that currently several versions of RTEMS are installed:

RTEMS 4.9.3 is used for the coldfire modules.
RTEMS 4.10 is used for the MVME5500 boards.
Other versions have not been fully configured and should not be used.

Location of RTEMS installation and setup

The RTEMS toolchains for version 4.9.3 are installed on nodes CESRnnn in the following location:
 /nfs/cesr/online/acc_control/embedded/rtems/rtems-4.9.3/m68k-rtems4.9

To set your environment run the following command, which will source the setup files (or just copy the contents into your personal environment setup) assuming bash shell usage.
For c shell variants the corresponding setup scripts are provided, too.
 source /nfs/cesr/online/acc_control/embedded/rtems/rtems-4.9.3/rtems-m68k-uC5282-Env.sh 

This will add the path:

 /nfs/cesr/online/acc_control/embedded/rtems/rtems-4.9.3/rtems-4.9.3/bin

All executables of the toolchain for the corresponding architecture are in those bin directories and will follow other GNU tools in the path order.

Building applications with RTEMS

For compiling programs for RTEMS 4.9.3 there is an example in
/nfs/cesr/online/acc_control/embedded/rtems/rtems-4.9.3/src/examples/hello_world_c/

which will compile a runnable RTEMS image to be loaded into RAM or being flashed into ROM on the uCdimm Coldfire module.
Copy that directory and its contents into your work area. After sourcing the setup script as mentioned above, the command
gmake

should produce the sub-directory 'o-optimize' containing the following files:

hello.exe  
hello.num
hello.ralf  
test.o

hello.ralf will be the application image to be uploaded.

The relevant libraries and include files for compiling and linking an RTEMS application for the uCdimm module are located in

/nfs/cesr/online/acc_control/embedded/rtems/rtems-4.9.3/m68k-rtems4.9

Building the cbi_net server with RTEMS

User and reference guides for RTEMS

Essential for porting or creating code is the application user guide of the RTEMS project using C language.
For RTEMS version 4.9.3, all user guides and documentation has been installed in
/nfs/cesr/online/acc_control/embedded/rtems/rtems-4.9.3/share 

The networking guide, which is focusing on driver development, can be found here:

BSP User Guides

BSP and architecture specific user guides can be found here:

DIMM Module Environment Variables

The DIMM module needs to be configured for TCP/IP applications.
The TCP/IP parameters are initialized with environment variables and then used by the 'rtems_nvram' function.
The board must be configured by using appropriate values in the following set of commands:

setenv HOSTNAME cbi-cf07
setenv IPADDR0 192.168.1.196
setenv GATEWAY 192.168.1.210 ! use 172.17.0.1 for ERL subnet
setenv NETMASK 255.255.255.0 ! use 255.255.0.0 for ERL subnet
setenv SERVER 192.168.1.80 ! BOOTP server?
setenv NAMESERVER 128.84.47.200 ! or 128.84.46.26
setenv NTPSERVER 128.84.46.171 ! or 128.84.46.26 or 128.84.46.181
setenv BOARD_TYPE 6048-013A ! or 7104-016A
setenv AUTOBOOT 5 !automatically start the application from FLASH after 5 seconds

CESR no longer supports EPICS with RTEMS.

For CBI_NET applications, if the BOARD_TYPE environment variable is not set, it will default to 6048-113, which is the BPM/BSM/XBSM/FLM digital board.

The current valid choices are:

6048-113 for the BPM/BSM/XBSM/FLM DSP Board
7104-016A for the ERL RF DSP Board

Downloading Applications

The compiled and linked executable is placed in the o-optimize subdirectory, with a ".ralf" extension.
This file needs to be transferred to the RAM of the uCdimm module and either flashed to the program ROM or just started from the RAM area.
The easiest way is to do this by using a tftp client.
The bootloader on the uCdimm is able to run a tftp daemon, started by just typing tftp at the boot prompt $B.
From the development host - say "cesr105" - one then starts a tftp client connected to the uCdimm module eg

user@cesr105> tftp 192.168.1.196
tftp> bin
tftp> put hello.ralf

After successful transfer, hit Esc for the tftp daemon on the uCdimm module to disconnect, and "quit" on the tftp client will close the other side.
After that, one can either just start the transferred application from the default RAM address by typing:
B$ goram

or flash the program ROM with the application executable:

B$ program
program
erase... done.
write... done.
B$

Now the application can be started with
B$ go

Setting up Coldfire for a CBPM module

SetupColdfireForCBPM

-- MatthewStedinger - 24 July 2014

Topic attachments
I Attachment Action Size Date Who Comment
bsp_howto.pdfpdf bsp_howto.pdf manage 408 K 10 Nov 2011 - 15:08 UnknownUser RTEMS BSP and Device Driver Development Guide
c_user-3.pdfpdf c_user-3.pdf manage 961 K 18 Jul 2014 - 10:43 UnknownUser  
m68k.pdfpdf m68k.pdf manage 203 K 02 Aug 2006 - 13:15 UnknownUser RTEMS Motorola MC68xxx Applications Supplement
powerpc.pdfpdf powerpc.pdf manage 250 K 02 Aug 2006 - 13:15 UnknownUser RTEMS PowerPC Applications Supplement
rtems-networking.pdfpdf rtems-networking.pdf manage 240 K 10 Nov 2011 - 15:08 UnknownUser RTEMS Networking Guide
rtems_c_user.pdfpdf rtems_c_user.pdf manage 961 K 10 Nov 2011 - 15:11 UnknownUser RTEMS C User Application Guide (PDF format)
This topic: ACC/Bunch > ACC_BunchInstDevelopment > RTEMS
Topic revision: 24 Jul 2014, mgs9
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback