4.1.1. Create, compile, link, and run

Follow these steps to create, compile, link, and run a simple C program:

  1. Enter the following code using any text editor:

    #include <stdio.h>
    int main(void)
    {
    	printf("Hello World\n");
    	return 0;
    }
    
  2. Save the file as hello.c.

  3. Enter armcc hello.c -o hello to compile and link the code.

    The argument to the -o option gives the name of the file that will hold the final output of the link step. The linker is called by the compiler after compilation. To prevent the compiler from calling the linker, enter the -c compiler option on the command-line. Compiler options are case-sensitive.

  4. Enter armsd hello to execute the code under software emulation. armsd starts, loads the file, and displays the armsd: prompt.

  5. Enter go and press Return. The debugger responds with Hello World, followed by a message indicating that the program terminated normally.

  6. To reload and run the program again enter: reload and then go at the armsd prompt.

    To quit the debugger, enter: quit.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential