You copied the Doc URL to your clipboard.

"Hello world" example

This example shows how to build a simple C program hello_world.c with armclang and armlink.

Procedure

  1. Create a C file hello_world.c with the following content:
    #include <stdio.h>
    
    main()
    {
        printf("Hello World");
    }
  2. Compile the C file hello_world.c with the following command:
    armclang -c hello_world.c
    

    The -c option tells the compiler to perform the compilation step only.

    The compiler creates an object file hello_world.o

  3. Link the file:
    armlink -o hello_world.axf --force_scanlib hello_world.o 
    

    The -o option tells the linker to name the output image hello_world.axf, rather than using the default image name __image.axf.

    The --force_scanlib option tells armlink to link with the ARM libraries. This option is mandatory when running armlink directly. When armclang calls armlink, this option is automatically enabled.

  4. Use a DWARF 4 compatible debugger to load and run the image. The compiler produces debug information that is compatible with the DWARF 4 standard.