The development of STM32F10x in Code Blocks

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

1 download: Sourcery G++ Lite for ARM EABI

2 set compiler path: copy from GCC ARM and renamed: Code Sourcery G++ Lite

3 new ARM Project

4 add STM32 library files, similar to MDK

  Note: the need to add the gcc_ride7 folder in the   GCC startup files: xxx.s     and adding core_cm3.c 

5 add header search directory:

6 add connection script

7 add the definition of macro:  



7.1 add and compile options:

  7.1.1  The C99 compile option:   -std=c99 (Note: not MDK --c99)

  7.1.2 CPU framework: -mcpu=cortex-m3 -mthumb (Note: m3 only supports thumb mode)

And then compile the file OK, the

Add the compiled HEX files and steps, the code length:

arm-none-eabi-objcopy.exe -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).hex

arm-none-eabi-size.exe $(TARGET_OUTPUT_FILE)


8 there are still problems:

 The useful to the __WFI () and __WFE () when the compiler error: MCPU does not support this statement, may still where still need to be set to STM32 MCU

But when I joined the compiler option -mcpu=stm32f103c8, compiler hints:  cc1.exe: error: bad value (stm32f103c8) for -mcpu switch

The current Sourcery G++ Lite does not support STM32  

Here for help, hope to know you, leave me a message, to solve this problem, thank you!!!!

Resolved: the addition of compiler options: -mcpu=cortex-m3  -mthumb   can!!

(  Get master help in the back of electronic forums)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Booth at November 17, 2013 - 7:27 PM