Difference between revisions of "GCC Toolchain for CoreSTM32"

From Microduino Wiki
Jump to: navigation, search
(Why GCC toolchain)
 
(5 intermediate revisions by one other user not shown)
Line 15: Line 15:
 
* Sourcery CodeBench Lite(formerly Code Soucery). http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
 
* Sourcery CodeBench Lite(formerly Code Soucery). http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
  
 +
It is said that Sourcery CodeBench Lite has better performance than other compilers, but we haven't made any test.
  
 
= Using IDE(Integrated Development Environment) =
 
= Using IDE(Integrated Development Environment) =
Line 22: Line 23:
 
* Eclipse: http://www.eclipse.org/downloads
 
* Eclipse: http://www.eclipse.org/downloads
 
* CooCox IDE(Eclipse based): http://www.coocox.org/index.html
 
* CooCox IDE(Eclipse based): http://www.coocox.org/index.html
* 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
 +
 +
 +
== Setting up Eclipse and GNU ARM plugin ==
 +
 +
* In order to use Eclipse you should first download a Java Runtime, or you can use Java within Arduino IDE.
 +
* Find your "System Preference", add environment variables for Java: PATH and JAVA_HOME, you can find tutorials online.
 +
 +
* Download Eclipse for C/C++ : http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunar
 +
* Extract eclipse files, run eclipse.exe
 +
* Click Help->Install New Software
 +
[[File:Eclipse_for_STM32_01.png|600px|thumb|center|Install GNU ARM plugin for Eclipse]]
 +
 +
* Follow the instructions on http://gnuarmeclipse.livius.net/blog/plugins-install/
  
 
= Testing Program: Blink =  
 
= Testing Program: Blink =  

Latest revision as of 07:18, 19 July 2016

Why GCC toolchain

  • 100% opensource and free
  • Controll everything of CoreSTM32
  • Discover 100% power of STM32 micro processor. Much higher performance compared to Maple IDE.

Setting up GCC toolchain

You have two choices:

OR

It is said that Sourcery CodeBench Lite has better performance than other compilers, but we haven't made any test.

Using IDE(Integrated Development Environment)

I prefer Eclipse, but you have multiple choices, like


Setting up Eclipse and GNU ARM plugin

  • In order to use Eclipse you should first download a Java Runtime, or you can use Java within Arduino IDE.
  • Find your "System Preference", add environment variables for Java: PATH and JAVA_HOME, you can find tutorials online.
Install GNU ARM plugin for Eclipse

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++)
      ;
  }
}