Keil Logo

Hello: Your first Embedded Program

The HELLO sample program is located in ..\Examples\Hello folder helps you to confirm the correct installation of the toolchain. HELLO does nothing more than print the text "Hello World" to the serial port. The entire program is contained in a single source file HELLO.C.

This small application helps you confirm that you can compile, link, and debug an application which is performed with a µVision project file. The hardware for HELLO example typically operates on various microcontroller devices. The only on-chip peripheral used is the serial port (along with a baudrate generator). You do not actually need a target CPU because µVision3 lets you simulate the hardware required for this program.

HELLO Project File

In µVision, applications are maintained in a project file. A project file has been created for HELLO. To load this project, select Open Project from the Project menu and open HELLO.UV2 from the folder …\ARM\GNU\EXAMPLES\HELLO.

Select Project Dialog

Editing and Building HELLO.C

You can now edit HELLO.C. Double click on HELLO.C in the Files page of the Project Workspace. µVision3 loads and displays the contents of HELLO.C in an editor window.

Build Target Button When you are ready to compile and link your project, use the Build Target command from the Project menu or the Build toolbar. µVision3 begins to translate and link the source files and creates an absolute object module that you can load into the µVision3 debugger for testing. The status of the build process is listed in the Build page of the Output Window.

Build Output Window

Notes

  • You should encounter no errors when you use µVision3 with the provided sample projects.

Testing and Debugging HELLO.C

Start/Stop Debug ButtonOnce the HELLO program is compiled and linked, you can test it with the µVision3 debugger. In µVision3, use the Start/Stop Debug Session command from the Debug menu or toolbar. µVision3 initializes the debugger and starts program execution till the main function.

Serial Window 1 Button Open Serial Window #1 that displays the serial output of the application with the Serial Window #1 command from the View menu or the Debug toolbar.

Run Button Run HELLO with the Run command from the Debug menu or toolbar. The HELLO program executes and displays the text "Hello World" in the serial window. After HELLO outputs "Hello World," it begins executing an endless loop.

Run/Stop Button Stop Running HELLO with the Halt command from the Debug menu or the toolbar. You may also type ESC in the Command page of the Output window.

During debugging µVision3 will show the following output:

Debugging the HELLO Project Window

Single-Stepping and Breakpoints

Insert/Remove Breakpoint Button Use the Insert/Remove Breakpoints command from the toolbar or the local editor menu that opens with a right mouse click and set a breakpoint at the beginning of the main function.

Reset Button Use the Reset CPU command from the Debug menu or toolbar. If you have halted HELLO start program execution with Run. µVision3 will stop the program at the breakpoint.

Step Over Button You can single-step through the HELLO program using the Step buttons in the debug toolbar. The current instruction is marked with a yellow arrow. The arrow moves each time you step.

Mouse Pointer Place the mouse cursor over a variable to view their value.

Start/Stop Debug Button You may stop debugging at any time with Start/Stop Debug Session command.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.