Home
BCC - Bare-C Cross-Compiler User`s Manual
Contents
1. 1765 40008ee0 d2042008 ld 10 0x8 Sol 1775 40008ee4 9fc34000 call 05 1777 40008ee8 e4246124 st 12 11 0x124 installed irq handler 1780 40001260 9de3bf98 save sp 104 sp 2 12 5 Extended IrgCtrl The extended irq functionality is activated by the following code the extended irq number is 13 for this example include lt asm leon irg h gt extern struct irgmp_type irqmp irgmp addr 0x80000200 irqmp eirg 13 enable_irq 13 irgmp addr is the address of the irq controller irgmp eirg is the extended irq number Having initialized the application like this you can register an irq handler for an irq gt 15 using catch_interrupt Note that the extended irq number s interrupt handler itself is not called but the handler of the irq indicated by the extended irq ctrl s extended irq acknowledge register Another possibility is of course to implement the extended irq handling yourself 2 12 6 Interrupt nesting The variable extern unsigned int nestedirg 2 13 11 can be set to 1 if irq nesteing is desired By default it is set to 0 In case of 0 the PSR s PIL will be set to 15 highest to keep the irq processing uninterrupted If nestedirq is set to 1 the PSR s PIL will be set to the incoming irg s level therefore causing higher level irq s to interrupt the current irq processing 2 12 7 Installing custom irg handlers To overwrite a compile time generated traptable entry the function t
2. Insight debugger The Insight debugger is based on GDB 6 4 with an TCL TK based graphical front end It can be used on both linux and cygwin hosts The debugger is started with sparc elf insight app exe 15 This will create the Insight main window Eile Run View Control Preferences Help for i 1 i lt 20 i 1024 1025 Fft fftsize z w e 0 0625 1026 Printcomplex 6 99 z 1 256 17 1027 d 1028 oscar 1029 1030 main 1 m amp ra 1032 int i oated 0 0 printf Starting n 1036 rewrite output 1037 printf Perm 1 H o oO in 1038 timer Getclock 1039 Perm 1040 xtimes 1 Getclock timer 1041 fixed fixed permbase xtimes 1 1042 floated floated permbase xtimes 1 1043 printf Towers Y Program is running 40004438 1033 D a Eo W Set breakpoint at main Target Remote TCP x 1 Set breakpoint at exit Hostname localhost Set breakpoint atlexit Port i234 Display Download Dialog 4 Use xterm as inferior s tty b More Options om ct min To connect to TSIM select Remote TCP and port 1234 To connect to GRMON select port 2222 Enable the breakpoint on main but disable the breakpoint on exit Before clicking on OK make sure that you have started TSIM or GRMON is a separate window and en
3. be done in a cygwin shell window See http www cygwin com for information on Cygwin 1 2 2 Windows BCC for Windows is provided for native Windows MinGW and for the Cygwin environment For the Cygwin version see previous section The native version will not require any additional pack ages and can be run from a standard Command Prompt The native Windows version of BCC is packaged with zip Use a tool like WinZip to uncompress it to a directory e g C opt Note The directory should not contain spaces or any other non ASCH characters as this will confuse the compiler To use the compiler the bin subdirectory e g C opt bin must be added to the PATH environment variable This can be done from the Control Panel System gt Advanced gt Environment Variables Se http www mingw org for more information on MinGW and the optional MSYS environment Building from source The source code for BCC is available from the Gaisler homepage www gaisler com To build BCC from source you should e untar the source archive to lt dir gt e issue cd lt dir gt make download This will download the original gcc binutils and newlibc sources e issue cd lt dir gt make install This will untar all the downloaded original archives over the current sourcetree preserving the LEON sprecific files 1 4 4 e issue cd lt dir gt make all This will build the 4 4 2 and 3 4 4 toolchains The default prefix is o
4. hardware multiply and divide e mflat do not use register windows i e no save restore instructions This options is only available in gcc 3 4 4 Ordinary C programs can be compiled without any particular switches to the compiler driver sparc elf gcc msoft float g 02 hello c o hello exe The default link address is start of RAM i e 0x40000000 for LEON Other link addresses can be specified through the Ttext option see gcc manual Floating point considerations If the targeted LEON processor has no floating point hardware then all applications must be com piled and linked with the msoft float option to enable floating point emulation When running the program on the TSIM simulator the simulator should be started with the nfp option no float ing point to disable the FPU LEON SPARC V8 instructions LEONJ3 processors can be configured to implement the SPARC V8 multiply and divide instruc tions The BCC 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 compi lation and linking The v8 switch improves performance on compute intensive applications and floating point emulation 25 2 6 2 7 2 8 2 9 6 LEON3 4 also supports multiply and accumulate MAC The compiler will never issue those instructions they have to be coded in assembly Note that the BCC assembler and other utili ties a
5. of it under certain conditions Type show copying to see the conditions There is absolutely no warranty for GDB Type show warranty for details This GDB was configured as host i686 pc linux qnu target sparc tsim elf gdb tar extended remote localhost 1234 Remote debugging using localhost 1234 0x00000000 in gdb load Loading section text size 0x8930 lma 0x40000000 Loading section data size 0x820 lma 0x40008930 Loading section jcr size 0x4 lma 0x400091b4 Start address 0x40000000 load size 37204 Transfer rate 297632 bits in lt 1 sec 275 bytes write gdb break main Breakpoint 1 at 0x40001384 file hello c line 4 gdb run The program being debugged has been started already Start it from the beginning y or n y Starting program home jiri samples hello exe Breakpoint 1 main at hello c 4 4 printf Hello world n gdb To re execute the application first re load it to the target using the gdb load command and the issue run again Debugging on target hardware To connect GRMON to a LEON system start GRMON on the command line in a shell window By default GRMON will connect to the processor debug support unit DSU using a serial port of the host ttySO or com1 See the GRMON manual for how to connect via JTAG PCI ethernet or Spacewire Once connected the application can be downloaded and executed using the same pro cedure as when the simulator is used grmon u GRMON
6. 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 tsim gt load hello exe section text at 0x40000000 size 35120 bytes section data at 0x40008930 size 2080 bytes section jcr at 0x400091b4 size 4 bytes tsim gt go resuming at 0x40000000 Hello world Program exited normally grmon sim gt Debugging with GDB To debug an application with gdb start grmon with the gdb option or issue the gdb command inside grmon Note that GRMON listens on port 2222 for a gdb connection This can be changed to any port using the grmon port switch at start up tsim leon3 gdb TSIM LEON SPARC simulator version 2 0 3 professional version Copyright C 2001 Gaisler Research all rights reserved 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 gdb interface using port 1234 Then start gdb in a separate shell load the application to the target add optional breakpoints and finally execute the application using the gdb run command S sparc elf gdb hello exe GNU gdb 5 3 Copyright 2002 Free Software Foundation Inc 3 3 13 GDB is free software covered by the GNU General Public License and you are welcome to change it and or distribute copies
7. BCC Bare C Cross Compiler User s Manual Version 1 0 43 June 2013 Authors Jiri Gaisler Konrad Eisele Copyright Aeroflex Gaisler AB 2012 Table of contents TOME ee ee 3 1 1 SCOPE RE sn heh es Mates NI Rees 3 1 2 Installation asian ehe sat Et esse 3 1 3 Building from source unes aa EE EEE EEEE calpe 3 1 4 Technical Support nas coh id ds AA it deidad 4 General development How el 5 2 1 OVervieW issues pila ploteo cier ing Mn tente ttes ten dut et tante 5 2 2 GCC OPHONS san Line th ars da Dit nn tnt ia diia 5 2 3 Floating point Considerations ss 5 2 4 LEON SPARC V8 instructions sienne 5 2 5 Alternate register windows organization only for GCC 3 X u nceserseesnersneeneenne nennen 6 2 6 Single Vector trapping uni DSB BER san 6 2 7 Memory rg nization e i seiiekiikesenkesfe nike nereeene 6 2 8 Making LEON bo6t proms 2050 2 2 882 is EE E anhe SEs 6 2 9 Creating applications that run in promu 6 2 10 NGMP RAM applications located at address 0 and multibus systems 7 2 11 Simple examples 2 2 22s 22 rar ia een 7 2 12 Newl b C lhbr ry nee es ah ss ees 7 2 13 O nn ss eins ls nt te ben te opte bete sente tisse 11 Execution and debuggine unsern isn 12 3 1 TSIM simulator and GRMON debug monitor 12 3 2 Debugging with GDB 2 2022218 RssnskssknnEskalgeanlbssprn 12 3 3 Debugging on target hardware ss 13 3 4 Using the DDD graphical front end to GDB u2222222ssnsn
8. M boot prom builder v1 0 section text at 0x4000000 size 31040 bytes section data at 0x4007940 size 1904 bytes sparc elf objcopy O srec hello exe hello srec Several example C programs can be found in src examples Newlib C library 2 12 1 Stdio BCC applications uses Newlib which is a posix compatible C library with full math support However no file or other I O related functions will work with the exception of I O to stdin stdout Stdin stdout are mapped on UART A accessible via the usual stdio functions 2 12 2 Time functions The LEON timers are used to generate the system time The function clock will return the time expired in microseconds The gettimeofday time and times can also be used to get the time Before the time functions can be used leonbare_init_ticks should be called to start the LEON timers and install the timer interrupt handler include lt asm leon timer h gt void leonbare_init_ticks This will initialize Timerl and Timer2 Timer is used to generate ticks at 100Hz while Timer2 is used to create high resolution timer events Timer ticks can be used by installing a ticker callback at tickerhandler ticker_callback Timer2 timer events can be generated by initializing a struct timerevent structure and calling include lt asm leon timer h gt int addtimer struct timerevent e struct timerevent expire field is the timeposition at which the event should be triggered The c
9. The LEON multi purpose monitor v1 0 7 Copyright C 2004 Gaisler Research all rights reserved For latest updates go to http www gaisler com Comments or bug reports to grmon gaisler com using port dev ttyS0 115200 baud imittalising 24 423 42 Component Vendor Leon3 SPARC V8 Processor Gaisler Research AHB Debug UART Gaisler Research Ethernet DSU interface Gaisler Research LEON2 Memory Controller European Space Agency AHB APB Bridge Gaisler Research Leon3 Debug Support Unit Gaisler Research Generic APB UART Gaisler Research Multi processor Interrupt Ctrl Gaisler Research Modular Timer Unit Gaisler Research Use command info sys to print a detailed report of attached cores grmon grlib gt load hello exe section text at 0x40000000 size 35120 bytes section data at 0x40008930 size 2080 bytes section jcr at 0x400091b4 size 4 bytes total size 37204 bytes 99 4 kbit s read 110 symbols 3 4 3 5 14 entry point 0x40000000 grmon grlib gt run Hello world Program exited normally grmon grlib gt Connecting GDB to GRMON when attached to a real LEON target is done in the same way as when using the simulator Note that GRMON uses port 2222 to communicate with gdb while TSIM uses port 1234 Using the DDD graphical front end to GDB DDD is a graphical front end to gdb and can be used regardless of target DDD must be started with the debugger switch to select the sparc debugger rathe
10. able_ext_end marks the end of the trap dispatch table To insert a trap handler in qsvt mode you can use the function int svtloleveltrapinstall int trap void handler svtlolevelirqinstall irg handler is equivalent to svtloleveltrapinstall irq 0x10 handler Trap pre amble 1572 400001a0 ael0200a mov 10 17 1579 400001a4 a1480000 mov psr 10 1580 400001a8 108022fc ba 0x40008498 1581 40000lac a7500000 mov Swim 13 1582 40008498 2d000004 sethi shi 0x1000 16 1587 40008d9c a02c0016 andn 10 16 10 1588 40008da0 2d100023 sethi hi 0x40008c00 16 1595 40008da4 acl5ala8 or 16 Oxla8 16 1596 40008da8 29100025 sethi shi 0x40009400 14 etraps s save state 1597 40008dac 81c52170 jmp 14 0x170 1599 40008db0 932de008 sll SIT 8 Sol 1606 40009570 aa27al38 sub fp 312 15 1613 40009574 c2256074 st gl 15 0x74 1616 40009578 c43d6078 std g2 15 0x78 1620 4000957c c83d6080 std Sad 15 0x80 1624 40009580 cc3d6088 std 96 15 0x88 1634 40009584 15100029 sethi Shi 0x4000a400 o2 1635 40009588 d602a050 ld 02 0x50 03 1639 4000958c d6256134 st 03 15 0x134 1644 40009590 960560b0 add 15 176 03 1651 40009594 d622a050 st 203 02 0x50 check for invalid window 1654 40009598 a8102001 mov 1 14 1655 4000959c a92d0010 sil 14 10 14 1656 400095a0 80840013 andcc 14 13 g0 1663 400095a4 02800013 be 0x400095 0 1664 400095a8 01000000 nop 1665 400095f0 81c5a008 j
11. anns the main BUS s configuration area at Oxfff00000 From BCC 1 0 41 upward recursive scanning is set as default gnoambapp can be given to dis able recursive scaning FreeRtos The simple sheduling library FreeRtos www freertos org is included in the distribution Please refer to the FreeRtos documentation on the website for information on how to use the FreeRtos API The precompiled library libfreertos a was compiled using the configuration file supplied in lt installdir gt sparc elf include freertos FreeRTOSConfig h To recompile it with another configura tion goto lt installdir gt src freertos change FreeRTOSConfig h and type Smake recompile You might also want to add more sources to LIBOBJ 3 1 3 2 12 Execution and debugging TSIM simulator and GRMON debug monitor LEON applications can be debugged on either the TSIM simulator or real target hardware through the use of the GRMON debug monitor Both TSIM and GRMON can be connected to the GNU debugger sparc elf gdb to perform source level symbolic debugging 3 1 1 Running on the TSIM simulator To execute an application in the TSIM LEON simulator use the load command to load the binary and the go command to execute the application tsim leon3 TSIM LEON SPARC simulator version 2 0 3 professional version Copyright C 2001 Gaisler Research all rights reserved using 64 bit time serial port A on stdin stdout allocated 4096 K RAM memory in
12. eennesnennnennennnense enorm 14 3 5 Using the Insight debugger ss 14 MKPROM boot prom Dildo ae 16 4 1 Introduction ss hes sess AO 16 1 1 1 2 1 3 Introduction Scope BCC is a cross compiler for LEON3 processors It is based one the GNU compiler tools and the Newlib standalone C library The cross compiler system allows compilation of both tasking and non tasking C and C applications It supports hard and soft floating point operations as well as SPARC V8 multiply and divide instructions BCC can also be used to compile the eCos kernel BCC consists of the following packages e GNU GCC C C compiler v3 4 4 v4 4 2 e Newlib C library v 1 13 1 e Low level I O routines for and LEON3 including interrupt support e ulP light weight TCP IP stack e GDB debugger v6 4 with DDD and Insight Graphical front end e Mkprom prom builder for LEON3 4 e Linux and Windows Cygwin hosts Note LEON2 support has been dropped since release 1 0 36d Installation 1 2 1 Linux Cygwin BCC is provided as a bzipped tar file It should be unpacked in the opt directory of the host mkdir opt tar C opt xjf sparc elf lt version number gt tar bz2 After installation add opt sparc elf lt gcc version number gt bin to the PATH variable This should be done by adding the following line to the file profile in the home directory export PATH opt sparc elf lt gcec version number gt bin SPATH On Cygwin hosts all installation steps should
13. mp 16 0x8 1673 400095f4 9c100015 mov 15 sp back in irgtrap_fast s check for nested_irq flag set pil 1674 40008db0 932de008 sll SLT By Sol 1675 40008db4 92140009 or 10 01 Sol 1676 40008db8 11100029 sethi Shi 0x4000a400 00 1677 40008dbc 90122054 or 00 0x54 00 10 1678 40008dc0 d0020000 ld S00 00 1688 40008dc4 80a00008 cmp 00 1691 40008dc8 22800002 be a 0x40008dd0 1692 40008dcc 92126f00 or 01 Oxf00 ol 1693 40008dd0 818a6020 mov 01 0x20 psr 1700 40008dd4 01000000 nop 1701 40008dd8 01000000 nop 1702 40008dde 01000000 nop call routine catch_interrupt c handler_irq 1703 40008de0 90100017 mov 17 00 1710 40008de4 40000028 call 0x40008e84 1711 40008de8 9203a0f0 add sp 240 Sol 1712 40008e84 9de3bf98 save sp 104 sp 1713 40008e88 03100029 sethi hi 0x4000a400 g1 1714 40008e8c 9b2e2002 sll 10 2 05 1715 40008e90 82106228 or gl 0x228 gl 1722 40008e94 e0004004 ld g1 05 10 1723 40008e98 80a42000 cmp 10 1726 40008e9c 02800018 be 0x40008efc 1727 40008ea0 a4102001 mov 1 12 1734 40008ea4 10800007 ba 0x40008ec0 1735 40008ea8 da040000 ld 10 05 1739 40008ec0 80a36000 cmp 05 1748 40008ec4 02bffffa be 0x40008eac 1749 40008ec8 23100029 sethi hi 0x4000a400 11 1750 40008ecc c2046124 ld 11 0x124 Sgl 1754 40008ed0 90100018 mov 10 00 1761 40008ed4 80a06000 cmp gl 1762 40008ed8 12bffff5 bne 0x40008eac 1764 40008edc 94100019 mov il 02
14. oft float c g 02 hello c 2 Create final prom image with mkprom listing all object files on the command line 2 10 2 11 2 12 sparc elf mkprom freq 40 rmw hello o msoft float A PROM application has it code text segment in prom and data data amp bss in RAM At start up the data segment is copied from the prom to the ram and the bss segment is cleared A prom application is linked to start from address 0x0 The data segment is by default linked to 0x40000000 but can be changed by giving the Tdata lt address gt option of gcc to mkprom Note that if no FPU is present the msoft float option must also be given to mkprom in this case since it is needed during the final linking When debugging prom applications with GRMON or gdb only hardware breakpoints hbreak command can be used NGMP RAM applications located at address 0 and multibus systems To create an application that is located at address 0 like when runing on a NGMP system the option WI msparcleonO can be given to gcc or msparcleon0 to ld Until bec 1 0 40 On systems with multiple busses gambapp can be given to gcc in the final link this activates the AMBA PnP scan From 1 0 41 onward AMBA scanning is default Simple examples Following example compiles the famous hello world program and creates a boot prom in SRECORD format sparc elf gcc g 02 hello c o hello msoft float sparc elf mkprom hello o hello exe msoft float MKPRO
15. pt Technical support Technical support for BCC can be obtained from Aeroflex Gaisler AB by purchasing a techni cal support contract Please contact sales gaisler com for details 2 1 2 2 2 3 2 4 General development flow Overview Compilation and debugging of applications is typically done in the following steps 1 Compile and link program with gcc 2 Debug program on a simulator or remote target 3 Create boot prom for a standalone application BCC supports both tasking and non tasking C C programs Compiling and linking is done in the same manner as with a host based gcc and will not be explained here The produced binaries will run on LEON3 4 systems without requiring any switches during compilation Gcc options All gcc options are described in detail in the gcc manual Some useful options are e g generate debugging information must be used for debugging with gdb e msoft float emulate floating point must be used if no FPU exists in the system e mcpu v8 generate SPARC V8 mul div instructions needs hardware multiply and divide e O2 or O3 optimise code maximum performance and minimal code size e qsvt use the single vector trap model e mtune ut699sets UT699 specific parameters gcc 3 4 4 and gcc 4 4 2 e mfix ut699 sets UT699 specific parameters gcc 4 6 0 upward Note that in GCC version 3 4 4 mcpu v8 was called mv8 and mflat was present e mv8 generate SPARC V8 mul div instructions needs
16. r than the native gdb ddd debugger sparc elf gdb attach window For further details on DDD operation see the DDD home page http www gnu org software ddd DDD has also a built in manual under the HELP menu in the main window FM 7 Qe Ta 0x0 0 Drain Lookup Find 2 a amp e E Pore Deer 0x1 1 E 0x60006 393222 Oxa 10 0x1 1 floated 0 0 rived a Sarena An Oxad8 2776 rewrite output 1 0x1 1 printf Perm timer Getclock Perm xtimes 1 Getclock timer 0x0 0 fixed fixed permbase xtimes 1 0x27 39 floated floated permbase xtimes 1 0x407d871a 1081968410 printf Towers timer Getclock Towers xtimes 2 GetclockO timer 0x9999999a 1717986919 fixed fixed towersbase xtimes 2 ORFEFFFFFF 1 floated floated towersbase xtimes 2 printf Queens timer Getclock Queens xtimes 3 Getclock timer fi iced F ied eo a oated floated queensbase xtimes a printf Intmm timer Getclock Intmm xtimes 4 GetclockO timer li HE fixed fixed intmmbase xtimes 4 floated floated intrmbase xtimes 4 printf Mn timer Getclock Mn xtimes 5 Getclock timer fixed fixed mmbase xtimes 5 floated floated fpmmbase xtimes 5 printf Puzzle timer Getclock s Puzzle xtimes 6 Getclock timer fixed fixed puzzlebase xtimes PE floated floated puzziebase xtimes 6 S CEE printfC Quick timer Ge
17. raptable_genjmp can be used include lt asm leon leon3 h gt extern void traptable_genjmp unsigned long p int i int arg unsigned int fn extern unsigned int sparc_leon23_get_tbr_base void where p is the traptable base i the traptable index arg a 13 bit value in 17 at the time of the traphandler call and fn the assembler function address to be called The routine sparc_leon23_get_tbr_base can be used to retrive the current tbr base Below is a simple example that routes the window overflow 0x5 trap call through mynewhandler include lt asm leon leon3 h gt void wrap void __asm__ __volatile__ n global mynewhandler nmynewhandler n mov psr 10 n ba _window_overflow nop n 22 extern void mynewhandler main traptable_genjmp void sparc_leon23_get_tbr_base 5 0 int amp mynewhandler 2 12 8 Small binary Newlib atexit introduces a dependency to malloc which will add 10k extra code If you want to avoid this you can link against libsmall a Ismall libsmall a s atexit supports only a static 32 exit function entries The c library newlib atexit function is declared weak and can be overrid den Ismall remove reference to malloc by override Newlibc atexit 2 12 9 Amba PLUG and PLAY Until BCC 1 0 40 The options gambapp can be given to enable PLUG and PLAY scanning for UART timer and irg ctrl across AHB2AHB bridges The default setup ony sc
18. re based on a modified version of GNU binutils 2 15 that supports the LEON MAC instructions Alternate register windows organization only for GCC 3 X The compiler normally produces binaries that assumes that the target processor has 8 register windows However by compiling and linking with the mflat switch it is possible to produce binaries that will run on processors with only 2 register windows mflat affect performance and code size Using mflat the code size will increase with 10 and the performance will decrease with the same amount When creating boot proms see below it is essential that the same mflat parameter is given to sparc elf mkprom as was used when the binary was compiled Any miss match will produce a faulty prom image Single vector trapping When the vhdl model is configured to support single vector trapping svt the qsvt switch can be used with the linker to build an image that uses a dispatcher rather than a static trap table The saving amounts to 4k for the trap table however trap handling will be slower The image will try to enable svt on boot using asr17 Memory organization The resulting executables are in elf format and have three main segments text data and bss The text segment is by default at address 0x40000000 for LEON3 4 followed immediately by the data and bss segments The stack starts at top of ram and extends downwards The area between the end of bss and the bottom of the stack is u
19. sed for the heap Making LEON boot proms To make a boot prom that will run from the prom on a standalone LEON3 4 target use the sparc elf mkprom utility It will create a compressed boot image that will load the application to the RAM initiate various LEON registers and finally start the application sparc elf mkprom will set all target dependent parameters such as memory sizes waitstates baudrate and system clock The applications compiled with sparc elf gcc do not set these parameters themselves and thus do not need to be re linked for different board architectures The example below creates a boot prom for a system with 1 Mbyte RAM one RAM waitstate 3 waitstates for ROM access and 25 MHz system clock For more details see the mkprom manual sparc elf mkprom ramsize 1024 ramws 1 romws 3 freq 25 hello exe msoft float Note that sparc elf mkprom creates ELF files To create an SRECORD file for a prom pro grammer use objcopy sparc elf objcopy O srec hello prom hello srec Note it is essential that the same mflat qsvt and msoft float parameters are given to sparc elf mkprom as was used when the binary was compiled Any miss match will produce a faulty PROM image Creating applications that run in prom BCC supports applications that run in PROM but have data and stack in ram A PROM appli cation is created in two steps 1 Compile the application into on or more object files but do not link sparc elf gcc ms
20. tclock QuickQ EN Starting Perm Towers Queens Intmm Mm Puzzle Quick Bubble Tree Dump of assembler code from 0x2000800 en HELEN 100 133 83 267 150 567 5 583 Dx2000800 lt text_start 2048 gt 0 x2000804 lt text_start 2052 gt rE Nonfloating point composite is 318 0x2000808 lt text_start 2056 gt nop Ox200080 lt text_start 2060 gt nop Floating point composite is 472 Program exited normally Reading symbols from stanford exe done tsim gt per gdb tar extended remote local host 1234 Remote debugging using localhost 1234 Cucles 33308682 0x2000800 in text_start Instructions 23306849 gdb Overall CPI 1 43 CPU performance 14 0 MHz 9 80 MOPS 9 63 MIPS 0 16 MFLOPS A Disassembling location 0x2000800 to 0x2000900 done Sees 2379 19 ne Processor utilisation 100 00 Real time simulator time 1 1 18 Simulator performance 3 8290 24 KIPS Used time sys user 2 818 A tsim gt gdb feb interface using port 1234 Figure 1 DDD with TSIM Attaching to TSIM of GRMON is done in the same manner as when using sparc elf gdb with out DDD The gdb commands are entered in the bottom command window Remember to load the application first before issuing a run command On cygwin hosts the cygwin X server must first be started by issuing startx in a cygwin terminal This will open an Xterm window from which DDD should be started with the options mentioned above Using the
21. tered gdb mode Insight automatically downloads the application to the target when needed so the load command does not have to be issued manually To restart the application just click on the RUN button again NOTE Insight can only be used with TSIM 2 0 5 and GRMON 1 1 12 or later versions 4 1 6 MKPROM boot prom builder Introduction The successor of sparc elf mkprom is mkprom2 that can be downloaded from the Aeroflex Gaisler homepage sparc elf mkprom is a utility program to create boot images for programs compiled with the BCC cross compiler It encapsulates the application in a loader suitable to be placed in a boot PROM The application is compressed with a modified LZSS algorithm typically achieving a compression factor of 2 The boot loader operates in the following steps 1 The register files of IU and FPU if present are initialized 2 The memory controller UARTs and timer unit are initialized according to the specified options 3 The application is decompressed and copied into RAM 4 Finally the application is started setting the stack pointer to the top of ram 17 18 19
22. the sre examples c irq c example of the BCC distribution Low level interrupt processing takes around 40 instructions to setting up the C enviroment for the interrupt handler and another 25 instruction to dispatch irq to the associated handler If very fast processing is required a custom lolevel assemler irqroutine can be installed using include lt asm leon leon h gt void lolevelirqinstall int irqnr void handler This will write instructions sethi Shi handler 14 jmpl 14 lo handler g0 nop 9 at address traptable 0x 100 irgnr 16 The callers low level interrupt routine has to ensure proper enviroment setup before calling a C routine This includes saving volatile register checking for invalid windows and avoiding nested irqs An appropriate routine would be written in assembler In case of single qsvt vector trap shemes you have to use he following funtion to insert a irq han dler int svtlolevelirginstall int trap void handler In case of qsvt a table is used to dispatch the traps struct svt_trap_entry int start end void func void extern struct svt_trap_ entry trap_table 28 Where start and end specify the range of traps that handler func should process The last entry in the table should be 0 0 0 You can modify the table by hand or use svtlolevelirqinstall to install a interrupt handler for you Note that the irq number is trap number 0x10 The symbol svt_trap_t
23. urrent time can be retrieved using int gettimeofday struct timeval tv struct timezone tz 2 12 3 Task switching Task switching is supported by the functions include lt contextswitch h gt int thread_setjmp threadctx_t env int val void thread_longjmp threadctx_t env int val thread_longjmpO will save the current register windows to the stack and jump to the stack pre viously saved by thread_setjmp similar to clib s setjmp and longjmp construct You can cre ate your own scheduler by using a construct like void sched thread_long jmp next if thread_set jmp self sched 2 12 4 Interrupt handling Installing an interrupt handle is done by initializing member handler of a global variable struct irgaction and calling include lt asm leon irq h gt void chained_catch_interrupt int irq struct irqaction a where irq is the irq number 1 15 The supplied struct irgaction will be inserted in a list and therefore should be global The simple void catch_interrupt void func int irq int irq is also supported which uses chained_catch_interrupt internally The source code for libgloss libleonbare a can be found in the src libgloss directory For systems using the extended LEON3 interrupt controller with support for up to 31 inter rupts it is possible to use irq 1 31 with catch_interrupt and chained_catch_interrupt An example for how to install interrupt handler is supplied with
Download Pdf Manuals
Related Search
Related Contents
このたびは Dea,s Garden 製品をお買い上げいただき、 ありがとうござい Bedienungsanleitung Heavy Duty Auto Control Bedienungsanleitung Smoke Alarm User`s Manual IMPORTANT SAFETY INFORMATION SWMシリーズ 760 LiA Automático Sandberg Network Cable UTP CROSS 1 m Elite PRO-151FD User's Manual 980 Phy & Protocol Aux Channel Analyzer Sink MOI Copyright © All rights reserved.
Failed to retrieve file