Home
RCC User`s Manual - Aeroflex Gaisler
Contents
1. 16 RCC User s Manual gt DEV 0x400fd558 GAISLER ETHMAC gt DEV 0x400fd5b0 GAISLER_SATCAN gt DEV 0x400fd608 GAISLER_SPW2 gt DEV Ox400fd660 GAISLER_SPW2 gt DEV Ox400fd6b8 GAISLER_SPW2 gt DEV Ox400fd710 GAISLER_SPW2 gt DEV Ox400fd768 GAISLER_SPW2 gt DEV Ox400fd7c0 GAISLER_SPW2 gt DEV 0x400fd818 GAISLER_B1553BRM gt DEV Ox400fd870 GAISLER_GRTC gt DEV Ox400fd8c8 GAISLER_GR gt DEV 0x400fd920 GAISLER_SLINK DEV 0x400fd978 GAISLER FTMCTRL gt DEV 0x400fd9d0 GAISLER APBMST gt DEV 0x400fda28 GAISLER LEON3DSU DEV 0x400fda80 GAISLER APBMST gt DEV 0x400fdb30 GAISLER_CANAHB gt DEV 0x400fdad8 GAISLER_CANAHB gt DEV 0x400fdb88 GAISLER_FTAHBRAM gt DEV 0x400fdbe0 GAISLER_APBUART gt DEV 0x400fdc38 GAISLER IROMP DEV 0x400fdc90 GAISLER GPTIMER gt DEV 0x400fdce8 GAISLER SPICTRL gt DEV Ox400fdd40 GAISLER CANMUX gt DEV 0x400fdd98 NO NAME gt DEV Ox400fddf0 GAISLER ASCS DEV 0x400fde48 GAISLER GPIO gt DEV O0x400fdea0 GAISLER GPIO DEV 0x400fdef8 GAISLER I2CMST gt DEV 0x400fdf50 GAISLER_CLKGATE gt DEV 0x400fdfa8 GAISLER AHBSTA gt DEV 0x400fe000 GAISLER APBUART gt DEV 0x400fe058 GAISLER APBUART gt
2. text at 0x40000000 size 92096 bytes section data at 0x400167c0 size 2752 bytes total size 94848 bytes 339 7 kbit s read 463 symbols entry point 0x40000000 grlib gt run Hello World grlib gt Note that the program was started from address 0x40000000 the default start address GRMON can also be used to program the boot PROM image created by sparc rtems mkprom into the target s flash PROM grmon grlib gt flash unlock all grmon grlib gt flash erase all Erase in progress Block 0x00000000 code 0x00800080 OK Block 0x00004000 code 0x00800080 OK grmon grlib gt flash load prom out section text at 0x0 size 54272 bytes total size 54272 bytes 93 2 kbit s read 45 symbols grmon grlib gt flash lock all When boot PROM is run i e after reset it will initialize various LEON registers unpack the application to the RAM and start the application The output on console when running hello world from PROM is shown below MkProm LEON3 boot loader v1 2 Copyright Gaisler Research all right reserved System clock 40 0 MHz baud rate 38352 baud AEROFLEX GAISLER RCC 1 2 0 prom 512 K 2 2 ws r w sram 1024 K 1 bank s 0 0 ws r w decompressing text decompressing data starting rtems hello Hello World The application must be re loaded with the load command before it is possible to re execute it When running multiple RTEMS programs on a multiprocessing syst
3. RCC supports multi tasking real time C C programs based on the RTEMS kernel Compiling and linking is done in much the same manner as with a host based gcc 2 2 sparc rtems gcc options The gcc compiler has been modified to support the following addtional options qleon2 generate LEON2 executable without driver manager startup initialization tsc691 generate ERC32 executable qleon3 generate LEON3 4 executable default if no other option given qleon3std generate LEON3 4 executable without driver manager startup initialization qleon3mp generate LEON3 4 Multiprocessor executable AMP qngmp use NGMP linker script instead of default Can be used in conjunction with qleon3 qleon3str and qleon3mp The RAM address is set to 0 instead of 0x40000000 Other usefull standard options are g generate debugging information must be used for debugging with gdb msoft float emulate floating point must be used if no FPU exists in the system mcpu v8 generate SPARC V8 mul div instructions only for LEON with hardware multiply and divide configured mtune ut699 sets UT699 specific parameters 02 optimize code should be used for optimum performance and minimal code size Other gcc options are explained in the gcc manual gcc pdf 2 3 RTEMS applications To compile and link an RTEMS application use sparc rtems gcc Sparc rtems gcc g 02 rtems hello c o rtems hello RCC creates executables for LEON3 4 by de
4. 0x40000000 size 92096 bytes section data addr 0x400167c0 size 2752 bytes read 463 symbols tsim go resuming at 0x40000000 Hello World Program exited normally tsim 3 2 GRMON GRMON is used to download run and debug LEON2 3 software on target hardware For full details on how to use GRMON see the GRMON User s Manual Below is a simple example that shows how the hello world program is downloaded and run grmon u jtag GRMON LEON debug monitor v1 1 11 Copyright C 2004 2005 Gaisler Research all rights reserved For latest updates go to http www gaisler com Comments or bug reports to support gaisler com using JTAG cable on parallel port JTAG chain xc3s1500 xcf04s xcf04s inbblallslHg wawa win Goa detected frequency 41 MHz GRLIB build version 1347 AEROFLEX GAISLER RCC 1 2 0 Component Vendor LEON3 SPARC V8 Processor Gaisler Research AHB Debug UART Gaisler Research AHB Debug JTAG TAP Gaisler Research GR Ethernet MAC Gaisler Research EON2 Memory Controller European Space Agency AHB APB Bridge Gaisler Research EON3 Debug Support Unit Gaisler Research Nuhorizons Spartan3 I O interfac Gaisler Research OC CAN controller Gaisler Research Generic APB UART Gaisler Research ulti processor Interrupt Ctrl Gaisler Research odular Timer Unit Gaisler Research Use command info sys to print a detailed report of attached cores grlib gt lo rtems hello section
5. C Library libm pdf Newlib Math Library RTEMS manuals bsp howto pdf SP and Device Driver Development Guide C User s Guide this is the one you want SPARC CPU Application Supplement Development environment guide Filesystem Design Guide ITRON 3 0 User s Guide Network Supplement Newly added features Porting Guide POSIX 1003 1 Compliance Guide POSIX API User s Guide Release Notes ting Started with RTEMS for C C Users c user pdf cpu supplement pdf develenv pdf filesystem pdf itron pdf networking pdf new chapters pdf porting pdf posix1003 1 pdf posix users pdf relnotes pdf started pdf ANNNNnNNNHNNNN C JJ UJ zd zd Jj Jj JU uw Uu 0 ct td td td td td td td td td td te The documents are all provided in PDF format with searchable indexes 1 6 Support The RCC compiler system is provided freely without any warranties Technical support can be obtained from Aeroflex Gaisler through the purchase of a technical support contract See www gaisler com for more details AEROFLEX GAISLER RCC User s Manual 2 Using RCC 2 1 General development flow Compilation and debugging of applications is typically done in the following steps 1 Compile and link program with gcc 2 Debug program using a simulator gdb connected to TSIM GRSIM 3 Debug program on remote target gdb connected to GRMON 4 Create boot prom for a standalone application with mkprom2
6. CASA UMAC SMAC instructions RTEMS 4 10 C C real time kernel with LEON2 LEON3 LEON4 and ERC32 support Newlib 1 18 0 standalone C library GDB 6 8 SPARC cross debugger 1 2 Installation on host platform 1 2 1 Host requirements RCC is provided for two host platforms linux x86 and MS Windows The following are the platform system requirements Linux Linux 2 6 x glibc 2 11 1 or higher Windows MSYS 1 0 10 or higher In order to recompile the RTEMS kernel sources automake 1 11 1 and autoconf 2 68 is required MS YS DTK 1 0 1 is needed on Windows platforms to build autoconf and automake The sources of automake and autoconf can be found on the GNU ftp server ftp ftp gnu org gnu autoconf ftp ftp gnu org gnu automake MSYS and MSYS DTK can be found at http www mingw org 1 2 2 Installing RCC on Windows platforms The toolchain installation zip file sparc rtems 4 10 gcc 4 4 x 1 2 x mingw zip must be extracted to C opt creating the directory C opt rtems 4 10 mingw The toolchain executables can be invoked from the command prompt by adding the executable directory to the PATH environment variable The directory C opt rtems 4 10 mingw bin can be added to the PATH variable by selecting My Computer gt Properties gt Advanced gt Environ ment Variables Development often requires some basic utilities such as make but is not required to compile on Windows plat forms the MSYS Base system can be installed to get a b
7. an xterm shell First launch the cygwin X server by issuing startx in a cygwin shell and the launch DDD in the newly created xterm shell AEROFLEX GAISLER
8. rtems g parc rtems gcc parc rtems gcov parc rtems gdb parc rtems gprof parc rtems ld parc rtems nm parc rtems objcopy parc rtems objdump parc rtems ranlib parc rtems readelf parc rtems size parc rtems strings parc rtems strip S S S S S S S S S S S S S S S S S S S S Convert address to C C line number C The Same as sparc rtems c Library archiver Cross assembler cross compiler Utility to demangle C symbols C preprocessor C C cross compiler Coverage testing tool Debugger Profiling utility GNU PGGG iF GGG linker tility to print symbol table tility to convert between binary formats tility to dump various parts of executables ibrary sorter file information utility tility to display segment sizes tility to dump strings from executables tility to remove symbol table AEROFLEX GAISLER RCC User s Manual 1 5 Documentation The RCC and GNU documentation are distributed together with the toolchain it consists of RTEMS manuals and GNU tools manuals localted in the doc directory of the toolchain The drivers are documented in a sepa rate drivers document GNU manuals as pdf Using as the GNU assembler binutils pdf The GNU binary utilities cpp pdf The C Preprocessor gcc pdf Using and porting GCC gdb pdf Debugging with GDB gprof pdf the GNU profiling utility ld pdf The GNU linker Newlib C library libc pdf Newlib
9. when the driver manager is initialized on startup whereas the standard drivers are included automatically by the standard qleon3std BSP setup 2 8 3 Driver configuration In the past the driver resources were often a string interpreted by the driver passed into the DRIVER_register function Since the register functions have been replaced the driver resource format has also been changed it is now described by an array of different data types which are assigned names for flexibility The name is searched for by the driver once started if found the value replaces the default value internal to the driver The driver uses a driver resource API to easily extract the information The resources are provided by the bus driver it is up to the bus driver how the resources are assigned to the bus the LEON bus drivers use a default weak array that can be overridden by the project configuration The driver parameters are documented separately for each driver in the driver manual The example below sets up GRSPWO and GRSPWI descriptor count driver resources for the AMBA Plug amp Play bus on two different GR RASTA IO PCI boards and the root bus ROOT AMBA PnP Bus GRSPWO and GRSPW1 resources struct drvmgr key grlib_grspw0l_res txDesc KEY TYPE INT unsigned int 32 rxDesc KEY TYPE INT unsigned int 32 KEY_EMPTY If RTEMS DRVMGR STARTUP is defined we override th weak defaults
10. DEV 0x400fe0b0 GAISLER APBUART gt DEV 0x400fel08 GAISLER_APBUART gt DEV 0x400fe160 GAISLER_APBUART gt DEV Ox400felb8 GAISLER_GRTIMER drvmgr info 0x400fdbe0 DEVICE 0x400fdbe0 PARENT BUS Ox400fd408 NAME GAISLER_APBUART STATE 0x00000100 INI EVEL 4 ERROR 0 MINOR BUS 0 MINOR DRV 0 DRIVER 0x400a2198 APBUART_DRV PRIVATE 0x400fe210 DEVICE INFO FROM BUS DRIVER AMBA PnP DEVICE VENDOR ID 0x0001 VENDOR GAISLER DEVICE ID 0x000c GAISLER APBUART IRQ 2 VERSION 0x1 AEROFLEX GAISLER eds RCC User s Manual ambapp core 0x400fdclc interfaces APBSLV APBSLV FREQ 80000kHz apb 0x80000100 0x800001ff DEVICE INFO FROM DEVICE DRIVER UART Mode TERMIOS POLLED STATUS REG 0x100082 CTRL REG 0x80000803 SCALER REG 0x103 baud rate 38610 2 9 Network configuration The LEON2 3 BSPs support two network devices the Aeroflex Gaisler GRETH MAC and the LAN91C111 The GRETH driver comes in two editions one that needs the driver manager in libbsp to operate and the standard driver in libchip The driver manager dependent GRETH driver adds the network interface automatically to the rtems bsdnet config network interface configuration using network interface add function The LAN91C111 chip cannot be found by plug and play so it has to be manually set up by either hardcoding an entry in the rtems bsdnet config interface list or dy
11. LEON debug monitor v1 1 22 Copyright C 2004 2005 Gaisler Research all rights reserved For latest updates go to http www gaisler com Comments or bug reports to support gaisler com grlib lo nodel exe section text at 0x60000000 section data at 0x60023100 total size 146816 bytes 174 read 852 symbols entry point 0x60000000 grlib lo node2 exe section text at 0x60100000 section data at 0x60123100 total size 146816 bytes 172 read 852 symbols entry point 0x60100000 grlib gt cpu act 0 active cpu O0 grlib ep 0x60000000 entry point 0x60000000 grlib stack O0x600 00 stack pointer 0x600fff00 grlib cpu act 1 active cpu 1 grlib ep 0x60100000 entry point 0x60100000 grlib stack 0x601fff00 stack pointer 0x601fff00 grlib gt cpu act 0 active cpu 0 grlib gt run size 143616 bytes size 3200 bytes 4 kbit s size 143616 bytes size 3200 bytes 7 kbit s RTEMS MP applications can not be run directly in GRSIM using load and run commands Instead a boot image containing several RTEMS MP applications should be created and simulated 2 13 1 MP testsuite The MP testsuite is located in the sources under testsuite mptests it requires modifications to the make scripts in order to select a unique image RAM location The default shared memory area is at 0x40000000 Ox40000fff the two images for nodel and node2 needs to be located on a unique address and the heap stack mu
12. RCC 1 2 0 RCC User s Manual Versi n 5 October 2010 AEROFLEX GAISLER RCC User s Manual Copyright 2011 Aeroflex Gaisler Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one Permission is granted to copy and distribute translations of this manual into another language under the above conditions for modified versions AEROFLEX GAISLER RCC 1 2 0 1 MiiroduEUoN akc AE Ot ea SEA 4 1 1 LE juli r WRECZ 4 1 2 Installation on host platform aaa Nana 4 1 2 1 Dn ia appka asioissa Eko AAAA 4 1 2 2 Installing RCC on Windows platforms eee 4 1 2 3 Installing on Linux platforms reren 6 1 3 Contents of opt rtems 4 10 aoi an oo n 7 1 4 Je Sc cg zak C 7 1 5 POSUNIE T A101 m Cr M 8 1 6 Dh E A 8 2 Using RCC iiini aiiora EE 9 2 1 General development TOW nnee a OLE 9 2 2 sparc rtems gcc Options ersten iten eraann prece enini va 9 2 3 RIEMS applications inienn ieee eis tet aoe 9 2 4 Floating point considerations wwa Ac v 10 2 5 LEON SPARC V8 instru
13. _ADR Info about a PCI RAM Device AEROFLEX GAISLER RCC 1 2 0 pci help pci SYSTEM UNKNOWN UNINITIALIZED CFG LIBRARY AUTO NO PCI BUSES 0 buses PCI ENDIAN Little MACHINE ENDIAN Big 2 11 Making boot proms RTEMS applications are linked to run from beginning of RAM To make a boot PROM that will run from the PROM on a standalone target use the mkprom2 utility freely available from www gaisler com The mkprom utility is documented in a separate document that is distributed together with the mkprom2 utility Mkprom will create a compressed boot image that will load the application into RAM initiate various processor regis ters and finally start the application Mkprom will set all target dependent parameters such as memory sizes waitstates baudrate and system clock The applications do not set these parameters themselves and thus do not need to be re linked for different board architectures The example below creates a LEON3 boot prom for a system with 1 Mbyte RAM one waitstate during write 3 waitstates for rom access and 40 MHz system clock For more details see the mkprom manual mkprom2 ramsz 1024 ramwws 1 romws 3 hello ex freq 40 hello ex Note that mkprom creates binaries for LEON2 3 and for ERC32 select processor type with the mkprom options leon3 leon2 or erc32 flag To create an SRECORD file for a prom programmer use objcopy Sparc rtems objcopy O srec rtems hello rtems hell
14. asic UNIX like development environment including make The RTEMS sources rely on the autoconf and automake utilities to create Makefiles The MSYS Base AEROFLEX GAISLER RCC User s Manual system doesn t include the required version of autoconf and automake instead they can be compiled from sources as described below 1 2 2 1 Installing MSYS The MSYS package can be freely downloaded from http www mingw org it comes as an self extracting installation application MSYS 1 0 10 exe The following text assumes the MSYS has been successfully installed to C msys The directory where the toolchain is installed C opt rtems 4 10 mingw must be found in opt rtems 4 10 mingw from the MSYS environment this can done by adding an mount entry similar to one of the examples below to the etc fstab file in the MSYS environment C opt rtems 4 10 mingw opt rtems 4 10 mingw or C opt opt The path to the toolchain binaries C opt rtems 4 10 mingw bin must added to the MSYS PATH environment variable Below is an example of how to change the PATH variable in the MSYS shell export PATH opt rtems 4 10 mingw bin PATH The toolchain installation can be tested by compiling the samples included in the toolchain cd opt rtems 4 10 mingw src samples make 1 2 2 2 Installing RTEMS source Installing the RTEMS kernel sources are optional but recommended when debugging applications The tool chain libraries are built with debugging symb
15. ctions i oed hondu aka 10 2 6 NIEMOCY OFEGNISANONG aa aa das 10 2 7 Board support packages BSPS a A GO A O 11 24d EBONI BSP netten EEE E E AEE 11 2 8 Diver MOIBEBE dosi iudicio ananas 11 P XML E EERE EEE 12 2020 a PER mmm 12 285 cqui 13 prm drvmer COMMAND errans eenieder en 15 2 9 Network configuration EA cas detentie en derne 17 210 or 17 2 11 M king b ot Proms stenen bide 18 2 12 Simple exariples ui e Epic e Eod aE Midi nM Hd pe bM aes 18 2 13 Multiproc ssin g aaan la bus Ea Aka 18 213A MP ISSUE TD EO A AR 20 3 Execution and debugging opad GA eenen EE 21 3 1 TSIM eneen eeen ete 21 32 GEMO wear GWO dz O daden 21 3 3 GDB with GRMON and TSIM eoessewsece eo iE tend AGA GALE AEO 23 3 4 Using DDD graphical front end to gdb enen 24 AEROFLEX GAISLER RCC User s Manual 1 Introduction 1 1 General This document describes the RTEMS LEON ERC32 GNU cross compiler system RCC Discussions are pro vided for the following topics e installing RCC contents and directory structure of RCC compiling and linking LEON and ERC32 RTEMS applications usage of GRMON debugging application with GDB RCC is a multi platform development system based on the GNU family of freely available tools with addi tional point tools developed by Cygnus OAR and Aeroflex Gaisler RCC consists of the following packages GCC 4 4 6 C C compiler GNU binary utilities 2 20 1 with support for LEON
16. de lt rtems h gt define CONFIGURE_INIT include lt bsp h gt Standard RTEMS setup define CONFIGURE APPLICATION NEEDS CONSOLE DRIVER define CONFIGURE APPLICATION NEEDS CLOCK DRIVER define CONFIGURE RTEMS INIT TASKS TABLE define CONFIGURE MAXIMUM DRIVERS 32 include lt rtems confdefs h gt Driver manager setup if defined RTEMS DRVMGR STARTUP if drvmgr was given to configure gleon3 qleon3mp include GPTIMER and APBUART drivers that rely on the driver manager ay define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART endif define CONFIGURE_DRIVE define CONFIGURE_DRIVE define CONFIGURE_DRIVE define CONFIGURE DRIVE define CONFIGURE DRIVE define CONFIGURE DRIVE AMBAPP GAISLER GRETH AMBAPP GAISLER GRSPW AMBAPP GAISLER GRCAN AMBAPP GAISLER OCCAN AMBAPP MCTRL AMBAPP GAISLER PCIF Aj aj Wu AEROFLEX GAISLER 13 RCC User s Manual define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRPCI define CONFIGURE_DRIVER_PCI_GR_RASTA_IO define CONFIGURE_DRIVER_PCI_GR_RASTA_TMTC define CONFIGURE_DRIVER_PCI_GR_701 include lt drvmgr drvmgr_confdefs h gt The timer and console driver must be included
17. e toolchain includes a precompiled LEON3 MP kernel in rtems 4 10 sparc rtems leon3mp it is the LEON3 BSP compiled with multiprocessing support The MP kernel is selected when the qleon3mp argument is given to sparc rtems gcc Since each CPU executes its own program image a memory area has to be allocated for each CPU s program image and stack This is achieved by linking each CPU s RTEMS program at the start addresses of the CPU s memory area and setting stack pointer to the top of the memory area E g for two CPU system the application running on CPU 0 could run in memory area 0x40100000 Ox401fffff while CPU 1 runs in memory area 0x4020000 Ox402fffff Shared Memory Support Driver allocates 4 KB buffer at address 0x40000000 for mes sage passing this area can not be used for applications Each CPU requires its own set of standard peripherals such as UARTS and timers In an MP system the BSP will automatically allocate UART 1 and GPT 0 timer 1 to CPU 0 UART 2 and GPT 0 timer 2 to CPU 1 and so on When the default configuration does not meet the requirements or hardware setup a custom resource alloca tion can be setup using the driver manager see below The shared memory driver s default memory layout configuration can be overidden without recompiling the kernel The default settings are set in the variable weak variable BSP_shm_cfgtbl it can be overridden by defining BSP_shm_cfgtbl once in the project as in the below example The parame
18. em entry point and stack pointer have to be set up individually for each CPU E g when running appl exe link address 0x40100000 on CPUO and app2 exe link address 0x40200000 on CPU1 grlib gt lo appl exe grlib gt lo app2 exe grlib gt cpu act 0 grlib gt ep 0x40100000 grlib gt stack 0x401 00 grlib gt cpu act 1 grlib gt ep 0x40200000 grlib stack 0x402fff00 grlib gt cpu act 0 grlib gt run 3 3 GDB with GRMON and TSIM To perform source level debugging with gdb start TSIM or GRMON with gdb or enter the gdb command at the prompt Then attach gdb by giving command tar extended remote localhost 2222 to gdb when connect ing to GRMON or tar extended remote localhost 1234 when connecting to TSIM Note that RTEMS applica tions do not have a user defined main function as ordinary C programs Instead put a breakpoint on Init which is the default user defined start up function jupiter gt sparc rtems gdb rtems hello GNU gdb 6 7 1 Copyright C 2007 Free Software Foundation Inc License GPLv3 GNU GPL version 3 or later lt http gnu org licenses gpl html gt This is free software you are free to change and redistribute it There is NO WARRANTY to th xtent permitted by law Type show copying and show warranty for details This GDB was configured as host i686 pc linux gnu target sparc rtems gdb tar extended remote localhost 2222 Remote debugging using localhost 2222 gdb load Loading
19. fault To generate executables for LEON2 or ERC32 add qleon2 or tsc691 switches during both compile and link stages The default load address is start of RAM i e AEROFLEX GAISLER 10 RCC User s Manual 0x40000000 for LEON2 3 4 and 0x2000000 for ERC32 Other load addresses can be specified through the use of the Ttext option see gcc manual See qngmp option above for systems with RAM at address 0 RCC uses the sources of RTEMS 4 10 with minor patches and allows recompilation if a modification has been made to a bsp or the kernel Install the RTEMS sources in opt rtems 4 10 src and re compile and install with ed opt rtems 4 10 src make install 2 4 Floating point considerations If the targeted processor has no floating point hardware then all applications must be compiled and linked with the msoft float option to enable floating point emulation When running the program on the TSIM simu lator the simulator should be started with the nfp option no floating point to disable the FPU 2 5 LEON SPARC V8 instructions LEON2 LEON3 and LEON4 processors can be configured to implement the SPARC V8 multiply and divide instructions The RCC compiler does by default NOT issue those instructions but emulates them trough a library To enable generation of mul div instruction use the mcpu v8 switch during both compilation and linking The mcpu v8 switch improves performance on compute intensive applications and floating point emu
20. ke 1 11 1 build cd automake 1 11 1 build configure prefix usr make make install automake 1 11 1 has been installed gt exit After installing automake and autoconf it may be required to restart the MSYS shell Once the tools required by RTEMS source tree has been installed and the MSYS shell has been restarted the installed RTEMS sources can be built manually or using the prepared Makefile available at C opt rtems 4 10 mingwisrciMakefile The build process is divided in four steps in the first step the make scripts are generated this step is called bootstrap The bootstrapping can be done with the make target boot as the examples shows below The bootstrap step is only needed to be rerun when adding or removing files from the source tree cd opt rtems 4 10 mingw src make bootstrap The second step configures a build environment in opt rtems 4 10 mingw src build make configure The third and fourth steps compile and install the new kernel to opt rtems 4 10 mingw sparc rtems make compile make install 1 2 3 Installing on Linux platforms The RCC directory tree is compiled to reside in the opt rtems 4 10 directory on all platforms After obtaining the bzipped tarfile with the binary distribution uncompress and untar it in a suitable location if this is not opt rtems 4 10 then a link have to be created to point to the location of the RCC directory The distribution can be installed with the fol
21. lation LEON2 3 4 also supports multiply and accumulate MAC The compiler will never issue those instructions they have to be coded in assembly Note that the RCC assembler and other utilities are based on a modified ver sion of GNU binutils 2 20 1 that supports the LEON MAC instructions 2 6 Memory organisation The resulting RTEMS executables are in elf format and has three main segments text data and bss The text segment is by default at address 0x40000000 for LEON2 3 4 and 0x2000000 for ERC32 followed immedi ately by the data and bss segments The stack starts at top of ram and extends downwards Standalone App Top Of RAM Startup Stack Heap 0X40000000 Figure 1 RCC RAM applications memory map AEROFLEX GAISLER zT11 RCC User s Manual The SPARC trap table always occupies the first 4 Kbytes of the text segment 2 7 Board support packages BSPs RCC includes board support packages for LEON2 LEON3 and ERC32 LEON4 is supported by the LEON3 BSP BSPs provide interface between RTEMS and target hardware through initialization code specific to target processor and a number of device drivers Console and timer drivers are supported for all processors LEON and ERC32 BSPs assume a default system resource configuration such as memory mapping of on chip devices and usage of interrupt resources LEON3 4 systems are based on GRLIB plug amp play configuration and are thereby highly configurable regardi
22. lowing commands cd opt bunzip2 c sparc rtems 4 10 gcc 4 4 x 1 2 x linux tar bz2 tar xf After the compiler is installed add opt rtems 4 10 bin to the executables search path and opt rtems 4 10 man to the man path AEROFLEX GAISLER RCC User s Manual 1 2 3 1 Installing RTEMS source The RTEMS sources used to compile the SPARC BSPS included in RCC is prepared to be installed into opt rtems 4 10 src it can be done as follows cd opt rtems 4 10 src tar jxf path to sparc rtems 4 10 1 2 x tar bz2 1 2 3 2 Building RTEMS from sources The RTEMS libraries found in opt rtems 4 10 sparc rtems BSP can be built from the sources using the Make file found in opt rtems 4 10 src The RTEMS build environment assumes that autoconf 2 68 and automake 1 11 1 are installed Documentation on how to install autoconf and automake is included in respective source and an example can be found above in section 1 2 2 3 1 3 Contents of opt rtems 4 10 The created rtems directory has the following sub directories bin Executables doc RCC and GNU documentation include Host includes lib Host libraries make RTEMS make scripts man an pages for GNU tools sparc rtems Sparc target libraries sre Various sources make scripts used to build kernel from source 1 4 RCC tools The following tools are included in RCC parc rtems addr2line parc rtems ar parc rtems as parc rtems c parc rtems c filt parc rtems cpp parc
23. namically registered by calling network interface add The LAN91C111 attach routine is defined by RTEMS BSP NETWORK DRIVER ATTACH SMC91111 in bsp h The standard GRETH device is setup in a similar way see bsp h See src samples rtems ttcp c for sample a networking application 2 10 PCI Aeroflex Gaisler provides a PCI Library together with RTEMS located in cpukit libpci in the soruces The doc umentation for the PCI Library is located in the RTEMS documentation doc usr libpci t The RTEMS shell has been extended with a pci command can be used to extract information about the current setup and hardware Please see the rtems shell c sample application that comes with RCC A non PCI system Creating etc passwd and group with three useable accounts root pwd test pwd rtems NO PASSWORD RTEMS SHELL Ver 1 0 FRC dev console Oct 3 2011 help to list commands pci help usage pci ls bus dev fun PCIID List one or all devices pci r 8 16 32 bus dev fun OFS Configuration space read pci r 8 16 32 PCIID OFS Configuration space read access by PCIID pci w 8 16 32 bus dev fun OFS D Configuration space write pci wf8 16 32 PCIID OFS D Configuration space write access by PCIID pci pciid bus dev fun Print PCIID for bus dev fun pci pciid PCIID Print bus dev fun for PCIID pci pefg Print current PCI config for static configuration library pci getdev PCIID bus dev fun Get PCI Device from RAM tree pci infodev DEV
24. ng memory mapping and interrupt routing At start up the LEON3 BSP scans the system bus to obtain system configuration information Device drivers support a number of devices which are automatically recognized initiated and handled by the device drivers 2 7 1 LEON3 BSP The LEON3 BSP includes two different console and timer drivers standard official RTEMS drivers qleon3std and drivers which rely on the driver manager The latter drivers are possible to configure from the project configuration using standard driver manager configuration options for example which APBUART is mapped to dev console and which timer is used as system clock which is required for complex AMP systems The console drivers supports APBUARTS The first UART is registered under name dev console second and third UARTs get names dev console b and dev console c and so on LEON3 BSP requires at least one APBUART The timer driver uses General Purpose Timer GPT The driver handles GPT timer 0 and the lowest interrupt request line used by GPT GPT timer 0 and lowest request line should never be used by an RTEMS application If an application needs to use more timers GPT should be configured to have two or more timers using separate request lines Timer 0 interrupt can not be shared with other devices or GPT timers 1 6 For more information on how to configure a system based on GRLIB see GRLIB IP Library User s Manual 2 8 Driver Manager The LEON3 BSP u
25. o srec 2 12 Simple examples Following example compiles the famous hello world program and creates a boot prom in SRECORD format bash 2 04 sparc rtems gcc mcpu v8 msoft float 02 rtems hello c o rtems hello bash 2 04 mkprom2 leon3 freq 40 dump baud 38400 ramsize 1024 rmw rtems hello bash 2 04 sparc rtems objcopy O srec rtems hello rtems hello srec bash 2 04 Several example C programs can be found in opt rtems 4 10 src samples 2 13 Multiprocessing RTEMS supports asymmetric multiprocessing AMP the LEON3 BSP supports AMP in two different setups Either the RTEMS kernel is compiled with multiprocessing support qleon3mp or the user setup custom resource sharing with driver manager resources qleon3 the difference is that RTEMS provide multiprocess ing objects and communication channels in the former case and in the latter case the user is responsible for all synchronization itself which in many cases are sufficient All nodes in a asymmetric multiprocessor system executes thier own program image Messages are passed between the nodes containing synchronization infor AEROFLEX GAISLER RCC 1 2 0 mation for example take global semaphore A Messages are sent over memory using the Shared Memory Sup port Driver in the LEON3 BSP and interrupts are used to alert the receiving CPU The kernel must be compiled with multiprocessing support in order for the RTEMS AMP support to be avail able th
26. ols making it possible for GDB to find the source files The RCC RTEMS sources is assumed to be located in C opt rtems 4 10 mingw src rtems 4 10 The RTEMS sources sparc rtems 4 10 1 2 x src tar bz2 can be installed by extracting the source distribution to C opt rtems 4 10 mingw src creating the directory C opt rtems 4 10 mingw src rtems 4 10 1 2 2 3 Building RTEMS from source The RTEMS build environment can be set up by following the Windows instructions available www rtems org the environment requires MSYS DTK 1 0 1 autoconf 2 68 and automake 1 11 1 This section describes how to install MSYS DTK autoconf automake and building RTEMS SPARC BSPS from source MSYS DTK can be downloaded from www mingw org it comes as an self extracting installation application msysDTK 1 0 1 exe The following text assumes that MSYS DTK has been installed successfully into the MSYS environment Autoconf and automake can be downloaded from ftp ftp gnu org gnu autoconf and ftp ftp gnu org gnu auto make Below is a example of how to build and install the required tools mkdir src cd src download autoconf and automake to src gt tar jxf autoconf 2 68 tar bz2 mkdir autoconf 2 68 build AEROFLEX GAISLER RCC User s Manual cd autoconf 2 68 build configure prefix usr make make install lt autoconf 2 68 has been installed gt cd src tar jxf automake 1 11 1 tar bz2 mkdir automa
27. r of commands the drvmgr command can be used to extract informa tion about the current setup and hardware Please see the rtems shell c sample application that comes with RCC The rtems shell on a GR712RC ASIC Creating etc passwd and group with three useable accounts root pwd test pwd rtems NO PASSWORD RTEMS SHELL Ver 1 0 FRC dev console Oct 3 2011 help to list commands drvmgr help usage drvmgr buses List bus specfic information on all buses drvmgr devs List general and driver specfic information about all devices drvmgr drvs List driver specfic information on all drivers drvmgr info ID List general and driver specfic information about all devices or one device bus or driver drvmgr mem Dynamically memory usage drvmgr parent ID Short info about parent bus of a device drvmgr remove ID Remove a device or a bus drvmgr res ID List Resources of a device or bus drvmgr short ID Short info about all devices buses or one device bus drvmgr topo Show bus topology with all devices drvmgr tr ID OPT ADR Translate hw 0 cpu 1 OPT bit0 address ADR down 0 up 1 streams OPT bitl for device drvmgr help drvmgr topo BUS TOPOLOGY gt DEV Ox400fd3a0 GRLIB AMBA PnP gt DEV Ox400fd450 GAISLER_LEON3E gt DEV 0x400fd4a8 GAISLER LEON3F gt DEV 0x400 fd500 GAISLER_AHBJTAG AEROFLEX GAISLER
28. section text size 0x164e0 lma 0x40000000 Loading section jcr size 0x4 lma 0x400164e0 Loading section data size Oxaa8 lma 0x400164e8 Start address 0x40000000 load size 94092 Transfer rate 57902 bits sec 277 bytes write gdb break Init Breakpoint 2 at 0x400011f8 file rtems hello c line 33 gdb run AEROFLEX GAISLER RCC 1 2 0 The program being debugged has been started already Start it from the beginning y or n y Starting program opt rtems 4 10 src samples rtems hello Breakpoint 2 Init ignored 0 at rtems hello c 33 33 printf Hello World n gdb cont Continuing Hello World Program exited with code 0363 The application must be re loaded with the load command before it is possible to re execute it 3 4 Using DDD graphical front end to gdb DDD is a graphical front end to gdb and can be used regardless of target The DDD graphical debugger is freely available from http www gnu org software ddd To start DDD with the sparc rtems gdb debugger do ddd debugger sparc rtems gdb The required gdb commands to connect to a target can be entered in the command window See the GDB and DDD manuals for how to set the default settings If you have problems with getting DDD to run run it with check configuration to probe for necessary libraries etc DDD has many advanced features see the on line manual under the Help menu On windows cygwin hosts DDD must be started from
29. ses an optional Driver Manger that handles drivers and devices on the AMBA and PCI Plug amp Play buses The drivers are automatically assigned with one or more hardware devices The Driver Manager is either initilized by the user from the Init thread after RTEMS as started up or during startup of RTEMS The LEON BSP has by default gleon3 and qleon3mp the driver manager enabled drvmgr was given to configure during compiletime that means that no extra initialization calls from Init is needed however which drivers to be included must be configured uniquely per project One can use qleon3std to avoid using the driver manager In most cases the GPTIMER and the APBUART drivers are required to boot If the driver manager was configured to be initialized by the BSP the RTEMS DRVMGR STARTUP define is defined If not configured the define is not set and the user can choose to initialize the driver manager manually from for example the Init task or not use it at all LEON systems are divided into two different systems standard LEON2 systems and GRLIB LEON2 systems where the AMBA Plug amp Play bus is available Both systems can use the LEON2 hardcoded bus with the Driver Manager however it s primary intention is to provide a root bus for a second bus supporting Plug amp AEROFLEX GAISLER 12 RCC User s Manual Play For example a GRLIB LEONG system has hardcoded peripherals the standard LEON2 peripherals and GRLIB cores attached a
30. st also fit The argument W1 Ttext 0x40001000 for nodel and W1 Ttext 0x40200000 for node2 can be added to the link stage and the entry point 0x40001000 and 0x40200000 and stacks Ox401ffff0 and Ox403ffff0 must also be set by the loader GRMON or mkprom for example Depending on where the RAM memory is located and how much memory is available the paramters may vary AEROFLEX GAISLER RCC 1 2 0 3 Execution and debugging Applications built by RCC can be debugged on the TSIM LEON ERC32 simulator or on target hardware using the GRMON debug monitor LEON only Both TSIM and GRMON can be connected to the GNU debugger gdb for full source level debugging 3 1 TSIM The TSIM simulator can emulate a full ERC32 and LEON2 3 system with on chip peripherals and external memories For full details on how to use TSIM see the TSIM User s Manual Below is a simple example that shows how the hello world program is run in the simulator tsim leon3 rtems hello TSIM LEON3 SPARC simulator version 2 0 4a professional version Copyright C 2001 Gaisler Research all rights reserved For latest updates go to http www gaisler com Comments or bug reports to tsim gaisler com using 64 bit time serial port A on stdin stdout allocated 4096 K RAM memory in 1 bank s allocated 2048 K ROM memory icache 1 4 kbytes 16 bytes line 4 kbytes total dcache 1 4 kbytes 16 bytes line 4 kbytes total section text addr
31. ters that has an effect in changing is the fields base and length Override default SHM configuration shm_config_table BSP_shm_cfgtbl base void 0x40000000 length 0x00010000 Hardware resource allocation is done by the BSP for UART IRQ controller and System Clock Timer Devices which has a driver that is implemented using the driver manager can be ignored by a specific CPU by assigning the keys value NULL in the driver resouces The driver manager simply ignores the device when a NULL resource is detect An example is given below where CPUO is assigned GRGPIOO and CPU1 GRGPIOI GPTIMER driver have options that limit number of timers and which timer is used for system clock the sys tem console and debug output can be selected to a specific UART with the APBUART driver CPUO Application struct rtems_drvmgr_drv_res grlib_drv_resources DRIVER_AMBAPP_GAISLER_GRGPIO_ID 1 NULL Used by CPU1 CPU1 Application struct rtems_drvmgr_drv_res grlib_drv_resources DRIVER AMBAPP GAISLER GRGPIO ID 0 NULL Used by CPUO DRIVER AMBAPP GAISLER GRGPIO ID 1 amp grlib drv res grgpio1 0 AEROFLEX GAISLER RCC 1 2 0 Following example shows how to run RTEMS MP application on a two CPU system using GRMON CPU 0 executes image nodel exe in address space 0x6000000 Ox600fffff while CPU 1 executes image node2 exe in address space 0x60100000 0x601fffff GRMON
32. that is defined by the LEON3 BSP SZ struct drvmgr_bus_res grlib_drv_resources next NULL resource DRIVER AMBAPP GAISLER GRSPW ID 0 amp grlib grspw0l res 0 DRIVER AMBAPP GAISLER GRSPW ID 1 amp grlib_grspw0l_res 0 RES EMPTY ky ifndef RTEMS_DRVMGR_STARTUP struct grlib_config grlib_bus_config amp ambapp plb AMBAPP bus setup amp grlib drv resources Driver configuration endif GR RASTA IO 0 GRSPWO resources struct drvmgr key rastaio0 grspwO res AEROFLEX GAISLER 14 RCC User s Manual txDesc KEY_TYPE_INT unsigned int 8 rxDesc KEY TYPE INT unsigned int 32 KEY_EMPTY GR RASTA IO 1 GRSPW1 resources struct drvmgr key rastaio0 grspw0 res txDesc KEY_TYPE_INT unsigned int 16 rxDesc KEY_TYPE_INT unsigned int 16 KEY_EMPTY GR RASTA IO 1 GRSPWO and GRPSW1 resources use same configuration struct drvmgr_key rastaiol grspw01 res txDesc KEY_TYPE_INT unsigned int 16 rxDesc KEY_TYPE_INT unsigned int 64 KEY_EMPTY Driver resources for GR RASTA IO 0 AMBA PnP bus struct drvmgr bus res gr rasta i00 res next NULL resource DRIVER_AMBAPP_GAISLER_GRSPW_ID 0 amp rastaio0 grsp
33. vailable from the AMBA Plug amp Play information the setup for a system like that would be a LEON2 hardcoded bus and a LEON2 AMBA Plug amp Play sub bus Once the AMBA Plug amp Play bus is initialized all device and their drivers can be used the same way as in LEON3 4 systems For AT697 PCI systems the driver manager can be used to scan the PCI bus The ERC32 BSP does not support the driver manager 2 8 1 Initialization Regardless when the manager is initialized the following steps must be taken however RTEMS and the BSP takes all steps during startup for us when drvmgr was passed to configure Before the driver manager is initialized one must register a root bus driver so that the driver manager knows which bus to start search for devices at The driver manager itself must also be initialized by calling drvmgr_init before any driver supporting the driver manager can be accessed The manager replaces the DRIVER_register calls used in previous releases of RTEMS to register drivers 2 8 2 Configuration The driver manager is configured by defining the array drvmgr_drivers it contains one function pointer per driver that is responsible to register one or more drivers The drvmgr_drivers can be set up by defining CONFIGURE_INIT selecting the appropriate drivers and including drvmgr drvmgr_confdefs h The approach is similar to configuring a standard RTEMS project using rtems confdefs h Below is an example how to select drivers inclu
34. w0_res 0 DRIVER AMBAPP GAISLER GRSPW ID 1 amp rastaio0 grspwl res 0 RES EMPTY Fa Driver resources for GR RASTA IO 1 AMBA PnP bus struct drvmgr_bus_res gr_rasta_iol_res next NULL resource DRIVER AMBAPP GAISLER GRSPW ID 0 amp rastaiol grspw01 res 0 DRIVER AMBAPP GAISLER GRSPW ID 1 amp rastaiol grspw01 res 0 RES EMPTY Tell GR RASTA IO driver about the bus resources Resources for one GR RASTA IO board are available AMBAPP gt PCI gt GR RASTA IO gt AMBAPP bus resources The resources will be used by the drivers for the cores found on the GR RASTA IO gt AMBAPP bus F The weak defaults are overriden her kA struct drvmgr bus res gr rasta io resources amp gr rasta io0 res GR RASTA IO board 1 resources AEROFLEX GAISLER 15 RCC User s Manual amp gr rasta iol res GR RASTA IO board 2 resources NULL End of table 1 rtems task Init rtems task argument argument Manual driver manager initialization only required when driver manager not ini tialized during startup qleon2 qleon3std ifndef RTEMS DRVMGR STARTUP Register GRLIB root bus LEON3 4 ambapp grlib root register amp grlib bus config Initialize Driver Manager drvmgr init endif 2 8 4 drvmgr command The RTEMS shell comes with a numbe
Download Pdf Manuals
Related Search
Related Contents
Philips SC769 Baby Monitor User Manual Manuale utente del Magelis GTU LUC-T10, LUC-T20, LUC-T30 User Manual DNMEG_AD-DA 資料3 取扱説明書 Zanussi ZGL62IT User's Manual MPG for Palm OS User Manual Grandstream Networks, Inc. Copyright © All rights reserved.