Difference between revisions of "GCC Toolchain for CoreSTM32"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{| style="width: 800px;" |- | = Why GCC toolchain = * 100% opensource and free * Controll everything of CoreSTM32 * High performance = Setting up GCC toolchain = You have ...")
 
Line 24: Line 24:
 
* EmIDE: http://emide.org/
 
* EmIDE: http://emide.org/
 
* Code::Blocks: http://www.codeproject.com/Tips/601093/Creating-STM-Microcontroller-Project-in-Code-Blo
 
* Code::Blocks: http://www.codeproject.com/Tips/601093/Creating-STM-Microcontroller-Project-in-Code-Blo
 +
 +
= Testing Program: Blink =
 +
 +
<source lang="cpp">
 +
#include "stm32f10x.h"
 +
#include "stm32f10x_gpio.h"
 +
#include "stm32f10x_rcc.h"
 +
 +
int main(void) {
 +
 +
int i;
 +
GPIO_InitTypeDef GPIO_InitStructure;
 +
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
 +
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
 +
 +
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
 +
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 +
GPIO_Init(GPIOA, &GPIO_InitStructure);
 +
 +
while (1) {
 +
 +
GPIO_SetBits(GPIOA, GPIO_Pin_8);
 +
 +
/* delay */
 +
for (i = 0; i < 0x1000000; i++)
 +
;
 +
GPIO_ResetBits(GPIOA, GPIO_Pin_8);
 +
 +
/* delay */
 +
for (i = 0; i < 0x1000000; i++)
 +
;
 +
}
 +
}
 +
 +
</source>
 +
 
|}
 
|}

Revision as of 15:52, 15 July 2014

Why GCC toolchain

  • 100% opensource and free
  • Controll everything of CoreSTM32
  • High performance

Setting up GCC toolchain

You have two choices:

OR


Using IDE(Integrated Development Environment)

I prefer Eclipse, but you have multiple choices, like

Testing Program: Blink

#include "stm32f10x.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"

int main(void) {

	int i;
	GPIO_InitTypeDef GPIO_InitStructure;
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;

	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(GPIOA, &GPIO_InitStructure);

	while (1) {

		GPIO_SetBits(GPIOA, GPIO_Pin_8);

		/* delay */
		for (i = 0; i < 0x1000000; i++)
			;
		GPIO_ResetBits(GPIOA, GPIO_Pin_8);

		/* delay */
				for (i = 0; i < 0x1000000; i++)
					;
	}
}