- ARM? Cortex? M4 Cookbook
- Dr. Mark Fisher
- 407字
- 2021-07-16 12:43:45
Running an example program
Manufacturers usually make a small number of example programs available that provide a tutorial introduction and demonstrate the potential of their evaluation boards. A simple program that flashes (that is, blinks) a Light-emitting diode (LED) on the board is usually provided. ANSI C is by far the most popular language amongst embedded system programmers, but other high level languages such as C++ and C# may also be supported. A brief introduction to the C programming language is provided in Chapter 2, C Language Programming.
The Examples tab in the pack installer for the STM32F4 series MCUs provides a link to a C program called CMSIS-RTOS Blinky (MCBSTM32F400) that flashes an LED connected to a GPIO port. The program is integrated within an MDK-ARM Project. Integrated development environments such as MDK-ARM usually manage software development tasks as projects, as in addition to the program source code itself, there are other target-specific details that are needed when the code is compiled. A project provides a good container for such things. We review the steps required to create a project from scratch in the next section.
How to do it…
- Invoke uVision5. Open the Pack Installer, and copy the example program to a new folder (name the folder
CMSIS-RTOS_Blinky
). - Connect the evaluation board as described in the previous section. In addition to the ULINK cable, remember to connect a USB cable to supply power to your evaluation board.
- Invoke uVision5 from the taskbar, select Project → Open Project; navigate to the folder named
CMSIS-RTOS_Blinky
, and open the file namedblinky.uvprojx
. - Build the project by selecting Project → Rebuild all target files, and then download the executable code to the board using Flash → Download. Take a moment to locate the Build, Rebuild, and Download shortcut icons on the toolbar as these save time.
- Finally, press the RESET button on the evaluation board, and confirm that Blinky is running. You may notice that the Blinky example program does a little more than just flash one LED.
- Once you have confirmed that your evaluation board is working, close the project (Project → Close Project), and quit uVision5.
How it works…
The program uses some advanced concepts such as CMSIS-RTOS (discussed in Chapter 8, Real-Time Embedded Systems.) to produce a visually interesting flashing LED pattern. We will not attempt to explain the code here, but the next section will develop a much simpler Blinky project called hello_blinky.uvprojx
.
- 虛擬儀器設(shè)計(jì)測(cè)控應(yīng)用典型實(shí)例
- Word 2000、Excel 2000、PowerPoint 2000上機(jī)指導(dǎo)與練習(xí)
- 網(wǎng)上沖浪
- 反饋系統(tǒng):多學(xué)科視角(原書(shū)第2版)
- Dreamweaver 8中文版商業(yè)案例精粹
- 微型計(jì)算機(jī)控制技術(shù)
- Windows 7寶典
- Ruby on Rails敏捷開(kāi)發(fā)最佳實(shí)踐
- 從零開(kāi)始學(xué)JavaScript
- AMK伺服控制系統(tǒng)原理及應(yīng)用
- 3ds Max造型表現(xiàn)藝術(shù)
- 筆記本電腦維修之電路分析基礎(chǔ)
- Hadoop Beginner's Guide
- 自適應(yīng)學(xué)習(xí):人工智能時(shí)代的教育革命
- 伺服與運(yùn)動(dòng)控制系統(tǒng)設(shè)計(jì)