1 download: Sourcery G ++ Lite for ARM EABI
2. Set the compiler path: copy it from the gcc arm and change it to Code Sourcery G ++ Lite.
3. Create an ARM Project
4. Add the STM32 library file, which is similar to mdk.
Note: add the GCC Startup File xxx. s in the gcc_ride7 folder.
5. Add the header file search directory:
6. Add a connection script
7. Add a definition macro:
STM32F10X_MD
USE_STDPERIPH_DRIVER
-Mthumb (Note: m3 only supports thumb Mode)
Then compile the file and then click OK.
After the compilation step is added, the HEX file and code length are obtained:
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)
/*************************************** ***************************/
When _ WFI () and _ WFE () are used, a compilation error occurs: MCPU does not support this statement. It may be necessary to set the MCU to STM32.
However, after I add the compilation option-mcpu = stm32f103c8, the compilation prompt is:
Maybe the current Sourcery G ++ Lite does not support STM32
-Mcpu = cortex-m3-mthumb can be !!
(Http://www.amobbs.com/forum.php? Mod = viewthread & tid = 5538067 & page = 1 # pid6745848 post on the AMO forum for help)