ARM Cortex STM Discovery Kit Programming Hints

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

ARM Cortex STM Discovery Kit Programming Hints

1. Install Keil vison 4 (MDK-ARM 4.20 should be installed to support the embedded
STLINK/V2)
2. Install the ST-LINK/V2 driver by running the ST-Link_V2_USB.exe from [MDKARM_INSTALL_DIRECTORY]\ARM\STLink\USBDriver\ST-Link_V2_USBdriver.exe
3. Check jumper position on the board, JP1 on, CN3 on (Discovery selected)
4. Connect the STM32L-Discovery board to a PC with a USB cable to power the board.
5. Open an existing STM32L-Discovery Project / New Project
6. In vison 4 options for target, select ST-Link Debugger under debug
7. Rebuild all files and start the debugger which will also load your image into target flash
memory
8. End the debug session and press reset on the board to run the example without
debugger
Steps of writing a new STM32L-Discovery Program
1. Use startup_stm32l1xx_md.s just like startup.A51 in 8051 programming
a. STM32L1xx Ultra Low Power Medium-density Devices vector
table for MDK-ARM toolchain.
b. This module performs:
i. Set the initial SP
ii. Set the initial PC == Reset_Handler
iii. Set the vector table entries with the exceptions ISR address
iv. Branches to __main in the C library (which eventually
v. calls main()).
vi. After Reset the CortexM3 processor is in Thread mode,
vii. priority is Privileged, and the Stack is set to Main.
2. In main.c write the application program
3. New Project -> STM32L152RB

Using the MDK-ARM Microcontroller Development Kit by Keil

Building an existing MDK-ARM project


1. Open the MDK-ARM Vision4 IDE, debugger, and simulation environment.
Figure 2 shows the basic names of the windows referred to in this document.
Figure 20. MDK-ARM Vision4 IDE environment

2. In the Project menu, select Open Project... to display the Select Project File dialog box.
Browse to select the STM32L-Discovery.uvproj project file and click Open to launch it in the
Project window.
3. In the Project menu, select Rebuild all target files to compile your project.
4. If your project is successfully compiled, the following window is displayed.

You might also like