Home
Getting started with software development toolchains for the
Contents
1. 31 6 1 Building an existing TASKING project 31 6 2 Debugging and running your TASKING project 34 6 3 Creating your first application using TASKING toolchain 35 7 Revision history 39 2 40 DoclD022073 Rev 2 yy UM1451 List of tables List of tables Table 1 Document revision history 39 yy DoclD022073 Rev 2 3 40 List of figures UM1451 List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure 20 Figure 21 Figure 22 Figure 23 Figure 24 Figure 25 Figure 26 Figure 27 Figure 28 Figure 29 Figure 30 Figure 31 Figure 32 Figure 33 Figure 34 Figure 35 Figure 36 Figure 37 Figure 38 Figure 39 Figure 40 Figure 41 Figure 42 Figure 43 Figure 44 Figure 45 Figure 46 Figure 47 Figure 48 4 40 Hardware environment 7 IAR Embedded Workbench IDE environment 8 EWARM project successfully compiled 9 Downloadanddebugbutton 9 IAR Embedded Workbench debugger screen
2. 9 Create new project dialog BOX 10 IR ala eN ead ew wea TE waa Ge EE EO a Bein OP Me OE 10 main cekamplefile 11 Adding files to a project 11 New project file tree structure 11 Configuring project OptionsS 12 General options 12 Linker gt Config Ni cerris EE EG OE AAA a a ai 13 Linker configuration file editor dialog box gt Vector Tabletab 13 Linker configuration file editor dialog box gt Memory Regions tab 13 C C Compiler gt Preprocessortab 14 Debugger gt Setuptab 14 SelectFlashloaders 14 ST Link communication protocol 15 MDK ARM uVision4 IDE environment 16 MDK ARM uVision4 project successfully compiled 16 Starting a MDK ARM uVision4 debugging session 17 MDK ARM IDE workspace 17 Creating anew project
3. 10 40 DoclD022073 Rev 2 7 UM1451 7 Using the IAR Embedded Workbench for ARM To create a new source file in the File menu open New and select File to open an empty editor window where you can enter your source code The IAR Embedded Workbench enables C color syntax highlighting when you save your file using the dialog File gt Save As under a filename with the c extension In this example the file is saved as main c Figure 8 main c example file int mainl roid returnilj Once you have created your source file you can add this file to your project by opening the Project menu selecting Add and adding the selected file Figure 9 Adding files to a project IAR Embedded Workbench IDE Seles File Edit View Project Simulator Tools Window Help iz x int main void F Files i ei return at Options Make F Rebuild All Clean Add Files Add main c Add Group newpre Source Code Control Fol Add the s Remove File Properties If the file is added successfully the following window is displayed Figure 10 New project file tree structure Files pe Eis Ele jnewproj v main c DoclD022073 Rev 2 11 40 Using the IAR Embedded Workbench for ARM UM1451 3 3 2 Configuring project options 1 In the Project Editor right click on the project name and select Options to display the Options dialog box Figure 11 Configuring project options
4. 18 Device selection dialog DOX 18 Copy the STM32 Startup Code dialogbok 19 main cekamplefile 19 Addingsourcefiles 19 New project file tree structure 20 Target Options dialog box Targettab 20 Target Options dialogbok Debugtab 21 Target Options dialog box Utilities tab 21 MDK ARM uVision4 project successfully built 22 TrueSTUDIO workspace launcher dialog DOX 23 Atollic TrueSTUDIO STM3z2 Lite import source select dialog box 24 Atollic TlueSTUDIO STM32 Lite import projects dialogbok 25 TrueSTUDIO project successfully compiled 25 TrueSTUDIO debug windowW 26 TrueSTUDIO workspace launcher dialog DOX 27 TrueSTUDIO C Project dialog bOX www 27 TrueSTUDIO Build Settings dialog bOX 28 TrueSTUDIO software configuration dialogbok 29 TrueSTUDIO Misc Settings
5. lt T UM1451 Yy life augmented User manual Getting started with software development toolchains for the STM32L DISCOVERY and 32L152CDISCOVERY boards Introduction This document provides an introduction on how to use the following software development toolchains with the STM32L DISCOVERY and 32L152CDISCOVERY boards e IAR Embedded Workbench for ARM EWARM by IAR Systems e Microcontroller Development Kit for ARM MDK ARM by Keil e TrueSTUDIO by Atollic e TASKING VX toolset for ARM Cortex M by Altium It provides guidelines to novice users on how to build and run a sample program provided with this document and allows them to create and build their own application When running the sample program supplied with this application note the Red LED LD2 PWR lights up Then the user will be able to run a series of functions VDD voltage measurement STM32L current consumption by pressing the user button B1 to switch from a function to an other please refer to AN3413 Although this application note cannot cover all the topics relevant to software development environments it demonstrates the first basic steps necessary to get started with the compilers debuggers STM32L1xxDISCOVERY stands either for STM32L DISCOVERY or 32L152CDISCOVERY evaluation kit throughout the document Reference documents e STM32L DISCOVERY and 32L152CDISCOVERY user manual UM1079 e STM32L1x current consumption measurement and touch sensi
6. OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT ST PRODUCTS ARE NOT AUTHORIZED FOR USE IN WEAPONS NOR ARE ST PRODUCTS DESIGNED OR AUTHORIZED FOR USE IN A SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS B AERONAUTIC APPLICATIONS C AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS AND OR D AEROSPACE APPLICATIONS OR ENVIRONMENTS WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE THE PURCHASER SHALL USE PRODUCTS AT PURCHASER S SOLE RISK EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR AUTOMOTIVE AUTOMOTIVE SAFETY OR MEDICAL INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS PRODUCTS FORMALLY ESCC QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY Resale of ST products with provisions different from the statements and or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supersedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are
7. Options Rebuild All Clean 2 Inthe Options dialog box select the General Options category open the Target tab and select either Device ST STM32L152xB STM32L DISCOVERY or Device ST STM32L152xC 32L152CDISCOVERY onse Pome Category C C Compiler Assembler Output Converter Custom Build Build Actions Linker Debugger Simulator Angel GDB Server IAR ROM monitor I jet JTAGjet J Aink J Trace TI Stellaris Macraigor PE micro RDI ST LINK Third Party Driver TI XDS 100 CMSISDAP_ID Figure 12 General options Target Output Library Configuration Library Options MI Processor variant 5 Core Cortex M3 Device ST STM32L152xC a Endian mode 9 Little Big BE32 BES 1 The above example is given for the 32L152CDISCOVERY board 12 40 AnalogDevices Atmel Cirrus Ember EnergyMicro Epson Faraday Freescale Fujitsu Hilscher Holtek Infineon Intel Marvell Micronas NetSilicon Nuvoton NXP OKI ONSemiconductor Samsung SiliconLaboratories Socle Sonix ST TexasInstruments Toshiba DoclD022073 Rev 2 Ne ML ae EV CS OS NM NR SR ON OR OS NM VV ON A OS SN ON SPEAr STM32F050 STM32F100 STM32F101 STM32F102 STM32F103 STM32F105 STM32F107 STM32F205 STM32F207 STM32F215 STM32F217 STM32F300 STM32F370 STM32F405 STM32F407 STM32F415 STM32F417 STM32L151 STM32L152 STM32L162 STM32W108 STR710 STR730 STR750 STR910 ors
8. So iS maini at main c 124 0x800175 01 kepa B gdb ap Add new expression pi ST LINK 4 main c 3 DE Outline 33 A GRY eR stm32IDoch stdio h discover board h stm321 discovery lcd h anonymous TSCALIB TypeDef struct int main void this is done through SystemInit function which is called from sta file startup stm3211xx md s before to branch to application main To reconfigure the default setting of SystemInit function refer system_stm321l1xx c file anonymous af J DisplayState_TypeDef enum 4 T DEBUG_SWD_PIN El Console 52 Tasks fe Problems 2 Executables E SWV Trace Log 23 El SWV Console O Memory x bE STM32L152RC elf Embedded C C Application gdb i F T D 5 C Ti i ma ndex e ata cles ime ol C8 PB c we n y y Temporary breakpoint 1 main at src main c 124 lt 124 Overflow packets 0 Wy Writable Smart Insert 219 39 1 The above example is given for the 32L152CDISCOVERY board The debugger in the Atollic TrueSTUDIO can be used to debug source code at C and assembly levels set breakpoints monitor individual variables and watch events during the code execution To run your application from the Run menu select Resume or alternatively click the Resume button in the toolbar 5 3 Creating your first application using TrueSTUDIO toolchain TrueSTUDIO includes a dedicated connect
9. software configuration dialog box al C Project TrueSTUDIO Software configuration Select software settings Runtime library Newlib nano Reduced functionality Use tiny printf sprintf fprintf small code size Generate system calls file enable VO redirection and OS integration Dynamic Heap size Default Optimization Remove unused code dead code removal Remove unused data dead data removal Disable C runtime type information RT TI Disable C exception handling Cancel 6 Verify that the JTAG Probe is ST LINK and click Finish to confirm your settings Figure 43 TrueSTUDIO Misc Settings dialog box C Project TrueSTUDIO Misc Settings Select miscellaneous project settings JTAG Probe ST LINK ST LINK Stollic TrueSTUDTS Lite only supports one type of JTAG probe Please purchase the Professional version to get support For a large number of other types of JTAG probes ry 7 DoclD022073 Rev 2 29 40 Using the Atollic TrueSTUDIO UM1451 30 40 7 8 9 Your project is successfully created Atollic TrueSTUDIO generates target specific sample files main c stm32I1xx_it c in the Project folder to simplify development You can tailor this project to your needs by modifying these sample files Figure 44 TrueSTUDIO project folder example US Project Explorer Za TS NewProject i Includes ET src ES Utilities Libraries HL CMSIS H STM32L1 xx_StdPeri
10. ER vs Cortes Debugger i M Load Application at Startup Fun to main Imitializakio a am Initialization File 7 Link Debugger BEE fe it ortes M R J LINE Al Trace STLink Setup Edit ULINK Pro Cortex Debug ner Cancel 5 Open the Utilities tab select Use Target Driver for Flash Programming and select the ST Link Debugger from the drop down menu 6 Verify that the Update Target before Debugging option is selected 7 Click OK to save your settings Figure 32 Target Options dialog box Utilities tab Options for Target Target 1 Device Target Output Listing User CC Asm Linker Debug Configure Flash Menu Command use Target Driver for Flash Programming ULINK Cortes Debugger Settings a pdate Target before Debugging er ULINE Cortes Debugger e Init File RDI Interface Driver fe Edit Stellaris IEDI Signum Systema JT AG jet C Use Externe apenas prayer EE MANE Trace Arguments Rurlride pendent FREE N Cancel Defaults 8 Inthe Project menu select Build Target d DoclD022073 Rev 2 21 40 Using the MDK ARM microcontroller development kit by Keil UM1451 9 If your project is successfully built the following window is displayed Figure 33 MDK ARM uVisiond project successfully built Build Outp Build target Target 1 assembling Startup stms2llxx_md s compiling main C linking Program Size Code 340 RO data 260 Ril data 0 sl da
11. not ask again 2 When the TASKING toolset displays the Welcome window click Go to workbench to open the main window From the File menu select New gt TASKING VX toolset for ARM C C Project 3 Inthe New C C Project dialog box enter the new Project name then in the Project type box select TASKING ARM Application and click Next Figure 53 TASKING New C C Project dialog box New C C Project C C Project Create a new C C project for the TASKING VX toolset For ARM Project name NewProject gt mms Eed v Use default location Project type 7 ET TASKING ARM Application gt ojec Helo World C Project Helo World C Project LJ TASKING ARM Library gt Lo TASKING ARM MIL Library 7 DoclD022073 Rev 2 35 40 Using Altium TASKING toolset UM1451 4 From the list of supported devices select either STMicroelectronics gt STM32L152 gt STM32L152RC as shown below in Figure 54 Figure 54 Processor selection Processor selection STM32F437 SC STM32L151 B 4 STM32L152 STM32L152C6 CL STM32L152C8 STM32L152CB 1 STM32L1520C _ STM32L152QD 1 STM32L152R6 _ STM32L152R8 _ STM32L152RB STM32L152RC 1 STM32LISZRD 1 When using on STM32L DISCOVERY select STM32L152RB 5 To configure the project for STM32L1xxDISCOVERY board select Debug gt Debug configurations and choose STMicroelectronics STM32L Discovery Kit Choosing STMicroelectronics STM32L Discovery Kit as t
12. 0 Warnings 0 ST STM32L152x6 ST STM32L152x8 ST STM32L152xB ST STM32L152xC ST STM32L152xD 7 UM1451 Using the IAR Embedded Workbench for ARM 3 Select the Linker category open the Config tab in the Linker configuration file pane select Override default and click Edit to display the Linker configuration file editor Figure 13 Linker gt Config tab Assembler Output Converter Config Libray Input Output List define Diagnostics Custom Build Build Acti Linker configuration file Debugger Override default Simulator 4 Inthe Linker configuration file editor dialog box open the Vector Table tab and set the intvec start variable to 0x08000000 Figure 14 Linker configuration file editor dialog box gt Vector Table tab Linker configuration file editor vector Table Memory Regions StackiHeap Sizes Jintvec start Ox08000000 Cancel 5 Open the Memory Regions tab and enter the variables as shown in Figure 15 Figure 15 Linker configuration file editor dialog box gt Memory Regions tab Linker configuration file editor vector Table Memory Regions Stack Heap Sizes End Ox08000000 020601 FFFF Ox20000000 oxz20004000 6 Click Save to save the linker settings automatically in the Project directory 7 If your source files include header files select the C C Compiler category open the Preprocessor tab and specify their paths as shown in Figure 16 The path of t
13. A bl RTC Configuration ooo i PUR VoltageScalimgconfigi PUA VolteageScaling angeli ve enea Sf 4 00 60 move EO Hoken T int main ivoid RCC Configuration 800i i ra D mere i Ts El E k Sana YA Tacks dag ols Debug STMSZL I SIRC 32L ISSC DISCOVERY Starring Debugger Trial version license F daya remaining TASKING WX toolset for ARR debugger Build 202 Copyright 2005 2013 Altius Hy ki The above example is given for the 32L152CDISCOVERY board UM1451 The TASKING debugger can be used to debug source code at C and assembly levels to set breakpoints to monitor individual variables and to watch events during code execution To run your application select Resume from the Run menu or alternatively click the Resume button in the toolbar DoclD022073 Rev 2 7 UM1451 Using Altium TASKING toolset 6 3 Creating your first application using TASKING toolchain The debug session is launched as follows 1 Open TASKING VX Toolset for ARM Cortex The program launches and requests the workspace location Browse to select an existing workspace or enter a new workspace location and click OK to confirm Figure 52 TASKING Workspace Launcher dialog box Workspace Launcher Select a workspace TASKING VX toolset for ARM Cortex v3 2r1 stores your projects in a folder called a workspace Choose 4 workspace folder to use for this session Workspace c NewWorkspace v C Use this as the default and do
14. C project of selected type Project name NewProject W Use default location CA SVN 32LRC Discovery fw for porting Projects Browse Project type Toolchains 4 2 Executable E Atollic ARM Tools 8 Empty Project PCC Project gt Shared Library gt E Static Library gt E Makefile project Show project types and tealchains only if they are supported on the platforr Finish Cancel 1 The above example is given for the 32L152CDISCOVERY board 7 DoclD022073 Rev 2 27 40 Using the Atollic TrueSTUDIO UM1451 4 Inthe TrueSTUDIO Build Settings dialog box select either the STM32L152xB STM32L DISCOVERY or the STM32L152xC 32L152CDISCOVERY as microcontroller and configure the other settings as shown in Figure 47 and click Next Figure 41 TrueSTUDIO Build Settings dialog box TrueSTUDIO Hardware configuration Select hardware settings Target Vendor STMicroelectronics Microcontroller STM32L152RC g Floating point Software implementation Floating point unit Mone Instruction set ARM Thumb Thumb Endianess Big endian Little endian sB Nets o Finish Cancer e 1 The above example is given for the 32L152CDISCOVERY board 7 28 40 DoclD022073 Rev 2 UM1451 Using the Atollic TrueSTUDIO 5 Inthe TrueSTUDIO software configuration dialog box you can select one of the two available versions of newlib Runtime library and optimization options Figure 42 TrueSTUDIO
15. INK V2 interface The STM32L1xxDISCOVERY board includes an ST LINK V2 embedded debug tool interface that is supported by the following software toolchain versions EWARM Version 6 50 3 and later available from www iar com Installing the EWARM toolchain using the default settings results in the toolchain being installed in the C Program Files IAR Systems Embedded Workbench 6 2 directory on the PC s local hard disk After installing EWARM 6 20 4 install the ST LINK V2 driver by running the ST Link V2 USB exe from AR_INSTALL_DIRECTORY Embedded Workbench 6 2 arm drivers S T Link ST Link_V2_USBdriver exe MDK ARM Version 4 71 and later available from www keil com Installing the MDK ARM toolchain using the default settings results in the toolchain being installed in the C Keil directory on the PC s local hard disk the installer creates a start menu uVision4 shortcut When connecting the ST LINK V2 tool the PC detects new hardware and asks to install the ST LINK V2 USB driver The Found New Hardware wizard appears and guides you through the steps needed to install the driver from the recommended location TrueSTUDIO Version 4 0 0 and later available from www atollic com Installing the TrueSTUDIO toolchain using the default settings results in the toolchain being installed in the C Program Files Atollic directory on the PC s local hard disk The S7 Link_V2_USB exe is installed automatically when installing the software t
16. Please Read Carefully Information in this documentis provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections modifications or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein No license express or implied by estoppel or otherwise to any intellectual property rights is granted under this document If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION
17. Project menu and click Build Project 8 If your project is compiled successfully the following window is displayed Figure 50 TASKING project successfully compiled 1 The above example is given for the 32L152CDISCOVERY board d DoclD022073 Rev 2 33 40 Using Altium TASKING toolset 6 2 34 40 Debugging and running your TASKING project Figure 51 shows the first step for debugging and running your TASKING project From the project toolbar menu select either Debug gt Debug STM32L152RC 32L152C DISCOVERY or Debug gt Debug STM32L152RB STM32L DISCOVERY 1 Figure 51 TASKING debug window TASKING Gebog STAILI SARC 32701 5 2EDISCOVERY Vilerimain c TASKING WY taalsei for ARM Cortes wi dr1 Fi EA Source Rakia kajaa Search Poad Deg Widow Help oe ae TI TASKING Debug z ri mt eet Se a x woe E E dek AA me TS Mane Cit TE febug H i ey g Bees orde F ER KIMBIA GAISE TAKI eH ati j ee Seriar ones SIM Dera STEEL 1EZF a Trread AA MI Sumeria Brean bit ee E 2 man man cs 123 Chel 20 Poppet Haien Die as 09 Reet Handeni OE h IE ai Handeni DoE bas 17 Rasa Handeni DOE h I Mei Hae OOS h HE Para ai h Mei BT had ri Dae mb Be n ir Required preconditions None Fa bike ass Doiii AE main void ODBOMEEI 30 bs push E4 5 LE DOxDBODDEES da 4c Lide c4 BE Ox128 ROC Configuration i s OIxDAOINEasA DO YA 7c fe Bl RTC _Comfigucation DONNA G1 f0 Ta T
18. a User H lt At this stage the microcontroller clock settin Es a this is done through SystemInit function wh ject m Messages Building configuration Project STM32L152RC 32L152C DISCOVERY Updating build tree B Debug log Buld Goto 0x08000000 Memory i A 08000000 08000010 08000020 08000030 08000040 085000050 08000060 08000070 Ready Errors 0 Warnings 0 1 The above example is given for the 32L152CDISCOVERY board Kyy DocID022073 Rev 2 9 40 Using the IAR Embedded Workbench for ARM UM1451 To run your application from the Debug menu select Go or alternatively click the Go button in the toolbar ut a x 3 3 Creating your first application using the EWARM toolchain 3 3 1 Managing source files 1 Inthe Project menu select Create New Project and click OK to save your settings Figure 6 Create new project dialog box Create New Project Tool chair Project templates oo Empty project asm 5 C El C DLIB Externally built executable Description Creates an empty project 2 Name the project NewProject ewp for example and click Save to display the IDE interface Figure 7 IDE interface 2 IAR Embedded Workbench IDE SEE File Edit View Project Simulator Tools Window Help Ol NewProje NewProject Messages Configuration is up to date EL IS EIE IE m 5 FA Build Debug Log
19. dialog DOK 29 TrueSTUDIO project folder example 30 TrueSTUDIO project successfully built 30 TASKING workspace launcher dialog DOX 31 TASKING VX Toolset for ARM Cortex welcome screen 31 TASKING import source select dialogbok 32 DoclD022073 Rev 2 UM1451 Figure 49 Figure 50 Figure 51 Figure 52 Figure 53 Figure 54 Figure 55 Figure 56 Figure 57 Figure 58 List of figures TASKING import projects dialog DOX 33 TASKING project successfully compiled 33 TASKING debug window SS SS SE SE SS ee eee eens 34 TASKING Workspace Launcher dialog bOX 39 TASKING New C C Project dialogbok 35 Processor selection 36 Debug configurations 36 TASKINGImportdialogbhok 37 Adding a new source file window 37 Tasking project successfully built 38 DoclD022073 Rev 2 5 40 Overview of STLINK V2 interface UM1451 6 40 Overview of STL
20. elect Import from the File menu to display the Import dialog box 7 DoclD022073 Rev 2 31 40 Using Altium TASKING toolset UM1451 4 Inthe Import window open General select Existing Projects into Workspace and click Next Figure 48 TASKING import source select dialog box Import Select Create new projects From an archive File or directory Select an import source 2 General archive File EI Existing Projects into Workspace L3 File System 2 Preferences HL cjo EE cvs k Install L gt Run Debug HE TASKING C C ilk Team 7 32 40 DoclD022073 Rev 2 UM1451 Using Altium TASKING toolset 5 Click Select root directory browse to the TASKING workspace folder and select the STM32L152RC 32L152C DISCOVERY and one for the STM32L152RB STM32L DISCOVERY project Figure 49 TASKING import projects dialog box Import Import Projects a Select a directory to search For existing Eclipse projects j J sd Select root directory C 32LRC Discovery Fwi Project sHAI Projects STMS2L152R0 32L152C DISCOVERY 60 32 LRC Disec Select All Deselect All E Copy projects into workspace working sets Add project to working sets 1 The above example is given for the 32L152CDISCOVERY board 6 Inthe Projects window click Finish 7 Inthe Project Explorer select either STM32L152RC 32L152C DISCOVERY and one for the STM32L152RB STM32L DISCOVERY project Open the
21. he include directory is a relative path and always starts with the project directory location referenced by PROJ DIRS d DoclD022073 Rev 2 13 40 Using the IAR Embedded Workbench for ARM UM1451 Figure 16 C C Compiler gt Preprocessor tab CIT Compiler Assembler Output Converter Language Code Optimizations Output List Preprocessor D 43 Custom Build Build Actions C Ignore standard include directories TOOLKIT_DIR MINCA Linker Debugger Additional include directories one per line Simulator Angel GDB Server IAR ROM monitor 8 To setup the ST Link embedded debug tool interface select the Debugger category open the Setup tab and select ST Link from the drop down Driver menu Figure 17 Debugger gt Setup tab 4ssembler EE Output Converter Setup Download Images Extra Options Plugins Custom Build Build Actions i Run ta Debugger Simulator Setup macras Angel C Use macro file s GDB Server EER EN ne N NE EG 9 Open the Download tab and select Use Flash loader s Figure 18 Select Flash loaders Output Converter Setup Download Images Extra Options Plugins Custom Build Build Actions inke Verify download Attach to program Debugger C Suppress download w Use flash loaders C gt GDB Server C Override default board file 7 14 40 DoclD022073 Rev 2 UM1451 Using the IAR Embedded Workbench for ARM 10 Select the ST Link category ope
22. he evaluation board automatically adds the needed linker file and configures the project as follows Microcontroller STM32L152RC Debug probe ST LINK Connection Serial Wire Debugging SWD Figure 55 Debug configurations toes Window Help 1 The above example is given for the 32L152CDISCOVERY board 6 To add source file to your project right click on the project from the C C project window and select Import 7 From the Import dialog box select General and the desired file as shown in Figure 56 TASKING Import dialog box 7 36 40 DoclD022073 Rev 2 UM1451 7 8 9 10 11 Using Altium TASKING toolset Figure 56 TASKING Import dialog box import Select Create new projects from an ercteve file of directory Select an import source zi i gt General F e Fa la Archive Fie Existing Projects into workspace Preferences CiC cys iS Run Debug La TASKING C C gt Team Click Next Fill the displayed window as following and then browse to your source file Figure 57 Adding a new source file window From directory C C p sa aa Ermm gt za Fiker Types Select All Deselect All Into folder Project Options C Overwrite existing resources without warning _ Create top level folder lt Create links in workspace Create virtual Folders Create link locations relative to PROJECT_LOC v Select main c and click Finish To build you
23. ion to the STM32LxxDISCOVERY board When choosing this connection all required files startup file firmware library etc are added to the workspace and sample files are generated in the project folder to simplify development The debug settings are automatically configured by selecting either the STM32L152xB STM32L DISCOVERY or the STM32L152xC 32L152CDISCOVERY as microcontroller 1 Open the TrueSTUDIO STM32 product folder and select the Atollic TrueSTUDIO STM32 product name The program launches and asks for the Workspace location Browse to select an existing workspace or enter a new workspace location and click OK to confirm 7 26 40 DoclD022073 Rev 2 UM1451 Using the Atollic TrueSTUDIO Figure 39 TrueSTUDIO workspace launcher dialog box al Workspace Launcher Select a workspace Atollic TrueSTUDIO for ARM Pro stores your projects in a folder called a workspace Choose a workspace folder to use for this session Workspace CA32LRC Discovery fw Projects AN3964 Temperature_sensor TrueSTUDIO Copy Settings 1 The above example is given for the 32L152CDISCOVERY board 2 When the Atollic TrueSTUDIO displays its Welcome window click Start using TrueSTUDIO to open the main window In the File menu select New and click C Project 3 Name the new project in the Project type pane select STM32 C Project and click Next Figure 40 TrueSTUDIO C Project dialog box a C Project C Project Create
24. m Intemal Mode oo Privilege Stack States Sec El Project Registers Memory 1 Address 20000000 0x08001B4D 0x200004D0 0x00000000 008001699 0x08001E30 0x08001E30 k200004D0 Ox080001A5 0x08001B4C 0x61000000 Thread Privileged MSP 13100322 1 31003220 E EIE IE 8 roer Har oe oem a E Disassembly 134 RCC Configuration 135 136 Configure RTC Clocks 137 RTC Configuration 138 139 Set internal voltage regulator to 1 8V 0x08001B50 F7FFFCO8 BL W RTC Configuration 0x08001364 140 PWR VoltageScalingConfig PWR VoltageScaling Rangel 141 142 Wait Until the Voltage Regulator is ready 0x08001B54 F44F6000 MOV r0 0x800 int main void lt At this stage the microcontroller clock setting is already coni this is done through SystemInit function which is called fre file startup stm32llxx md s before to branch to application To reconfigure the default setting of SystemInit function 1 system stm321ixx c file mi Configure Clocks for Application need RCC Configuration Configure RIC Clocks RTC Configuration DoclD022073 Rev 2 17 40 Using the MDK ARM microcontroller development kit by Keil UM1451 4 3 Creating your first application using the MDK ARM toolchain 4 3 1 Managing source files 1 Inthe Project menu select New uvision Project to display the Create Project File dialog box Name the new p
25. menu and click Build Project 8 If your project is successfully compiled the following window is displayed Figure 37 TrueSTUDIO project successfully compiled El Problems 4 Tasks El Console 3 E Properties dL e GE BE Exe et Ele a 7 O CDT Build Console STM32L152RC 32L152C Discovery C Program Files x86 Atollic TrueSTUDIO for ARM Pro 4 6 ide jre bin java jar C Program Files x86 Atollic TrueSTUDIO for ARM Pro 4 6 Tools arm atollic reports jar sizeinfo STM32L152RC elf Generate build reports Print size information text data bss dec hex Tilename 23492 1376 546 25 416 6348 STM32L152RC elf Print size information done Generate build reports done 17 31 35 Build Finished took 55 96ms 1 The above example is given for the 32L152CDISCOVERY board 7 DoclD022073 Rev 2 25 40 Using the Atollic TrueSTUDIO UM1451 5 2 Debugging and running your TrueSTUDIO project In the Project Explorer select the project and press F11 to start a debug session see Figure 38 Figure 38 TrueSTUDIO debug window E Debug STM32L152RC 32L152C Discovery User main c Atollic TrueSTUDIO for ARM Pro rim File Edit View Run Window Help 8B as Er R ev v 00o m E FEY 5 Debug Hie C C Debug 23 SP i gt 8 2 82 i Y o B s R mMM EINA T 4 E STM32L152RC elf Embedded C C Application gt G oH Dimi a NJ STM32L152RC elf Ex i T Val 4 9 Thread 1 lt main gt Suspended Breakpoint
26. n the ST6Link tab and select SWD as the connection protocol Figure 19 ST Link communication protocol Assembler EET Output Converter ST Link Custom Build Build Actions Linker Debugger Simulator Interface UTAG gle SOEN SDB Server TAR ROM monitor J Link J Trace LMI FTDI Macraigor RDI 11 Click OK to save the project settings 12 To build your project follow the instructions given in Section 3 1 Building an existing EWARM project on page 8 13 Before running your application establish the connection with the STM32L1xxDISCOVERY board as described in Section 2 Hardware environment setup on page 14 To program the Flash memory and begin debugging follow the instructions given in Section 3 2 Debugging and running your EWARM project on page 9 d DoclD022073 Rev 2 15 40 Using the MDK ARM microcontroller development kit by Keil UM1451 4 Using the MDK ARM microcontroller development kit by Keil 4 1 Building an existing MDK ARM project 1 Open the MDK ARM uVision4 IDE debugger and simulation environment Figure 2 shows the basic names of the windows referred to in this document Figure 20 MDK ARM wVision4 IDE environment Visona SVCS Window Help gt LEE EE Jj IG MM Output Window 2 In the Project menu select Open Project to display the Select Project File dialog box Browse to select the STM32L Discovery uvproj project file and click Open to launch it in
27. ng demonstration AN3413 The above documents are available at www st com stm32l July 2013 DocID022073 Rev 2 1 40 www st com Contents UM1451 Contents 1 Overview of STLINKVZinterface 6 2 Hardware environment setup 7 3 Using the IAR Embedded Workbench for ARM 8 3 1 Building an existing EWARM project 8 3 2 Debugging and running your EWARM project 9 3 3 Creating your first application using the EWARM toolchain 10 3 3 1 Managing source files 10 3 3 2 Configuring project options 12 4 Using the MDK ARM microcontroller development kit by Keil 16 4 1 Building an existing MDK ARM project 16 4 2 Debugging and running your MDK ARM project 17 4 3 Creating your first application using the MDK ARM toolchain 18 4 3 1 Managing source files 18 4 3 2 Configuring project options 20 5 Using the Atollic TrueSTUDIO EE EE RE EDE EE OT ESE ee 23 5 1 Building an existing TrueSTUDIO project 23 5 2 Debugging and running your TrueSTUDIO project 26 5 3 Creating your first application using TrueSTUDIO toolchain 26 6 Using Altium TASKING toolset
28. ng the Atollic TrueSTUDIO UM1451 Figure 35 Atollic TrueSTUDIO STM32 Lite import source select dialog box Select Create new projects from an archive file or directory Select an import source type filter text a 2 General Archive File 7 File System E Preferences gt CfC gt fe cvs gt E Example projects gt amp Git gt amp Install gt 2 Run Debug EE SVN 7 24 40 DoclD022073 Rev 2 UM1451 Using the Atollic TrueSTUDIO 5 Click Select root directory browse to the TrueSTUDIO workspace folder and select either STM32L152xB STM32L DISCOVERY or STM32L152xC 32L152C DISCOVERY project Figure 36 Atollic TrueSTUDIO STM32 Lite import projects dialog box Import Projects Select a directory to search for existing Eclipse projects Select root directory CA32LRC Discovery fw Projects AN3S Browse 3 Select archive file Browse Projects W STM32L152RC 32L152C Discovery CA32LRC Discovery Select All Deselect All Refresh C Copy projects into workspace Working sets Add project to working sets Cancel 1 The above example is given for the 32L152CDISCOVERY board 6 Inthe Projects pane select either the STM32L152xB STM32L DISCOVERY or the STM32L152xC 32L152C DISCOVERY and click Finish 7 Inthe Project Explorer select either the STM32L152xB STM32L DISCOVERY or the STM32L152xC 32L152C DISCOVERY project Open the Project
29. oolchain TASKING VX toolset Version 4 4r1 available from www tasking com The toolchain is installed by default in the C Program Files TASKING directory on your PC local hard disk The ST Link V2 USB exe is installed automatically when installing the software toolchain DoclD022073 Rev 2 yy UM1451 Hardware environment setup 2 Hardware environment setup Before running your application you should establish the connection with the STM32L1xxDISCOVERY board as following Figure 1 Hardware environment STM3 L Disovery board STM 32 Taalchain USB Cable Type Ato 7s mini B Computer with STNS2Z toolchain running For more details on how to establish your hardware environment you can refer to the STM32L DISCOVERY and 32L152CDISCOVERY user manual UM1079 user manual available from http www st com yy DoclD022073 Rev 2 7 40 Using the IAR Embedded Workbench for ARM UM1451 3 3 1 8 40 Using the IAR Embedded Workbench for ARM Building an existing EWARM project 1 Open the IAR Embedded Workbench for ARM EWARM Figure 2 shows the basic names of the windows referred to in this document Figure 2 IAR Embedded Workbench IDE environment XF IAR Embedded Workbench IDE Seles File Edit View Project Tools Window Help Dae aS Bl x rx Messages 2 Inthe File menu select Open and click Workspace to display the Open Workspace dialog box Browse to select the STM32L Discovery eww works
30. pace file and click Open to launch it in the Project window 3 Inthe Project menu select Rebuild All to compile your project 4 If your project is successfully compiled the following window is displayed d DoclD022073 Rev 2 UM1451 Using the IAR Embedded Workbench for ARM Figure 3 EWARM project successfully compiled Messaqes Errors none Warnings none Link time 0 05 CPU 0 03 elapsed Total number of errors 0 Total number of warnings 0 3 2 Debugging and running your EWARM project In the IAR Embedded Workbench IDE from the Project menu select Download and Debug or alternatively click the Download and debug button the in toolbar to program the Flash memory and begin debugging Figure 4 Download and debug button Download and Debug The debugger in the IAR Embedded Workbench can be used to debug source code at C and assembly levels set breakpoints monitor individual variables and watch events during the code execution Figure 5 IAR Embedded Workbench debugger screen File Edit View Project Debug Disassembly ST LINK Tools Window Help Os HG S Balo GIET EEEEINR SW Workspace STM32L152RC 32L152C DISCOVERY brief main entry point Files par Parameters None retval void None 8 amp Project STM32L152RC 32L152C DISCOVE v par Required preconditions None Ha O CMSIS Ha 9 Doc Ha 0 EWARM int main void Ha O StdPeriph_Driver Aft Ha G STM32L_DISCOVERY H
31. ph_Driver H Debug str32 Flash ld TO build your project in the Project menu click Build Project Your project is successfully compiled Figure 45 TrueSTUDIO project successfully built Build NewProject Libraries STM32L1ixx StdPeriph Driver sre stm32lixx led o Libraries STM32Z1 Libraries STM32Lixx StdPeriph Driver sre stm3 lixx igc o Libraries STM32I Libraries STM32Lixx StdPeriph DPriver sre stm321lixx flash ramfunc a Libraries STM32Lixx StdPeriph Driver srec atm32 lixx flash a Libraries STM Libraries STM32Lixx StdPeriph Driver sre stm3 lixx dma n Libraries STM32I Libraries STM32Lixu StdPeriph Driver sre stm3 lixx dac o Libraries STM32 1 Libraries STM32Lixx StdPeriph DPriver sre stm32 lixx comp o Libraries STM3 Libraries STM32Lixx StdPeriph Driver sre misc o Libraries CMS15 CMS DevicesSupport ST STN32L1ixx startup TrueSTUDIO startul Libraries CMS1I5 CM3 CoreSupport core cm3 0 0o NewProject elf mthumb mecy Wl cret u Reset Handler W1 Hap NewProject map W1l ge sections Wl C Program Files atollic TreueSTUDIG STM32 Lite 2 1 0 ide jre bin java j 2 1 0 Tools arm atollic reports jar sizeinto NewProject elt Report and converter tools only available in TrueSTUPIO Professional Puild complete for project NewProject Time consumed 16247 ms 10 Before running your application establish the connection with the 11 STM32L1xxDISCOVERY board as described in Section 2 Hardware envi
32. pment kit by Keil 3 Click Yes to copy the STM32 Startup Code to the project folder and add the file to the project Figure 26 Copy the STM32 Startup Code dialog box The default STM32 startup file includes the Systemlnit function You can either comment out this file to not use it or add the system_stm32I1xx c file from the STM32I1xx firmware library To create a new source file in the File menu select New to open an empty editor window where you can enter your source code The MDK ARM toolchain enables C color syntax highlighting when you save your file using the dialog File gt Save As under a filename with the c extension In this example the file is saved as main c Figure 27 main c example file d E main c ma 1 MDK ARM offers several ways to add source files to a project For example you can select the file group in the Project Window gt Files page and right click to open a contextual menu Select the Add Files option and browse to select the main c file previously created Figure 28 Adding source files Project YIX 3 Target 1 AG E ENS Options for Group Source Group 1 AIt F l Add Group Remove Group Source Group 1 and its Files 5 Manage Components Show Include File Dependencies If the file is added successfully the following window is displayed DoclD022073 Rev 2 19 40 Using the MDK ARM microcontroller development kit by Keil UM1451 Fig
33. r project click on Project gt Build Project from the toolbar menu If your project is compiled successfully the message shown in Figure 58 is displayed DoclD022073 Rev 2 37 40 Using Altium TASKING toolset UM1451 Figure 58 Tasking project successfully built El console C Properties Description Resource il lt 1_C C build completed successfully NewProject 12 Before running your application connect your STM32L1xxDISCOVERY board as described in Section 1 Getting started 7 38 40 DoclD022073 Rev 2 UM1451 Revision history 7 Revision history Table 1 Document revision history KISA Shes 27 Sep 2011 Initial release Updated EWARM MDK ARM and TrueSTUDIO release numbers and added TASKING toolchain in Section 1 Overview of STLINK V2 interface Updated Figure 5 AR Embedded Workbench debugger screen Figure 12 General options Figure 21 MDK ARM uVisiond project successfully compiled Figure 23 MDK ARM IDE workspace 04 Jul 2013 5 Figure 25 Device selection dialog box Figure 30 Target Options dialog box Target tab Section 3 3 2 Configuring project options Section 4 3 1 Managing source files Section 5 1 Building an existing TrueSTUDIO project and Section 5 2 Debugging and running your TrueSTUDIO project and Section 5 3 Creating your first application using TrueSTUDIO toolchain to support 32L152CDISCOVERY Added Section 6 Using Altium TASKING toolset d DoclD022073 Rev 2 39 40 UM1451
34. roject and click Save Figure 24 Creating a new project Peripherals New Multi Project Workspace Open Project Export Manage 2 Whenanew project is saved the IDE displays the device dialog box Select the device used for testing In this example we will use the STMicroelectronics device mounted on the STM32L1xxDISCOVERY board In this case double click on STMicroelectronics select either STM32L152xB STM32L DISCOVERY or STM32L152xC 32L152CDISCOVERY and click OK to save your settings Figure 25 Device selection dialog box Options for Target STM32L152RC 32L152C DISCOVERY Device Target Output Listing User C C Asm Linker Debug Utilities Database Generic CPU Data Base Vendor S7Microelectronics Device STM32L152RC Toolset ARM Operating conditions Operating power supply range 1 65 to 3 6 V without BOR 1 80 to 3 6 V with BOR Temperature range 40 to 85 BOC Low power features 7 modes Dynamic core voltage scaling down to 233 uA MHz Ultralow leakage per O 50 nA Fast wakeup from Stop 8 us Three wakeup pins Core ARM 32 bit Cortex M3 CPU 32 MHz maximum frequency 33 3 DMIPS peak Memory protection unit Reset and supply management Low power ultrasafe BOR Ultralow power POR PDR a 1 The above example is given for the 32L152CDISCOVERY board 7 18 40 DoclD022073 Rev 2 UM1451 Note d Using the MDK ARM microcontroller develo
35. ronment setup on page To program the Flash memory and begin debugging follow the instructions given in Section 5 2 Debugging and running your TrueSTUDIO project on page 26 7 DoclD022073 Rev 2 UM1451 Using Altium TASKING toolset 6 Using Altium TASKING toolset 6 1 Building an existing TASKING project Follow these steps below to build an existing TASKING project 1 Open the TASKING VX toolset for ARM Cortex IDE The program launches and requests the Workspace location Figure 46 TASKING workspace launcher dialog box W Workspace Launcher Select a workspace TASKING vX toolset For ARM Cortex v4 4r1 stores your projects in a Folder called a workspace Choose a workspace Folder to use For this session workspace eLR Discovery FalProjects 4N3964 Temperature ia NE Ed IE Use this as the default and do not ask again 1 The above example is given for the 32L152CDISCOVERY board 2 Browse to select the AN3964 Temperature_sensor TASKING workspace and click OK to save your settings and display the Welcome screen To start using TASKING click Go to the workbench Figure 47 TASKING VX Toolset for ARM Cortex welcome screen E TASKING CAC TASKING Vit tookeet for AR Cortex wart Hragete Seach Hel Workbench Go to ihe workbench 3 The AN3964 Temperature_sensor TASKING workspace contains a project for the STM32L152RC 32L152C DISCOVERY and one for the STM32L152RB STM32L DISCOVERY To load this project s
36. ta 1 amp id WemProject axit O Error 3 O Warhingisi 10 Before running your application establish the connection with the STM32L1xxDISCOVERY board as described in Section 2 Hardware environment setup on page 7 11 To program the Flash memory and begin debugging follow the instructions given in Section 4 2 Debugging and running your MDK ARM project on page 17 7 22 40 DoclD022073 Rev 2 UM1451 Using the Atollic TrueSTUDIO 5 Using the Atollic TrueSTUDIOS 5 1 Building an existing TrueSTUDIO project 1 Open the TrueSTUDIO STM32 product folder and select the Atollic TrueSTUDIO STM32 product name The program launches and asks for the Workspace location Figure 34 TrueSTUDIO workspace launcher dialog box al Workspace Launcher Select a workspace Atollic TrueS TUDIO for ARME Pro stores your projects in a folder called a workspace Choose a workspace folder to use for this session Workspace CA32LRC Discovery fw Projects AN3964 Temperature_sensor TrueSTUDIO Browse ere 1 The above example is given for the 32L152CDISCOVERY board 2 Browse to select the AN3964 Temperature sensor TrueSTUDIO workspace and click OK to save your settings 3 To load the AN3964 Temperature sensor project select Import from the File menu to display the Import dialog box 4 In the Import window open General select Existing Projects into Workspace and click Next 7 DoclD022073 Rev 2 23 40 Usi
37. the Project window 3 Inthe Project menu select Rebuild all target files to compile your project 4 If your project is successfully compiled the following window is displayed Figure 21 MDK ARM uVisiond project successfully compiled Build Output AaAaAaAaAaAaAaAaAaAaAaAaAaAEN compiling stmiZllaa syscfg c compiling stm3211xx tim c compiling stm3211xx usart c compiling stm321 discovery led c compiling system _stm3211zx c compiling stm321l1xx it c compiling main c linking Program Size Code 7332 RO data 396 RW data 64 ZI data 1168 STIM32L Discovery SIM32L Discovery axfi 0 Error s 0 Warning sy 7 16 40 DoclD022073 Rev 2 UM1451 4 2 7 Using the MDK ARM microcontroller development kit by Keil Debugging and running your MDK ARM project In the MDK ARM uVisiond IDE click the magnifying glass to program the Flash memory and begin debugging Figure 22 Starting a MDK ARM uVision4 debugging session oe d Start Stop Debug Session Ctrl F5 E Enter or leave a debug session The debugger in the MDK ARM IDE can be used to debug source code at C and assembly levels set breakpoints monitor individual variables and watch events during the code execution Figure 23 MDK ARM IDE workspace File Edit View Project Flash Debug Peripherals Tools SVCS Window Help NANA B 0 breo gt pame a a a M Registers R13 SP R14 LR R15 PC 4 PSR l Banked tl Syste
38. the property of their respective owners 2013 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com
39. ure 29 New project file tree structure E SY Target 1 21 55 Source Group 1 E startup stmadlixx E main c 4 3 2 Configuring project options 1 Inthe Project menu select Options for Target 1 to display the Target Options dialog box 2 Open the Target tab and enter IROM1 and IARM1 start and size settings as shown in Figure 30 Figure 30 Target Options dialog box Target tab Options for Target STM32L152RC 32L152C DISCOVERY Device Target Output Listing User C C Asm Linker Debug Utilities STMicroelectronics STM32L152RC Code Generation Xtal MHz 8 0 Operating system Nani os Use Cross Module Optimization System Viewer File Sir N SFONST STM32L bos TM 34 1 52D afr H ReadOnly Memory Areas Read Write Memory Areas default off chip Start Size Startup default off chip Start C Rom E T Rom r T ROM r on chip on chip IROMZ t E IRAMZ a 20007C00 400 ma 3 Open the Debug tab click Use and select the ST Link Debugger Then click Settings and select the SWD protocol Click OK to save the ST Link setup settings 7 20 40 DoclD022073 Rev 2 UM1451 Using the MDK ARM microcontroller development kit by Keil 4 Select Run to main Figure 31 Target Options dialog box Debug tab Linker Gebua Utiities Linker Utilities Use RDI Interface Driver settings Use ST Link Debugger ULINK Cortex Debugger ADI Interface Driver W Load
Download Pdf Manuals
Related Search
Related Contents
Designers Fountain HC0574 Installation Guide Package Insert EN --èl e - Caravan Park Owner`s Manual Zotac GeForce 8600 GT ZONE Edition Passive GeForce 8600 GT MANUAL DEL USUARIO Concours "Jeunes ambassadeurs des sciences en Corée 2006" 子どものインターネット利用時はフィルタリングを活用しましょう sk tecnica GLORIA_ASIA innofire vers_I cod 611740_Gloria, Asia See Manual - ReachOut Wireless Copyright © All rights reserved.
Failed to retrieve file