Porting the STM32 firmware library in IAR (ewarm)

Source: Internet
Author: User

I. Description of the transplant environment

(1), WIN10 system

(2), IAR (ewarm) 7.7

(3), STM32 standard firmware library 3.5.0 http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/ Stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32054.html

Second, the transplant procedure

(1), first establish a C language of the main project (or empty project), as shown in:

(2), copy the STM32 firmware library to the project directory, and add the firmware library file to the project, the project directory after the file is added is as follows:

The assembly files in the Startup folder are selected according to the device used, the flash<=32k is small capacity, the 64k<=flash<=128k is medium capacity, and the flash>=256 is large capacity:

STARTUP_STM32F10X_CL.S Interconnect devices, stm32f105xx,stm32f107xx
Startup_stm32f10x_hd.s Large-capacity stm32f101xx,stm32f102xx,stm32f103xx
STARTUP_STM32F10X_HD_VL.S Large-capacity stm32f100xx
Startup_stm32f10x_ld.s Small-capacity stm32f101xx,stm32f102xx,stm32f103xx
STARTUP_STM32F10X_LD_VL.S Small-capacity stm32f100xx
Stm32f101xx,stm32f102xx,stm32f103xx of capacity in Startup_stm32f10x_md.s
STM32F100XX of capacity in STARTUP_STM32F10X_MD_VL.S
Startup_stm32f10x_xl.s Flash in 512K to 1024K bytes of stm32f101xx,stm32f102xx,stm32f103xx

(3), add the header file contains:

This time the compilation will error: Fatal error[pe035]: #error directive: "Please select first the target stm32f10x device used in your application (in stm32f10x.h file) "E:\project\IARProject\BaseVersion\Libraries\CMSIS\DeviceSupport\stm32f10x.h 96

Turn on the # define STM32F10X_MD and # define USE_STDPERIPH_DRIVER two macros in stm32f10x.h to compile again.

This time error: error[pe147]: Declaration is incompatible with "__nounwind __interwork __softfp unsigned long __get_psp (void)" (DE Clared at line, D:\Program Files (x86) \iar systems\embedded E:\project\IARProject\BaseVersion\Libraries\CMSIS\ Coresupport\core_cm3.h 1084, such as a series of errors, this is due to Core_cm3.h header files, you need to remove the firmware library core_cm3.h (delete or rename), with the IAR core_cm3.h file. and select Use Cmsis in the library configuration of the project options, such as:

(4), from the Standard template project copy Stm32f10x_conf.h to the project root directory, and the root of the condition to the end of the file search path, compile again can pass; however, a warning message appears:

WARNING[25]: Label ' reset_handler ' is defined pubweak in a section implicitly declared root E:\project\IARProject\BaseVers A series of warnings such as Ion\libraries\cmsis\devicesupport\startup\startup_stm32f10x_md.s 124.

You need to change SECTION.text:CODE:REORDER (1) in the Startup_stm32f10x_md.s file to section. Text:CODE:REORDER:NOROOT (1).

Details are as follows:

Before version 7.1, section was noroot by default, but now it is root. You can change section. Text:CODE:REORDER (1) to section Text:CODE:REORDER:NOROOT (1) or section. Text:CODE:REORDER:ROOT (1). Note the difference between noroot and root, noroot means that if the symbol is not associated, it is optimized, and if you want to not be optimized, use root.

The porting of the STM32 firmware library to the IAR is now complete.

Porting the STM32 firmware library in IAR (ewarm)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.