Step-by-Step Guide to your own Linux Application • 121
Debugging of User Space Programs
WAGO-I/O-SYSTEM 750
Linux Fieldbus Coupler
5.12.4 Creating an Example Application for Debugging
The section 5.6, “Create your own user space applications” describes how to
create an example program for the Linux fieldbus controller. This program
example also illustrates debugging. Add the following calls to the source
codes:
> cd ~/uclinux-dist/user/newProg
> emacs newProg.c
Enter the following code into the emacs and save it via CTRL-X, CTRL-S:
A subfunction with a counter variable is added to the code in order to be able
to test the functions of the debugger better.
The makefile of section 5.6 is not modified.
Recreate the program. Enter the following calls into the console:
> cd ~/uclinux-dist
> make user
Copy the program to the Linux fieldbus controller, as described in section 5.7.
void printfunc(void)
{
int i = 3;
printf("WAGO world\n");
printf("%d..", i);
i--;
printf("%d..", i);
i--;
printf("%d..\n", i);
return;
}
int main(int argc, char **argv)
{
printf("Hallo\n");
printfunc();
return 0;
}