Hello: Your first Embedded Program

The HELLO sample program, located in the folder ..\Examples\Hello, can be used to confirm the correct installation of the toolchain. The program prints the text "Hello World" to a serial port. Use this small application to start compiling, linking, and debugging an application with µVision. The example program operates on various devices. The only on-chip peripheral used is the serial port (along with a baudrate generator). A target CPU is not needed. µVision simulates the hardware required for this program.

HELLO Project File

µVision maintains applications in a project file. Load this project using the menu Project - Open Project and open HELLO.UVPROJ from the folder …\ARM\EXAMPLES\HELLO. Projects have the extension .UVPROJ. Older versions have the extension .UV2. Both file types can be opened with µVision. The extension UV2 is converted automatically to UVPROJ.

Editing and Building HELLO.C

Double-click on HELLO.C in the window Project. µVision loads and shows the content of the file in the editor.

Compile and link your application using the button Build or the menu Project - Rebuild all target files. µVision starts translating and linking the source files and creates an absolute object module that can be loaded into the µVision Debugger for testing. The status of the build process is shown in the window Build Output. You should encounter no errors when building sample projects.

Testing and Debugging HELLO.C

Once the program is compiled and linked, start testing it with the µVision Debugger. Use the toolbar button or the menu Debug - Start/Stop Debug Session. µVision initializes the debugger and starts executing the program until the function main is reached. By default, a breakpoint has been set to stop execution there.

Open the Serial window that displays the serial output. Use the toolbar button or the menu View - Serial Windows.

Run the application using the toolbar button or the menu Debug - Run. The program continues executing and displays the text "Hello World" in the serial window. After HELLO outputs "Hello World," it begins executing an endless loop.

Halt program execution with the toolbar button or the menu Debug - Stop. You may also press ESC in the window Command.

Single-Stepping and Breakpoints

Use the toolbar button or the menu Debug - Insert/Remove Breakpoint to maintain breakpoints. Breakpoints can be set or removed also in the editor by clicking into the left gray margin, or by using the context menu.

Reset the CPU using the toolbar button or the menu Debug - Reset CPU. If you have halted HELLO start program execution with Run. µVision will stop the program at the next breakpoint.

Use single-stepping commands from the toolbar or the menu Debug. The instruction that is executed next is marked with an yellow arrow. The arrow moves with each stepping command.

Place the mouse cursor over a variable to view its value.

Stop debugging at any time with the Start/Stop Debug Session command.

The following picture shows a possible screen layout:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值