M1750 Ada Technical Summary: For mission-critical applications | ||
---|---|---|
Prev | Chapter 4. User Interface and Debugging Facilities | Next |
For Ada 83 and Ada 95 the predefined program library is located in a standard place, which is target dependent. The location is /opt/m1750-ada-1.7/lib/gcc-lib/m1750-coff/2.8.1/adalib/.
Ada source files are always compiled in the context of a program library. While M1750 Ada does not have a closed library as some other Ada compilers do, it does generate and use library file information. By default this goes in the current directory. Library files use the .ali (Ada library) suffix. Also M1750 Ada requires each Ada compilation unit to be in a separate file with the file name the same as the unit name. There must be a file extension which is .ads for a package or subprogram specification and .adb for a body.
Where a source file contains more than one compilation unit, then the program m1750-coff-gnatchop may be used to divide the file. This program writes the output files in the current directory, or (more usefully) into a named directory.
For example:
The compiler accepts several command line options to control the format of listings. By default, no listing is generated at all.
Output full source listing with embedded error messages.
Verbose mode. Full error output with source lines to stdout.
Keep going despite syntax errors.
bash$ m1750-coff-gcc -gnatlqv ackermann.adb XGC Ada m1750-ada/-1.7/ Copyright 1992-2002 Free Software Foundation, Inc. Compiling: ackermann.adb (source file time stamp: 2001-04-25 16:57:54) 1. function Ackermann (m, n : Integer) return Integer is 2. begin 3. if m = 0 then 4. return n + 1; 5. elsif n = 0 then 6. return Ackermann (m - 1, 1); 7. else 8. return Ackermann (m - 1, Ackermann (m, n - 1)); 9. end if; 10. end Ackermann; 11. 11 lines: No errors
The assembler can also generate a listing, as follows:
$ m1750-coff-gcc -Wa,-a -c ackermann.adb 1 .file "ackermann.adb" 2 gcc2_compiled.: 3 __gnu_compiled_ada: 4 .text 5 .global _ada_ackermann 6 _ada_ackermann: 7 0000 B2F0 sisp r15,1 8 0002 9FEE pshm r14,r14 9 0004 81EF lr r14,r15 10 0006 8120 lr r2,r0 11 0008 8101 lr r0,r1 12 .L5: 13 000a 8122 lr r2,r2 14 000c 7A03 jnz .L2 15 000e A200 aisp r0,1 16 0010 7411 j .L6 lots of output...
The objdump program can also generate a listing by disassembling the object code.
$ m1750-coff-objdump -d ackermann.o ackermann.o: file format coff-m1750 Disassembly of section .text: 00000000 <_ada_ackermann>: 0: b2 f0 sisp r15,1 2: 9f ee pshm r14,r14 4: 81 ef lr r14,r15 6: 81 20 lr r2,r0 8: 81 01 lr r0,r1 0000000a <.L5>: a: 81 22 lr r2,r2 c: 7a 03 bnz 3 e: a2 00 aisp r0,1 10: 74 11 br 17 lots of output...