Once you have mastered writing and running a small program, you'll want to check out some of the more advanced techniques required to write and run real application programs. In this chapter, we cover the following topics:
Customizing the start file and linker script file
Generating PROM programming files
Using the debugger
Using optimizations
Working on the target
Checking for stack overflow
Expanded memory
On a real project you will almost certainly need to customize the start file and the linker script file. These contain details of the target hardware configuration and project options such as running in user mode or supervisor mode.
The start file art0.S contains instructions to initialize the arithmetic unit, floating point unit and system registers. The default start file may be suitable for your requirements. You can see the source code in file /opt/m1750-ada-1.7/m1750-coff/src/libc/art0.S. If this is not suitable, make a copy in a working source directory, then edit it as necessary.
Example 2-1. Creating a Custom Start File
$ mkdir src $ cd src $ cp /opt/m1750-ada-1.7/m1750-coff/src/libc/art0.S myart0.S $ vi myart0.S
When you compile, you should cite the new start file on the command line, as in the following example. We also ask the linker to list all the files that were included in the link.
$ $ m1750-coff-gnatmake -f hello -largs -t -nostartfiles myart0.S m1750-coff-gcc -c hello.adb m1750-coff-gnatbind -x hello.ali m1750-coff-gnatlink -t myart0.S -nostartfiles hello.ali /opt/m1750-ada-1.7/m1750-coff/bin/ld: mode coff_m1750 b~hello.o ./hello.o /tmp/ccYJNaCH1.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)a-except.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)a-textio.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)a-ioexce.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)x-malloc.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libada.a)s-stcosc.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)open.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)close.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)unlink.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)lseek.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)read.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)write.o (/opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/libc.a)sbrk.o