When developing stm32, most people may choose MDK as the development environment, but this is actually a paid product. Coocox IDE is free of charge, but it seems that it is not very well known in China. It is an arm Development Environment Based on Eclipse. In fact, when I did not want to use MDK to build an eclipse environment, this was accidentally discovered. Just re-install the system and record the coocox environment.
First of all, of course is downloaded, the official website to download the latest coocox, and then GCC, this is to find me for half a day, https://launchpad.net/gcc-arm-embedded/+download to download hereGcc-arm-none-eabi-4_8-2014q2-20140609-win32.zip(MD5 ). One is the development environment, the other is the tool chain, and the MDK visual testing uses its own compiler. By the way, you must have at least the following products:
- Stm32 Development Board
- Several LEDs
- St-link Debugger
- Resistance
- Dubang line
- One computer (nonsense)
Connect to the Development Board using st-link. I use the core board of stm32f103zet6, and I have more than 50 members on a certain treasure. After reading this, a friend of mine spoke up, "I will weld this theme to you in minutes "... connect to your computer through USB. Download the genuine St-Link driver from Win8 to the official website, which perfectly supports Piracy... then design a simple circuit. With a small led, it is best to string a resistor with a resistance of about-kb, but the smaller the light, the more powerful it is. The circuit diagram is as follows:
The Gnd end is connected to the Gnd port of the STM Development Board. pc13 is a gpio port, abcdef, and so on. Just select one. After the connection is complete, start programming. Open the coide and create a project. in step 3, select the RCC and gpio drivers, and then modify main. C ,:
1 #include "stm32f10x.h" 2 #include "stm32f10x_gpio.h" 3 #include "stm32f10x_rcc.h" 4 #include "util.h" 5 6 void ledConfig(); 7 int main(void) 8 { 9 10 SystemInit();11 SysTick_Config(SystemCoreClock / 1000);12 ledConfig();13 while(1)14 {15 GPIO_SetBits(GPIOC, GPIO_Pin_13);16 delay_ms(200);17 GPIO_ResetBits(GPIOC, GPIO_Pin_13);18 delay_ms(200);19 }20 }21 void ledConfig()22 {23 GPIO_InitTypeDef gpioType;24 25 RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC , ENABLE);26 //LED -> PC1327 gpioType.GPIO_Pin = GPIO_Pin_13;28 gpioType.GPIO_Speed = GPIO_Speed_50MHz;29 gpioType.GPIO_Mode = GPIO_Mode_Out_PP;30 GPIO_Init(GPIOC, &gpioType);31 }
A timer function is used here, which is defined as follows:
#ifndef _SOLEE_UTIL_H_#define _SOLEE_UTIL_H_#include "cmsis_boot/stm32f10x.h"void delay_ms(u16 ms);#endif
The implementation is as follows:
#include "util.h"volatile u16 _timerDelay;void delay_ms(u16 ms){ _timerDelay = ms; while(_timerDelay);}void SysTick_Handler(void){ if(_timerDelay) _timerDelay --;}
Well, the simple project is over. Compile, download, and run the project. It should be OK ~ Attached a work drawing:
Stm32: coocox IDE environment construction light up led