Wednesday, December 14, 2011

How to compile the STMicro UM0424 USB Stack with IAR 6.3

Steps to compile the STMicro UM0424 USB Stack with the newer IAR compiler versions.  Example for IAR 6.3 and  STM3210B-EVAL and Custom_HID project.

For background on this problem see the technical notes from IAR and ST:

IAR Technical Note 75890: CMSIS build problems with IAR Embedded Workbench for ARM 6.20

ST Technical Note TN0830: How to use EWARM 6.2x with projects built with EWARM 6.1 and previous versions

The technical notes explain the problem and the general solution, but here is a specific example that might help, especially if you are using the USB stack.

1. Unzip um0424.zip and open the workspace in the following path:
STM32_USB-FS-Device_Lib_V3.3.0\Project\Custom_HID\EWARM

2. Select the target board (STM3210B-EVAL) in the workspace dropdown.


3. Bring up the project options with ALT-F7 or from the menu under Project - Options.
4. Under General Options, select the tab Library Configuration, under CMSIS, check USE CMSIS.



5. Select Catagory C/C++ Compiler, under tab Preprocessor, go to Additional include directories.  Remove the two CMSIS dirs.


The following directories are left:

$PROJ_DIR$\..\inc
$PROJ_DIR$\..\..\..\Libraries\STM32_USB-FS-Device_Driver\inc
$PROJ_DIR$\..\..\..\Libraries\STM32F10x_StdPeriph_Driver\inc
$PROJ_DIR$\..\..\..\Utilities\STM32_EVAL
$PROJ_DIR$\..\..\..\Utilities\STM32_EVAL\Common
$PROJ_DIR$\..\..\..\Utilities\STM32_EVAL\STM3210B_EVAL

Click OK to save the changes to project options.

6.  Copy three files from the unused CMSIS directory to your project directories.
A.  Copy the following two files
  system_stm32f10x.h
  stm32f10x.h
from this directory:
  STM32_USB-FS-Device_Lib_V3.3.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
to this one:
  STM32_USB-FS-Device_Lib_V3.3.0\Project\Custom_HID\inc

B.  Copy the following file
  system_stm32f10x.c
from this directory:
  STM32_USB-FS-Device_Lib_V3.3.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
to this one:
  STM32_USB-FS-Device_Lib_V3.3.0\Project\Custom_HID\src

7. Add system_stm32f10x.c in src to the User folder in the workspace.

8. Remove the CMSIS directory from your project.



9. Rebuid All

No comments: