From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,db8388c6b42d398 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!wn14feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: How do I go about creating a minimal GNAT runtime? Reply-To: no to spamers (No@email.given.org) References: X-Newsreader: IBM NewsReader/2 2.0 Message-ID: <85dfl.153987$_Y1.127262@bgtnsc05-news.ops.worldnet.att.net> Date: Mon, 26 Jan 2009 06:52:52 GMT NNTP-Posting-Host: 12.65.114.196 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1232952772 12.65.114.196 (Mon, 26 Jan 2009 06:52:52 GMT) NNTP-Posting-Date: Mon, 26 Jan 2009 06:52:52 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:3495 Date: 2009-01-26T06:52:52+00:00 List-Id: Will deal with exception later. I wrote this last time when you ask about building a Stand-Alone Ada Hello program. In this example all code files are written using GNAT Ada 95 and was tested using GNAT GPL Ada 2005, Adacore 2007 version. And Yes, I do have all source files. ############################################################################## # Linux: script file # # # # Both GNATBIND and GNATLINK can be used but the binder output file # # must be edited to move function 'main' to first routine of the # # package, before linking. Required for GNAT Ada binary type of # # kernels. # # # # In this example I use an Ada partition call 'edit_bind' to preform # # the move. But file can be be edited manually. # # # ############################################################################## ############################################################################## # # # 'video_io' package basically a "protective-mode" video device driver # # that access video memory and handles a few simple control characters, # # such as CR/LF. # # # # 'test_io' package is a edited copy of GNAT.IO which defines the major # # put/put_line/new_line routines. Deleted 'Get'(s) routines. # # # ############################################################################## gnat compile video_io -gnatl >1 gnat compile text_io.adb -gnatl -a >>1 ############################################################################## # # # Hello is a simple 32-bit protective-mode kernel # # # ############################################################################## gnat make -c hello.adb -gnatl >>1 gnat bind hello.ali ############################################################################## # # # edit_bind: Moved function 'main' to top of package '_ada_main'. # # So, function 'main' is first routine # # # ############################################################################## ./edit_bind b~hello.adb ############################################################################## # # # link Kernel routines into a single Stand-Alone file # # # ############################################################################## gnat link hello.ali -e _ada_hello -T hello.lds -nostdlib # objdump -d hello >3 # objcopy -R .comment -R .dynamic -R .note -S -O binary hello hello.bin # rm video_io.ali video_io.o text_io.ali text_io.o hello.ali hello hello.o ############################################################################## # # # compile and build the MBR boot program. calls setup routine # # Then pad boot.bin to MBR size and insert boot sig. # # # ############################################################################## gnat compile boot.adb >4 ld -o boot.exe -Ttext 0 -e _ada_boot boot.o objcopy -R .comment -R .dynamic -R .note -S -O binary boot.exe boot.bin # ./fix_mbr boot.bin rm boot.ali boot.exe boot.o ############################################################################## # # # compile and build the 'proctive-mode' initiator. Which calls an # # Ada program at a specific offset. # # # ############################################################################## gnat compile setup.adb >>4 ld -o setup.exe -T setup.lds --oformat binary -s -e _ada_setup setup.o ./fix_mbr setup.exe rm setup.ali setup.o ############################################################################## # # # catenate a list of binary file into one, building a loadable kernal. # # Kernel := ipl.img # # # ############################################################################## ./catenate ipl.img boot.bin setup.exe hello.bin rm boot.bin setup.exe hello.bin In , Lucretia writes: >Hi (again), > >It's been a while, but I'm coming back to my Ada kernel again. I've >been messing with my helo_world_kernel which I built using no runtime >(see http://www.archeia.com for more info). > >Having just spoken to Ludovic on #Ada, he pointed out that the gnat >tools can use a basic cross tool set, like the ones I have built >myself (again, see the above link). My toolset comprises of a gnat1 >compiler and a gnatbind for my targets. I found that it does work >using the --GCC and --GNATBIND flags, and I need to make sure the >cross tools and the host tools are of the same GCC version otherwise >GNAT throws up ALI format errors. > >The thing is, I've been trying to enable exceptions, but keep coming >across big problems in that the runtime requires features that are >being restricted, such as returning aggregates and assigning >composites, returning unconstrained objects which requires the >secondary stack. So, what I really need to know is, how do I create a >runtime which is restricted in this way for bare hw access? > >Thanks, >Luke.