0

Migrating STM32F10x FWlib v2.0.3 --> StdPeriph Lib v3.5.0. (Ride7)

Hi,

The STM32F10x demos included with FreeRTOS v8.0.1 appear to all use FWlib v2.0.3, which has since been removed from ST's website.

This is a guide to migrating the CORTEX_STM32F103_Primer_GCC demo to use STM32F10x StdPeriph Library v3.5.0 (released by ST, Apr 2011).  Changes to the demo source code are needed as well as changes to the Ride7 project properties, which are together supported by a single patch file.

The FreeRTOS web documentation for the CORTEX_STM32F103_Primer_GCC demo is here:
    http://www.freertos.org/RTOS_Demo_STM32_Primer_Ride.html

Tools and software versions used in this guide:
    FreeRTOS v8.0.1
    STM32F10x StdPeriph Lib v3.5.0
    Raisonance Ride7 v7.40.12.0145
    Raisonance RKit-ARM v1.44.12.0214
    Raisonance STM32 Primer eval board v1.2

Download the STM32F10x StdPeriph library from ST:
    http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/firmware/stsw-stm32054.zip
    For reference, the copy used here has MD5 sum: 8ba67d1050e4fb4c96260eb9947d216d

Unzip the stsw-stm32054.zip archive into the FreeRTOS tree at:
    FreeRTOS/Demo/Common/drivers/ST/

To save space the following can be safely deleted right away (if so desired):
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/stm32f10x_stdperiph_lib_um.chm       (18.7MB)
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples ( 7.7MB)
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/Utilities                            ( 1.4MB)

As a minimum requirement for projects using the library, the following paths are needed:
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver

Although not strictly required, there is some value in retaining the template files (stm32f10x_conf.h is copied to the project):
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Template

You may wish to retain the licence and release notes for the library:
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/Release_Notes.html
    FreeRTOS/Demo/Common/drivers/ST/STM32F10x_StdPeriph_Lib_V3.5.0/_htmresc

I have prepared a patch to update the CORTEX_STM32F103_Primer_GCC demo to use the new library.  This single patch covers required changes to the source code as well as changes to the Ride7 project properties.  If you want to patch only the source code and change the project properties separately then the patch file will require editing before use.  The patch is prepared against FreeRTOS svn trunk rev. 2279.  It will apply cleanly against the V8.0.1 release.

Download the patch file here:
    http://downloads.gnutronics.com/stm32/20140715.CORTEX_STM32F103_Primer_GCC.patch
    MD5: b359cd39a65e53e050ac3a58263b8feb

Save the patch file to the FreeRTOSv8.0.1 directory.  The following assumes a Cygwin shell.  With Ride7 NOT running, apply the patch:
    ~/FreeRTOSv8.0.1$ patch -p0 < 20140715.CORTEX_STM32F103_Primer_GCC.patch
    patching file FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/FreeRTOSConfig.h
    patching file FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/RTOSDemo.rapp
    patching file FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/RTOSDemo.rprj
    patching file FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/lcd.h
    patching file FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/scheduler.h
    patching file FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/stm32f10x_conf.h
    patching file FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/timertest.c

The following project source files are redundant and can be safely deleted manually (the patch won't do this for you):
    FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/circle_api.h
    FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/crt0_STM32x.c
    FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/stm32f10x_circle_it.c
    FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/stm32f10x_it.h
    FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/stm32f10x_tim.c

If you prefer to edit the Ride7 project properties manually (rather than use the patch as above), firstly you must have edited the patch file before applying it so as to NOT touch the RTOSDemo.* project files.  Then perform the following steps:-

Remove source file from the build:
    ST_Code\crt0_STM32x.c

Add source files to the build:
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_md.s
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c
    ..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c

Remove from the compiler include path:
    $(RkitLib)\ARM\include

Append to the compiler include path:
    $(ApplicationDir)\..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\inc
    $(ApplicationDir)\..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
    $(ApplicationDir)\..\Common\drivers\ST\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\CoreSupport

Append to the compiler defines:
    STM32F10X_MD
    USE_STDPERIPH_DRIVER

The resulting project should build without any warnings or errors.

Regards,
Bernard Boudet

Gnutronics Ltd
http://www.gnutronics.com/

0 comments

Please sign in to leave a comment.