Create a Project with uVision

Run Keil 𝝁Vision IDE

Project > New 𝝁Vision Project…

Do not use 한글경로 (띄어쓰기) for Project Directory path

Select Device for Target

Device > search for STM32F411RETx

If you use other board, STM32F411 etc, choose the appropriate device.

Manage Run-Time Environment

Select CMSIS>CORE , Device>Setup

This will use necessary library to start the MCU and GPIO drivers.

Check if the following startup codes are included under Device folder

‘startup_stm32f411xe.s’, ‘system_stm32f411xx.c’

Project> Options for Target: (Alt+F7)

Output tab > Create HEX File checked

This will create HEX file that contains the machine instruction codes

C/C++ Tab> Version of C and C++ should be <default>

Linker Tab> Use Memory Layout from Target Dialog checked

This will use the memory(register) layout of the specific target board

Debug tab> Use: ST-Link Debugger > Settings

  • Must connect MCU(internal ST-Link) to PC

  • Use: ST-LInk Debugger

  • Press Settings

  • Debug Adapter> Unit: ST-LINK/V2-1

  • Debug> Connect: under Reset

This will configure USB link to MCU hardware. It will use ST-Link debugger embedded on the target board to debug the program. You will need to connect the target board to your PC for debugging

Create Source file

Project Tab> Target1> Source Group1 Right Click > Add New item to Group

Name the source file as " TU-CreateProject-Main.c"

한글 경로 사용하면 안됨!!

Use sample source codes for test

int main(void){
	int num1 = 1;
	int num2 = 2;
	int numout=num1+num2;		
	printf("hello handong");
	return 0;
}

Build Target (F7)

Press F7 and build the target.

Check if there is any error message

Download Target(F8)

If the MCU is connected to PC, flash the output file by pressing

Flash>Download (F8)

  • For Example 2: Check if the LED_2 of testboard is turned on when button B2 is pressed. (Nucleo-F411RE)

Tips

Instead of starting from a blank project, use example codes and tutorial codes provided by ARM and STM webpage.

Last updated