It is often convenient to break up a software project into modules, develop each module, and link the modules together to give the final complete program.
Suppose we have three programs prog.c (top level), module1s.s, and module2c.c (2 C programs and 1 assembly program). You want to create an executable prog.x which includes all three components, and perhaps additional items from the C libraries. Procedure:
m68k-coff-gcc -m5200 -Wl,-s -Wl,-n -Tsbc5206-srec.ld prog.o module1s.o module2c.o -o prog.x(This should be on a single line.) This will give the executable prog.x which can be serially downloaded to the SBC.
Exercise - PREPARATION.
Write a program to count the number of characters in a string terminated by the letter E. To get practice with linking modules, break up your program into two modules. The first module sets up the string stored in memory and passes (by reference) the string to a subroutine contained in the second module. The second module returns the character count and the first module prints the value to the terminal screen.
ANU Engineering - ENGN3213