Keil project setup for STM32F4 Discovery
- Posted by admin
- on Apr, 20, 2013
- in ARM Microcontroller, ST Micro, STM32, STM32F4 Doscovery
- Blog 4 Comments.
ST Microelectronics provides a rich firmware support with its Discovery Promotion Kits. Its easy to modify the example codes to customize an application. However, here i am trying to explain, How to setup Keil MDK ARM Project for stm32f4 Discovery.
Step 1 : Open latest version of Keil uVision 4 ARM MDK IDE, Older version do not list stm32f407vgt6 device.
Step 2 : Save the project using a suitable name. You need a few libraries to work with STM32F4 or any other ARM Cortex Family. I recommend you to download the standard STM32F4 board support package provided by ST Micro. This BSP has all the necessary library including CMSIS and board specific drivers. Download STM32F4 Discovery BSP here.
Step 3: Extract the stm32f4 discovery bsp package on your local disk. You will find 3 major directories as Libraries, Project and Utilities. We are going to use Libraries and Utilities in further steps. Project directory contains various example projects, but we will be making our own project, still we need Libraries and Utilities directory as it is. So keep these two directories as it is and Make a new folder inside Project directory for new Project.
Step 4 : Choose the Device as STM32F407VG. Keil will ask you whether to copy Startup.s into new project or not. Choose Yes here.
Step 5 : You may have various Source Groups in one project. By default only a single Source group is there, I prefer to make separate source groups each for User sources, MDK codes like StartUp.s and other for other libraries like Third party libraries, Board specific drivers.
Step 6 : Add your own code e.g. main.c into User Codes source group. Add other files into different source groups as shown in figure below.
Almost all the stm32f4 projects require these files named
stm32f4xx_it.c, stm32f4xx_it.h
system_stm32f4xx.c,
stm32f4xx_conf.h,
and misc.c.
Add these 5 files in Other source group as shown in figure above.
Now we are ready to perform some setting in the Project options section.
What all those paths in Include Paths section of C/C++ Tab? Well these are the location of files, which your project compilation depends on. So here is a list of directories that you must include as path in your Keil Project fir stm32f4 Discovery.
- Libraries\CMSIS\Include
- Libraries\CMSIS\ST\STM32F4xx\Include
- Libraries\STM32F4xx_StdPeriph_Driver\inc
- Libraries\STM32F4xx_StdPeriph_Driver\src
- Utilities\STM32F4-Discovery
- The Project folder itself, which has main source code and stm32f4xx_it.c, system_stm32f4xx.c etc.
Comments & Responses
Recent Posts
- Make In India - What it means to Indian Maker’s Community ?
- Breadboard Power Supplies - Read before you Buy One
- Product Review : Discover Wi-Fi extension board for stm32f4 discovery
- Product Review: OKI78SR-5/1.5 Switching Regulator from muRata Power Solutions
- Product Review - STM8S- Discovery by ST Microelectronics
- Know How : Using GSM Modem - Part 2/2
- Know How : Using GSM Modem - Part 1/2
- ST Microelectronics launches STM32 Nucleo Series
- SW18020P Vibration Switch Testing “Shake Switch”
- TCM8230MD Camera Breakout Board PCB, Can also mount AT45DB Series Flash Memory Chip
- IC Packages of Many Kinds - A comprehensive list
- Keil project setup for STM32F4 Discovery
- DIY - 12V 7.2Ah SMF Battery Charger Circuit
- Lonely Night Projects : DIY PMMC and Series Motor Model
- Toys from Trash with Arvind Gupta
- BodyCom Technology by Microchip for Embedded Security & Authentication
- Programmers for Atmel AVR Microcontrollers
- Nikola Tesla - The Greatest Inventor Ever Lived
- Crystal, Resonator and Oscillators, what’s the difference ?
- Pitfalls in STM32 Standard Peripheral Library & Possible Solutions
- Interrupt Driven UART Serial Communication for Atmel AVR
- DIY PICkit2
- What Thomas Edison expected job candidates to know !
- What does ‘AVR’ stands for ?
- Interfacing MCP4725, 12 bit DAC with AVR Microcontroller #avrPrayog
- Interfacing AT93C46 SPI EEPROM with avrPrayog
- How to recover the Unallocated space on Your SD card due to Raspberry Pi OS
- Driving an Alphanumeric LCD with avrPrayog
- Using Arduino/Freeduino as AVR ICSP Programmer
- DoCircuits : Turn your Web Browser into Prototyping Desk
Things You find here
- ADC Interfacing (1)
- Analog Design (4)
- Analog Designs (7)
- Arduino (9)
- ARM Microcontroller (12)
- ARM7 (6)
- Atmel AVR (8)
- Battery Chargers (2)
- Camera Interfacing (1)
- Display (1)
- EAGLE (3)
- EEPROM (2)
- Electrical Enginnering (6)
- Electronics (28)
- General Interest (15)
- General Know How (25)
- GSM Modem (2)
- Hello World (4)
- I2C (2)
- Interfacing Tutorial (15)
- Lonely Night Projects (4)
- LPC21xx (4)
- Make (4)
- mbed (1)
- Microchip (1)
- Microchip PIC (1)
- NXP (4)
- Open Source Ecology (2)
- Open Source Hardware (9)
- PCB Designing (2)
- Physical Computing (5)
- PIC Related (1)
- Power Supply (5)
- Product Review (2)
- Raspberry PI (1)
- Repair Tricks (2)
- SPI (2)
- ST Micro (8)
- STM32 (8)
- STM32F4 Doscovery (8)
- stm8 bit (1)
- Switch Mode Power supply (2)
- Technology (3)
- UART (3)
- Uncategorized (1)
Recently Said
- st1114g on How to recover the Unallocated space on Your SD card due to Raspberry Pi OS
- KpT, on How to recover the Unallocated space on Your SD card due to Raspberry Pi OS
- Neomanderx3 on I2C EEPROM Interfacing with STM32F4 Discovery
- Gábor on DIY PICkit2
- sapher on I2C EEPROM Interfacing with STM32F4 Discovery
- Tonino on DIY PICkit2
- nate on How to recover the Unallocated space on Your SD card due to Raspberry Pi OS
- mahd on TCM8230MD Camera Breakout Board PCB, Can also mount AT45DB Series Flash Memory Chip
- Andrew on How to recover the Unallocated space on Your SD card due to Raspberry Pi OS
- pavan on DIY - 12V 7.2Ah SMF Battery Charger Circuit












Very helpful and appreciate your time and effort in putting this tutorial online.
Jim
Hi;
I’m unable to find “The Project folder itself, which has main source code and stm32f4xx_it.c, system_stm32f4xx.c etc.”
Where is its original file?
I keep getting this output from trying to compile. No idea why I keep getting it…
.\test.axf: Error: L6218E: Undefined symbol main (referred from entry9a.o).
Hi,
This is a really great overview. I just wanted to let you know Keil was recently updated and they don’t ask if you want to include the a start up file(step 5). Instead they open a package installer and you get to choose which libraries to initially start with. You might want to update your post.