CoIDE User Guide

2013-01-21 V1.0 Completed

Website: http://www.coocox.org Forum: http://forum.coocox.org Technical: [email protected] Market: [email protected]

1

Catalog 1 CoIDE Quick Start...... 5

2 General Introduction ...... 15 2.1 New Concepts ...... 15

2.1.1 Terminology Note ...... 15 2.1.2 CoIDE Features ...... 15

2.2 Support list...... 17

2.2.1 Support Devices ...... 17

2.2.2 Supported Adapters ...... 19

2.3 Requirement for CoIDE ...... 20

3 Preparation ...... 21 3.1 Set GCC Compiler ...... 21 3.1.1 ARM GCC Introduction ...... 21

3.1.2 Set GCC in CoIDE ...... 22

4 User Interface ...... 24

4.1 Menus and Actions ...... 24

4.1.1 File Menu Actions ...... 24 4.1.2 Edit Menu Actions ...... 24

4.1.3 View Menu Actions ...... 24

4.1.4 Project Menu Actions ...... 25 4.1.5 Flash Menu Actions ...... 25

4.1.6 Debug Menu Actions ...... 25

4.1.7 Search Menu Actions ...... 26

4.1.8 Help Menu Actions ...... 26 4.2 Toolbar ...... 27

4.2.1 Editor Toolbar Actions ...... 27

4.2.2 Debug Toolbar Actions ...... 28 4.3 Editor View ...... 29

4.3.1 Welcome ...... 29

4.3.2 Breakpoint ...... 30

4.3.3 Components ...... 31

4.3.4 Console ...... 31

2

4.3.5 Configuration ...... 33

4.3.6 Editor ...... 37 4.3.7 Help ...... 37

4.3.8 Help Contents ...... 38

4.3.9 Outline ...... 39 4.3.10 Peripheral ...... 40

4.3.11 Project Explorer ...... 41

4.3.12 Repository ...... 42

4.3.13 Search ...... 42

4.4 Debug View ...... 44

4.4.1 Breakpoints ...... 44

4.4.2 Debug ...... 45 4.4.3 Disassembly ...... 47

4.4.4 Expressions ...... 49

4.4.5 Memory ...... 51

4.4.6 Peripherals view (CoAssistant) ...... 52

4.4.7 Registers ...... 54

4.4.8 Semihosting view ...... 55 4.4.9 Variables ...... 56

5 Project Management ...... 59 5.1 Create Project ...... 59 5.1.1 Create Project by Chip Model ...... 59

5.1.2 Create Project by Board Model ...... 64

5.2 Manage Target/Groups/Files and Switch Chip ...... 69 5.2.1 Target List Management in the Multi-configuration ...... 69

5.3 Project configuration ...... 73

5.3.1 Change device ...... 73 5.3.2 Compile configuration ...... 75

5.3.3 Link configuration ...... 76

5.3.4 Output configuration ...... 78

5.3.5 User configuration ...... 79

5.3.6 Debugger configuration ...... 80

3

5.3.7 Download configuration ...... 81

5.4 Build project ...... 82 5.5 Open project ...... 83

6 Debug ...... 85 6.1 Introduction ...... 85 6.1.1 Enter debug mode ...... 85

6.1.2 Debug control ...... 85

6.1.3 Set breakpoints ...... 85

6.1.4 Step mode ...... 85

6.1.5 Debug Example ...... 86

6.2 How to use debug views ...... 89

6.2.1 Disassembly view ...... 89 6.2.2 Memory view ...... 90

6.2.3 Variables view ...... 91

7 Components, Examples and Boards ...... 93

7.1 Components ...... 93 7.1.1 Add Components ...... 93

7.1.2 Refresh and Update Components ...... 97 7.1.3 Upload Components ...... 100

7.1.4 Modify or Delete Components ...... 116

7.2 Examples ...... 119 7.2.1 View examples ...... 119

7.2.2 Adding code snippet ...... 123

7.2.3 Upload Examples ...... 125 7.2.4 Modify an Example ...... 131

7.3 Board ...... 133

7.3.1 Refresh Board List ...... 135 7.3.2 Update a Board ...... 135

7.3.3 Upload a Board ...... 136

7.3.4 Modify a Board ...... 142

4

1 CoIDE Quick Start 1. Launch CoIDE, select “Browse in Repository”

2. Select the manufacturer, e.g. Freescale.

5

3. Select your target chip, e.g. MKL05Z32VFM4. The Help view on the right side of CoIDE will show corresponding information of the chip.

4. Check/Select the components which you want to use, e.g. xGPIO component. You will be prompted to create a new project.

6

5. After clicking "Yes", CoIDE will pop up a wizard window. Input project name. You can also modify the Project Path.

6. After clicking "Finish", CoIDE will create a project for you, containing manually-selected component code in step 4 and associated components will be automatically selected and included (e.g. the startup component), as well as a main.c file.

7

7. In the Repository view, click xGPIO component and the detailed description of xGPIO component will be displayed in the Help view.

8. The Components view shows all selected components and the number of examples for each component. Click a component and its Example window will popup.

8

9. Click "view" to view the example (e.g. Blinky) and “add” to add it to your project.

10. Click "Yes" to confirm adding the example to the default path.

9

11. CoIDE will add the Blinky.c file to the project, and the Blinky function to the main function.

12. Click the “Build” button to compile and link the program.

10

13. Click the “Configuration” button to open the configuration view.

14. In the “Debugger” tab, select “CMSIS-DAP” as the hardware adapter.

11

15. Click the “Download” button to download code to flash.

16. To start debugging, click on the “Debug” icon or press “Ctrl+F5”.

12

17. If debugging is launched successfully, CoIDE will enter the debug mode.

18. Other debug windows can be added by simply selecting them from the View menu.

13

19. Set breakpoints in the C code window or the Disassembly window.

20. Use the debug functions like single stepping via the tool bar or debug menu.

14

2 General Introduction CoIDE is a new, free and highly integrated software development environment for ARM Cortex MCU based microcontrollers, which includes all the tools necessary to develop high- quality software solutions in a timely and cost effective manner. 2.1 New Concepts CoIDE consists of a component-based network platform and an Eclipse-based development environment. The component-based network platform can quickly obtain resources to build applications, share your resources and exchange ideas. The Eclipse-based development environment provides many features for code editing, code browsing, compiling, linking, debugging, project management, etc. Features:

. Free to use . Full functional IDE . Component-oriented development platform . Internet-based, efficient integration of network resources . Integrates CoOS (Real-Time ) . Peripheral registers 2.1.1 Terminology Note 2.1.1.1 Component In CoIDE, any reusable code can be called as a component, including OS, drivers, examples, middle layer software etc. Each component has its corresponding code snippets, usage, documentation and comments. 2.1.1.2 Dependence When a component is selected, CoIDE automatically selects the required dependent components required for compiling or executing the program. 2.1.1.3 Code Snippet Code Snippet (or example code) is an extension of a component. If the component is object- oriented, the code snippet will be application-oriented. For example, a PIO driver can be known as a component, a function using PIO driver to achieve LED flashing can be known as a code snippet. The code snippet is generally very short, but the features are not restricted. It can be automatically inserted into the code. 2.1.2 CoIDE Features CoIDE can be used for code editing, code browsing, compiling, linking, debugging and project management; it also can be used to obtain components, share components and to exchange ideas. 2.1.2.1 Component Network Component Network contains a large amount of free components. The components are provided by CooCox and CooCox users. CooCox tools include a RTOS, flash manager,

15

embedded database, protocol stack and other components, which are all free. Everyone can use these components and upload their own components. 2.1.2.2 Component Oriented Programming In embedded application development, if there is no suitable libraries, development work will become very complicated. Once you have the suitable libraries, anything will be manipulated in your hands. CooCox CoIDE Component Network contains a large amount of free components, users can choose suitable components according to your own needs, and use the component code snippets to build application will become more quickly. With a large number of components and detailed component documentation, programming will be as simple as building block. 2.1.2.3 Component Documentation Detailed documentation (displayed in the Help View) is available for each component making it extremely easy for users with their development. This includes component description, component dependency relationship, component source files, usage of the component, comments etc. CoIDE automatically generates documentation for source files. Tip: having the code comments according to Doxygen standard will help generate detailed documentation. 2.1.2.4 Interaction CooCox CoIDE, provides powerful interaction between the various elements such as the chip, component, peripheral, register, code snippet and more. Users can even ask questions directly from within the environment, making it easy to address any problems encountered in the development process. 2.1.2.5 Development Environment CoIDE is based on the Eclipse development platform, and has the following features:

 Integrated CDT editor: A full-featured editor to edit and browse the code  Integrated GCC ARM Embedded: Using gcc tool chain, which is efficient and stable.  A clear interface: Menus and toolbar are simple, clear and easy to use.  GUI Setting: Dialogs for all settings.

16

2.2 Support list 2.2.1 Support Devices The CooCox CoIDE mainly supports ARM Cortex-M based devices. Until now, CooCox has supported Cortex-M4, Cortex-M3, Cortex-M0 and Cortex-M0+ chips from Atmel, Energy Micro, Freescale, Holtek, NXP, Nuvoton, ST and TI. For the latest support list, please visit: http://www.coocox.org/CooCox_CoIDE.htm  Atmel:

 AT91SAM3U4E AT91SAM3U4C

 AT91SAM3U2E AT91SAM3U2C

 AT91SAM3U1E AT91SAM3U1C  Energy Micro:

 EFM32G200F16 EFM32G200F32 EFM32G200F64

 EFM32G210F128

 EFM32G230F128 EFM32G230F32 EFM32G230F64

 EFM32G280F128 EFM32G280F32 EFM32G280F64

 EFM32G290F128 EFM32G290F32 EFM32G290F64

 EFM32G840F128 EFM32G840F64 EFM32G840F32

 EFM32G880F128 EFM32G880F64 EFM32G880F32

 EFM32G890F128 EFM32G890F64 EFM32G890F32  Freescale :

 MKL04Z16VFK4, MKL04Z16VFM4, MKL04Z16VLC4, MKL04Z16VLF4, MKL04Z32VFK4, MKL04Z32VFM4, MKL04Z32VLC4, MKL04Z32VLF4, MKL04Z8VFK4, MKL04Z8VFM4, MKL04Z8VLC4

 MKL05Z16VFK4, MKL05Z16VFM4, MKL05Z16VLC4, MKL05Z16VLF4, MKL05Z32VFK4, MKL05Z32VFM4, MKL05Z32VLC4, MKL05Z32VLF4, MKL05Z8VFK4, MKL05Z8VFM4, MKL05Z8VLC4

 MKL14Z32VFM4, MKL14Z32VFT4, MKL14Z32VLH4, MKL14Z32VLK4, MKL14Z64VFM4, MKL14Z64VFT4, MKL14Z64VLH4, MKL14Z64VLK4

 MKL15Z128VFM4, MKL15Z128VFT4, MKL15Z128VLH4, MKL15Z128VLK4, MKL15Z32VFM4, MKL15Z32VFT4, MKL15Z32VLH4, MKL15Z32VLK4, MKL15Z64VFM4, MKL15Z64VFT4, MKL15Z64VLH4, MKL15Z64VLK4

 MKL24Z32VFM4, MKL24Z32VFT4, MKL24Z32VLH4, MKL24Z32VLK4, MKL24Z64VFM4, MKL24Z64VFT4, MKL24Z64VLH4, MKL24Z64VLK4

 MKL25Z128VFM4, MKL25Z128VFT4, MKL25Z128VLH4, MKL25Z128VLK4, MKL25Z32VFM4, MKL25Z32VFT4, MKL25Z32VLH4, MKL25Z32VLK4, MKL25Z64VFM4, MKL25Z64VFT4, MKL25Z64VLH4, MKL25Z64VLK4  Holtek:

 HT32F1251, HT32F1251B, HT32F1252, HT32F1253

 HT32F1755, HT32F1765, HT32F2755  NXP:

 LPC1111x101 LPC1111x201 LPC1112x101 LPC1112x201

 LPC1113x201 LPC1113x301 LPC1114x201 LPC1114x301

 LPC11C14x301 LPC11C12x301

17

 LPC1224x101 LPC1224x121 LPC1225x301 LPC1225x321 LPC1226x301 LPC122 7x301

 LPC1311 LPC1313 LPC1342 LPC1343

 LPC1751 LPC1752 LPC1754 LPC1756 LPC1758 LPC1759

 LPC1763 LPC1764 LPC1765 LPC1766 LPC1767 LPC1768 LPC1769  Nuvoton:

 NUC100LC1BN, NUC100LD1BN, NUC100LD2BN, NUC100RC1BN, NUC100RD1BN, NUC100RD2BN

 NUC100LD3AN, NUC100LE3AN, NUC100RD3AN, NUC100RE3AN, NUC100VD2AN, NUC100VD3AN, NUC100VE3AN

 NUC120LC1BN, NUC120LD1BN, NUC120LD2BN, NUC120RC1BN, NUC120RD1BN, NUC120RD2BN

 NUC120LD3AN, NUC120LE3AN, NUC120RD3AN, NUC120RE3AN, NUC120VD2AN, NUC120VD3AN, NUC120VE3AN

 NUC122LC1AN, NUC122LD2AN, NUC122SC1AN, NUC122SD2AN, NUC122ZC1AN, NUC122ZD2AN

 NUC130LC1CN, NUC130LD2CN, NUC130LE3CN, NUC130RC1CN, NUC130RD2CN, NUC130RE3CN, NUC130VE3CN

 NUC140LC1CN, NUC140LD2CN, NUC140LE3CN, NUC140RC1CN, NUC140RD2CN, NUC140RE3CN, NUC140VE3CN

 M0516LBN, M0516ZBN, M052LBN, M052ZBN, M054LBN, M054ZBN, M058LBN, M058ZBN

 Mini51LAN, Mini51ZAN, Mini52LAN, Mini52ZAN, Mini54LAN, Mini54ZAN

 NANO100KC2BN, NANO100KD2BN, NANO100KD3BN, NANO100KE3BN, NANO100LC2BN, NANO100LD2BN, NANO100LD3BN, NANO100LE3BN, NANO100SC2BN, NANO100SD2BN, ANO100SD3BN, NANO100SE3BN

 NANO110KC2BN, NANO110KD2BN, NANO110KD3BN, NANO110KE3BN, NANO110SC2BN, NANO110SD2BN, NANO110SD3BN, NANO110SE3BN

 NANO120KC2BN, NANO120KD2BN, NANO120KD3BN, NANO120KE3BN, NANO120LC2BN, NANO120LD2BN, NANO120LD3BN, NANO120LE3BN, NANO120SC2BN, NANO120SD2BN, NANO120SD3BN, NANO120SE3BN

 NANO130KC2BN, NANO130KD2BN, NANO130KD3BN, NANO130KE3BN, NANO130SC2BN, NANO130SD2BN, NANO130SD3BN, NANO130SE3BN  ST

 STM32F050C4, STM32F050C6, STM32F051C4, STM32F051C6, STM32F051C8, STM32F051K4, STM32F051K6, STM32F051K8, STM32F051R4, STM32F051R6 STM32F051R8,

 STM32F100C4, STM32F100C6, STM32F100C8, STM32F100CB,

 STM32F100R4, STM32F100R6, STM32F100R8, STM32F100RB, STM32F100RC, STM32F100RD, STM32F100RE,

 STM32F100V8, STM32F100VB, STM32F100VC, STM32F100VD, STM32F100VE,

 STM32F100ZC, STM32F100ZD, STM32F100ZE,

 STM32F101C4, STM32F101C6, STM32F101C8, STM32F101CB,

 STM32F101R4, STM32F101R6, STM32F101R8, STM32F101RB, STM32F101RC, STM32F101RD, STM32F101RE, STM32F101RF,

18

 STM32F101T4, STM32F101T6, STM32F101T8, STM32F101TB,

 STM32F101V8, STM32F101VB, STM32F101VC, STM32F101VD, STM32F101VE, STM32F101VF, STM32F101VG,

 STM32F101ZC, STM32F101ZD, STM32F101ZE,

 STM32F102C4, STM32F102C6, STM32F102C8, STM32F102CB,

 STM32F102R4, STM32F102R6, STM32F102R8, STM32F102RB,

 STM32F103C4, STM32F103C6, STM32F103C8, STM32F103CB,

 STM32F103R4, STM32F103R6, STM32F103R8, STM32F103RB, STM32F103RC, STM32F103RD, STM32F103RE, STM32F103RF, STM32F103RG,

 STM32F103T4, STM32F103T6, STM32F103T8, STM32F103TB,

 STM32F103V8, STM32F103VB, STM32F103VC, STM32F103VD, STM32F103VE, STM32F103VF, STM32F103VG,

 STM32F103ZC, STM32F103ZD, STM32F103ZE, STM32F103ZF, STM32F103ZG,

 STM32F105R8, STM32F105RB, STM32F105RC, STM32F105V8, STM32F105VB, STM32F105VC,

 STM32F107RB, STM32F107RC, STM32F107VB, STM32F107VC

 STM32F405RG, STM32F407IG, STM32F407VG, STM32F407ZG, STM32F415RG, STM32F417VE  TI

 LM3S102 LM3S316 LM3S601 LM3S617 LM3S811 LM3S818

 LM3S1958 LM3S1968

 LM3S2110 LM3S2276 LM3S2776 LM3S2793 LM3S2965 LM3S2B93

 LM3S3748 LM3S3W26

 LM3S5749 LM3S5B91

 LM3S6432 LM3S6537 LM3S6610 LM3S6911 LM3S6918 LM3S6965

 LM3S8962 LM3S8971

 LM3S9792 LM3S9B90 LM3S9B92 LM3S9B96 LM3S9L97 2.2.2 Supported Adapters List of debug adapters, supported by CoIDE

Debugging Adapter Available Devices PC USB Driver

Colink Atmel, TI, NXP, ST Colink Driver

Atmel, Energy Micro, Freescale , TI, NXP, CoLinkEx CoLinkEx Driver Nuvoton, ST, Holtek Nu-Link, Nu-Link-Me or Nuvoton Nu-Link Driver Nu-Link-pro

FTDI devices Atmel, TI, NXP, ST FTDI Driver

J-Link(How to use) Atmel, Energy Micro, TI, NXP, ST J-Link Driver

ST-Link/V2 ST-Link or ST-Link/V2 ST Driver

e-link32 Holtek e-link32 Driver

Open-SDA Freescale

19

2.3 Requirement for CoIDE System requirements:

. Windows XP SP3/Windows Vista/Windows 7 Hardware requirements:

. Debug adapter such as CoLinkEx, Open-SDA, etc. Software requirements:

. GCC ARM Embedded (see: Set GCC Compiler) . Install the related driver for the adapter you used

20

3 Preparation 3.1 Set GCC Compiler Before you use CoIDE to start your project, you need to configure the GCC compiler and debugger. It is recommended to use the ARM GCC compiler. For more details about ARM GCC, please click here. In addition, you can also choose other GCC compilers such as CodeSourcery GCC. 3.1.1 ARM GCC Introduction Features:

 All GCC 4.7 features, plus latest mainline features  Cortex-M0/M0+/M1/M3/M4 support  Cortex-M4 with hard float multilib support  Fixed point fraction support  Nano C Library support Download link: https://launchpad.net/gcc-arm-embedded/+download Note: As CoIDE supports different GCC compilers, you need to pay attention to the following points when you switch between the compilers:

 The different compilers have different C libraries, for example: ARM GCC has a base C Library, Nano C library Semihosting Library and a Retarget Library. However, CodeSourcery GCC only has the base C Library. See: Project Configuration  ARM GCC and CodeSourcery GCC use different link.ld when they compile the same project. CoIDE will generate different link.ld when you create the project, so it is strongly recommended of you to set the GCC compiler before you start.  If you want to use ARM GCC to compiler the project you created under CodeSourcery GCC, you need to delete the Build.xml, link.ld, memory.ld. Then check a component and reconfigure the project after setting the GCC.  In CoIDE 1.7.0 or higher, we support the ARM GCC 4.7 version, which provide a Nano C library for Cortex M series.

21

3.1.2 Set GCC in CoIDE 1. After launching the CooCox CoIDE, click "Select Toolchain Path" under the Project menu.

2. Click the Browse button, select the folder that contains the arm-none-eabi-gcc.exe and the other GCC execute files.

22

3. For example, select the bin folder and click OK to save the setting.

23

4 User Interface 4.1 Menus and Actions

4.1.1 File Menu Actions

Name Description Shortcut

New File Create a new file. Ctrl + Shift + N

Open File… Open a file from the file system in the Editor view.

Save the content of the current editor. Disabled if the editor Save Ctrl + S does not contain unsaved changes.

Save As... Save the content of the current editor under a new name.

Save the content of all editors with unsaved changes. Save All Ctrl + Shift + S Disabled if no editor contains unsaved changes.

Exit Exit CoIDE.

4.1.2 Edit Menu Actions

Name Description Shortcut

Undo Undo your operations. Ctrl + Z

Cut Cut a code snippet or a file. Ctrl + X

Copy Copy a code snippet or a file. Ctrl + C

Paste Paste the code snippet or a file to a place. Ctrl + V

4.1.3 View Menu Actions

Name Description Shortcut

Repository Open Repository View.

Open the current project configuration page (Open Configuration builder.xml of the current project in Editor).

Project Open Project View

Components Open component platform

Help Open Help View.

Outline Open Outline View.

Peripherals Open Peripherals View.

Breakpoints Open Breakpoints View.

24

Default layout Resume to the default layout.

4.1.4 Project Menu Actions

Name Description Shortcut

New Project Create a new Project and close the current project.

Open Project... Show a dialog that can be used to select an existing project.

Close Project Close the current project.

Select Select the GCC Toolchain you want to use. Toolchain path Build the currently selected project. This is an incremental Build build, meaning that the builder analyzes the changes since the F7 last time of build and minimizes the number of changed files.

Rebuild Rebuild all files of the current project. Ctrl + R

Clean Clean the intermediate files that generated by building.

Upload Open the Login dialog box, you can upload Component after

Component login with CooCox account. You can upload development board after login with CooCox Upload Board account. Upload You can upload component examples after login with CooCox

Example account. 4.1.5 Flash Menu Actions

Name Description Shortcut

Program Download Download program to Flash.

Flash Erase Erase Flash.

4.1.6 Debug Menu Actions

Name Description Shortcut

Debug To debug the current project. Ctrl+F5

Toggle Breakpoint To set a breakpoint at the current line. Ctrl +Shift+ B

Toggle Line Breakpoint To set a breakpoint at one line in the function.

Toggle Method Breakpoint To set a breakpoint at the entry of current function.

Toggle Watch Breakpoint To set a Watch Breakpoint.

Skip All Breakpoints Skip all the Breakpoints when debugging.

25

Remove All Breakpoints Delete all the Breakpoints.

Breakpoint Type Breakpoint Type

4.1.7 Search Menu Actions

Name Description Shortcut

Search... Execute a C/C++ or file search. Ctrl + H

File... Execute a file search.

C/C++ … Execute a C/C++ search.

4.1.8 Help Menu Actions

Name Description Shortcut

Welcome Open the Welcome view.

Help Contents CoIDE Users' Guide.

About CoIDE Display CoIDE version number and license information.

26

4.2 Toolbar 4.2.1 Editor Toolbar Actions

Icons Name Description Shortcut Create a new Project and close the current New Project project.

Create New File Create a new file. Save the content of the current editor. Disabled Save Ctrl + S if the there is no changed. Build the currently selected project. This is an incremental build, meaning that the builder Build F7 analyzes the changes since the last time of build and minimizes the number of changed files.

Rebuild Rebuild all files of the current project. Ctrl + R

Start Debug. Debug the current project. Ctrl + F5 Download Code Download program to flash. to Flash

Flash Erase Erase the full chip.

Configuration Configure the project.

Target Manage Manage the Targets in the project

Repository Open Repository View.

Welcome Open Welcome View

Open Element Open the Search dialog box. Ctrl +Shift +T

Search Open the Search dialog box. Ctrl + H

Toggle Mark Turns mark occurrences on and off in the C/C++ Alt+Shift+0 Occurrences editor.

Next Annotation Go to the next annotation. Ctrl +. Previous Go to the previous annotation. Ctrl + , Annotation Last Edit Go to the location where you have modified last Ctrl + Q Location time.

Back to... Go back to the previous position. Alt + Left

Forward to... Forward to next position. Alt + Right

27

4.2.2 Debug Toolbar Actions

Icons Name Description Shortcut Instruction Stepping Select the instruction stepping mode command

Mode to step the instruction. Select the Reset command to reset the Reset CPU debugging. Select the Run command to resume execution Run F5 of the currently suspended debug target. Select the Suspend command to halt execution Suspend of the currently selected in a debug F9 target. Ends the selected debug session and/or Terminate Ctrl + F5 process. Select to execute the current line, including Step Into any routines, and proceed to the next F11 statement. Select to execute the current line, following Step Over F10 execution inside a routine. Select to continue execution to the end of the Step Out current routine, then follow execution to the Ctrl + F11 routine's caller.

Run To Line Select to continue execution to current line. Ctrl + R

Open Element Open the Search dialog box. Ctrl +Shift +T

Search Open the Search dialog box. Ctrl + H Toggle Mark Turns mark occurrences on and off in the Alt+Shift+0 Occurrences C/C++ editor.

Next Annotation Go to the next annotation. Ctrl +.

Previous Annotation Go to the previous annotation. Ctrl + , Go to the location where you have modified Last Edit Location Ctrl + Q last time.

Back to... Go back to the previous position. Alt + Left

Forward to... Forward to next position. Alt + Right

28

4.3 Editor View

4.3.1 Welcome

29

When you launch CoIDE for the first time, you could see the welcome page. The welcome page is a convenient entry for “Browse in Repository”, “Create a New Project”, “Open a Project”, refer to “User Guide” and go to “Forum”. 4.3.2 Breakpoint

This view shows the information of breakpoints set by user in the code.

30

4.3.3 Components

This view displays all the components of the current project selection. Clicking on a component in this view will have:

 The Help view display the properties of the clicked component, such as the component source files, source files documents, dependent components, usage and comments.

 The Code Snippet View displays all code snippets of the component.

 The Project View highlights the component source files. 4.3.4 Console This view shows the output of the execution of your program and enables you to enter input for the program.

Console View Toolbar:

Icon Command Description

Force the Console view to remain on top of other Pin Console views in the window area.

If multiple consoles are open, you can select the one Display Selected Console to display from a list.

Open Console Open new console view.

Clear Console Clear the console.

Scroll Lock Toggle the Scroll Lock.

Show Console When Show console when standard out changes. Standard Out Changes

31

Show Console When Show console when standard error changes. Standard Error Changes

32

4.3.5 Configuration Click the Configuration button to enter the configuration view. The Configuration view is split into seven tabs that contain the configuration for the project. They are Device, Compile, Link, Output, User, Debugger and Download.

4.3.5.1 Device configuration

33

4.3.5.2 Compile configuration

4.3.5.3 Link configuration

34

4.3.5.4 Output configuration

4.3.5.5 User configuration

35

4.3.5.6 Debug configuration

4.3.5.7 Download configuration

36

4.3.6 Editor The C/C++ editor provides specialized features for editing C/C++ related files.

The most common way to invoke the C/C++ editor is to open a file from the Project Explorer by clicking the file (single or double-click depending on the user preferences). The C/C++ editor only provides context menu (right click your mouse in the editor view, the context menu will appear) and key binding actions. 4.3.7 Help

This view displays all information about the selected component including: 1. Component name, overview and other information

37

2. API Reference, the reference of the , which link to the Doxygen Documents generated by CoIDE. 3. Source files: Source files of the component. 4. Dependency: Other components depended by the component. 4.3.8 Help Contents The Help Menu provides contents for help with the features and functionality of the CoIDE.

Toolbar

Icon Name Description Availability

Go Back Go back to the previous position. Toolbar

Go Forward to Forward to the next position. Toolbar

Home Go to the home page of the Help content. Toolbar Show in table of Show the page position in the table of Toolbar content content view.

Bookmark Document Add a bookmark. Toolbar

Print Page Print the current page. Toolbar

Print Topics Print the topics. Context menu

Search Topics Search the topics. Context menu

Collapse All Collapse all the topics. Context menu

Link with contents Link with the contents. Context menu

38

Show Result Search Results Show the categories of the search results. Categories View Show Result Search Results Show the description of the search results. Description View Delete Selected Delete the selected bookmark. Bookmark View Bookmark

Delete All Bookmark Delete the entire bookmark. Bookmark View 4.3.9 Outline

The Outline view will show the outline when you open a source file in the edit view. It can show all the includes, definitions, macros, functions in the source file you opened. You can click the icons or the characters behind to go to the related values in the edit view.

Outline view toolbar icons: The table below lists the icons displayed in the Outline view toolbar.

Icon Description Icon Description

Sort items alphabetically Filters…

Hide Fields Link With Editor

Hide Static Members Group Includes

Hide Non-Public Members Group Macros

Hide Inactive Elements Group Methods

Outline view menu Group Namespaces

Outline view icons: The table below lists the icons displayed in the Outline view.

Icon Description Icon Description

Class Include

Namespace Method private

39

Macro Definition Method protected

Enum Method public

Enumerator Struct

Variable Type definition

Field private Union

Field protected Function

Field public

4.3.10 Peripheral

This view shows the information of peripheral register. Click on the corresponding register to get the register detailed information view:

40

4.3.11 Project Explorer

This view displays all files of the file system under your project directory, including C source files (*.c, *.h), assembly source files (*.s), project configuration files (build.xml), linker script files (*.ld), library files (*.a), etc. In this view you could do the following operations:

 Open files in the editor view

 Open project configuration interface

 Close the current project

 Create new projects, files, or folders

 Manage existing files (copy, paste, delete, move or rename)

41

4.3.12 Repository

This view displays all available components in the project. The “√” before the component shows this component has been added to the project. By checking or unchecking the “√” before components to add or delete the components. 4.3.13 Search The Search view only appears after you have searched something in the project.

The type of the selected C/C++ element defines which search context menus are available. Search view Toolbar:

Icon Command Description

Next Navigate to the next search result.

Previous Navigate to the previous search result.

Remove the Selected Removes user selected matches from the search Matches console.

Remove All Matches Clear the search console.

42

Run the Current Search Run the current search again. Again

Terminate Terminate the current search.

Show the list of previously runs searching, which Show Previous Searches can be re-selected.

Force the search view to remain on top of other Pin the Search View views in the window area.

List two selectable view layouts for search Menu results: Flat and Hierarchical.

Minimize Console Minimize the Console view.

Maximize Console Maximize the Console view.

43

4.4 Debug View 4.4.1 Breakpoints The Breakpoints View lists all the breakpoints you have set in your workspace. Up to six breakpoints can be toggled if you are debugging in flash with Cortex-M3 series' chips, for Cortex-M0, the number is four. Otherwise, warnings will be presented at runtime. You can double-click a breakpoint to find its location in the editor (if applicable). You can also enable or disable breakpoints, delete them, add new ones.

The commands available in the Breakpoints View are listed below.

Command Name Description Availability

Context Remove Selected Only remove the selected menu and Breakpoints breakpoint(s). view action Context Remove All Remove all breakpoints. menu and Breakpoints view action Show Breakpoints Display the breakpoints supported by Supported by View action the selected target board. Selected Target Context Go to the corresponding location of the Go to File menu and breakpoint in the java editor. view action

Skip All Set all breakpoints to be skipped. View action Expand All Expand all the sub items in the view. View action

Collapse All Collapse all the sub items in the view. View action

Change if the breakpoints should be Link with View View action linked to the Debug View. Add Event Add event breakpoint. View action Breakpoint(C/C++)...

44

Add watchpoints (Not supported by the Add Watchpoints current version. It will be supported in View action (C/C++)... the future versions.)

Show full paths Show the full paths of the breakpoints. View action Allow you to select an alternate Group By... grouping for your breakpoints or create View action your own. Select the default working set so that Select default the new breakpoints will be added into View action Working Sets... this working set. Deselect the default working set so Deselect Default that the new breakpoints will not be View action Working Set added into any working set.

Working Sets... Open the working sets dialog. View action

Change the selected breakpoint(s) to Context Enable be enabled. menu Change the selected breakpoint(s) to Context Disable be disabled. menu Context Select All Select all the breakpoints in the view. menu Copy the selected breakpoints to the Context Copy system clipboard. menu Context Paste Paste copied breakpoints into the view. menu Context Import Breakpoints... Open the import breakpoints wizard. menu Context Export Breakpoints... Open the export breakpoints wizard. menu Breakpoint Open the breakpoints properties Context

Properties... dialog. menu 4.4.2 Debug 1. The Debug view shows the target debugging information in a tree hierarchy. 2. The number beside the thread label is a reference counter, not a thread identification number. 3. The CDT displays stack frames as child elements. It displays the reason for the suspension beside the thread, (such as end of stepping range, breakpoint hit, and signal received). When a program exits, the exit code is displayed.

45

Debug view context menu commands command Name Description

Remove All Clear all terminated processes in Debug view. Terminated

Toggle step filters on/off. When on, all step functions apply Use Step Filters step filters.

Copy the selected stack of suspended threads as well as the Copy Stack state of the running threads to the clipboard.

Find... Open the debug view element-searching dialog.

Select to execute the current line, including any routines, Step Into and proceed to the next statement.

Select to execute the current line, following execution Step Over inside a routine.

Select to continue execution to the end of the current Step Return routine, then follow execution to the routine’s caller.

Instruction Stepping Activate to enable instruction stepping mode to examine a Mode program as it steps into disassembled code.

Select the Resume command to resume execution of the Resume currently suspended debug target.

Select the Suspend command to halt execution of the Suspend currently selected thread in a debug target.

End the selected debug session and/or process. The impact Terminate of this action depends on the type of the item selected in the Debug view.

Terminate and Select the Terminate and Relaunch command to terminate Relaunch the selected debug target and then relaunch it.

Select the Restart command to restart the remote debug Restart target.

Select the Disconnect command to disconnect the Disconnect connection to the debug target.

46

Relaunch This command relaunches the selected debug target.

Open the launch configuration dialog, allowing you to make Edit... changes.

Open the source lookup dialog, allowing you to make Edit Source Lookup... changes.

Lookup Source Select to force a source lookup to take place.

Terminate and Terminate the selected debug target and removes it from Remove the view.

Terminate/Disconnect Terminate all active launches in the view. All

Open the Properties for window showing the process Properties properties. 4.4.3 Disassembly The Disassembly View shows the loaded program as assembler instructions mixed with source code for comparison. The currently executing line is marked by a yellow arrow and highlighted with green background in this view. You can do the following tasks in the Disassembly view.

 Set breakpoints at the start of any assembler instruction

 Enable and disable breakpoints and set their properties

 Step through the disassembly instructions of your program

 Jump to specific instructions in the program

47

Disassembly view context menu commands

Command Name Description Availability

Copy Copy the selected content into the clipboard. Context menu

Select All Select all the content. Context menu

Context menu Show the assembly and its corresponding Show Source and View source code action

Show Symbols Show function label and symbols Context menu

Preferences Parameter selection. Context menu

Resume program execution until the specific line is reached. This is a convenient way to Run To Line Context menu suspend execution at a line without setting a breakpoint.

Jump to the line selected in the Disassembly Move to Line Context menu view.

Resume At Line Resume program execution from the line Context menu

48

selected in the Disassembly view.

Refresh View Refresh Disassembly view. View action

Go to Current Program Jump to the current program execution. View action Counter(Home)

Link with Display the current operating position of the Active Debug View action code Context

Open New Open a new Disassembly view. View action View

Pin to Debug View action Context

4.4.4 Expressions An expression is a snippet of code that can be evaluated to produce a result. The context for an expression depends on the particular debug model. Some expressions may need to be evaluated at a specific location in the program so that the variables can be referenced. You can view information about expressions in the Expressions view. You can inspect expressions from a scrapbook page, a stack frame of a suspended thread, or other places. The Expressions View opens automatically when an item is added to the view. When debugging a C/C++ program, data that contains variables can be expanded to show the variables and the fields of the variables.

There are many commands available in the Expressions View:

Command Name Description Availability

Show Type Configure columns to display type names. View action Name

Show logic Show logic structure of the Expressions. View action

49

structure

Collapse All Collapse all the Expressions. View action

Add Watch Context menu Allow you to add a watch expression. Expression and view action Remove the currently selected Context menu Remove expression(s) from the view. and view action Remove all of the expressions from the Context menu Remove All view. and view action Open New Open a new Expressions view. View action View Pin to Debug View action Context

Refresh Refresh. View action

Select All Select all the variables in the view. Context menu

Copy Copy the selected expressions and Context menu Expressions variables to the system clipboard. Open the search dialog to find elements Find... Context menu in the variables view.

Disable Disable a currently enabled expression. Context menu

Enable Enable a currently disabled expression. Context menu

Edit Watch Allow you to edit existing watch Context menu Expression expression. Reevaluate Reevaluate the currently selected Context menu Expression expression. Select a format type. Choices include: Format Binary, Decimal, Natural, and Context menu Hexadecimal.

50

4.4.5 Memory The Memory view of the Debug perspective lets you monitor and modify your process memory. Memory can be displayed in different predefined data formats -- memory renderings. The CoIDE supports five rendering types -- hexadecimal (default), ASCII, signed integer and unsigned integer.

The Memory view can display and modify the value of selected memory address. The Rendering pane can be configured to display more than two renderings at the same time. Memory view toolbar icons: The table below lists the icons displayed in the Memory view toolbar. Command Name Description

New Tab Click to create a new memory view..

Go Shows the Memory value of the selected address.

Import Import memory view from different kinds of files.

Export Export memory to different kinds of files.

Open New View Open a new Memory view.

Pin to Debug Context

Default Rendering Select default rendering.

Find/Replace Find or replace value from the Rendering pane.

Find next Find next one after the command: Find/Replace.

Clear Expressions Clear the contents of the address input box.

Memory view context menu: The context menu inside the Memory view includes: Name Description

Panes Enable or disable the showing of the Address, Binary, and Text portions of

51

the rendering view.

Endian Toggle between the Little (default) and Big Endian display of memory.

Choose the character encoding used to convert memory values into text for Text display. Choices include: ISO-8859-1 (default), US-ASCII, or UTF-8.

Specify the cell size used to display values in the Binary column. Choices Cell Size include 1, 2, 4 (default), and 8 bytes.

Specify the radix used to display the values in the Binary column. Choices Radix include Hex, Decimal Signed, Decimal Unsigned (default), Octal, and Binary.

Columns Specify the number of columns in the Binary column.

Select the update mode of the Rendering pane: Always, On Breakpoints, or Update Mode Manual.

Copies the selected portion (address, content or binary number) of the Copy Rendering pane to the clipboard.

Reset To Base Reset the Rendering pane to the original base address. Address

Refresh Refresh the Rendering pane.

4.4.6 Peripherals view (CoAssistant) The Peripherals View can be used to view and modify the value of Peripherals' registers. Values that have been changed are highlighted in the Peripherals view when your program stops.

52

It displays the register list and views the value of these registers. Register that have been changed are highlighted in the Peripherals view.

Click the Register name to open the detail information view. In this view, you can get the description, RW access, address offset and the reset value of the register. You can also modify the value of register when you debug a project.

53

4.4.7 Registers

The Registers view of the Debug perspective lists information about the registers in a selected stack frame. You can view information about the registers in a selected stack frame. Values that have been changed are highlighted in the Registers view when your program stops.

Registers view toolbar icons: The table below lists the icons displayed in the Registers view toolbar.

Command Name Description

Show Type Configure columns to show type names(unavailable when Name columns are displayed). Show logic Show logic structure of the registers. structure

Collapse All Collapse all the registers.

Open New View Open a new Registers view.

Pin to Debug

Context

Refresh Refresh

Layout Provides multiple layout options for the Registers view.

Registers view context menu commands:

The Registers view context menu commands include: Command Name Description

Select All Select all the editor content.

Copy Registers Copy the register names and contents to the clipboard.

54

Enable Enable the selected register.

Disable Disable the selected register. Select a format type. Choices include Binary, Decimal, Format Natural, and hexadecimal. Open the Find dialog, which allows you to find specific Find... elements within the view. Open the Set Value dialog to change the selected Change Value... registers value. Open the Register Group dialog, which allows you to Add Register Group define a register group that is shown in the Registers view. Restore Default Restore the original register groups. Register Groups Add Watchpoints Add watchpoints (Not supported by the current version. (C/C++)... It will be supported in the future versions.)

Watch Convert the selected register into a watch expression. 4.4.8 Semihosting view Semihosting view is used to show the information of the host computer and the ARM input and output communication when debugging.

Semihosting view toolbar icons:

The Semihosting view toolbar commands include: Command Name Description

Clear Console Clear Console view content.

55

Scroll Lock Toggle the Scroll Lock.

Show semihosting info Show semihosting information. Semihosting view context menu commands: The Semihosting view context menu commands include: Command Name Description

Cut Cut the selected content.

Copy Copy the selected content to the system clipboard.

Paste Paste the content in the clipboard.

Select All Select all the content.

Find/Replace Find or replace specific element from the Rendering pane.

Open Link It always is in an invalid state.

Clear Clear all the content.

Scroll Lock Toggles the Scroll Lock. 4.4.9 Variables The Variables View displays information about the variables associated with the stack frame selected in the Debug View. When debugging a C/C++ program, data that contains variables can be expanded to show the variables and the fields the variables contain. You can view information about the variables in a selected stack frame in the Variables view. When execution stops, the changed values are by default highlighted. Like the other debug- related views, the Variables view will not be refreshed when you run your executable code. The refresh occurs when the execution stops.

56

Variables view

There are many commands available in the Variables View: Command Name Description Availability

Show Type Name Configure columns to show type names. View action

Show logic structure Show logic structure of the Variables. View action

Collapse All Collapse all the Variables. View action

Context menu Add Global Variables Add Global Variables. and view action

Remove Global Context menu Remove Global Variables. Variables and view action

Remove All Global Context menu Remove All Global Variables. Variables and view action

Open New View Open a new Variables view. View action

Pin to Debug Context View action

Select All Select all the variables in the view. Context menu

Copy the selected variables to the system Copy Variables Context menu clipboard.

Enable Enable a currently disabled variable. Context menu

Disable Disable a currently enabled variable. Context menu

Cast To Type… Cast To Type… Context menu

57

Allow you to create a memory monitor for View Memory Context menu the selected variable.

Select a format type. Choices include Format Binary, Decimal, Natural, and Context menu hexadecimal.

Open the search dialog to find elements in Find... Context menu the variables view.

Allow you to change the value for the Change Value... Context menu underlying selected variable.

Add Add Watchpoints(C/C++). Context menu Watchpoints(C/C++)

Allows you to create a watch expression Watch Context menu for the selected variable.

58

5 Project Management 5.1 Create Project CoIDE provides two models for creating projects:  Create a new project based on your target chip.  Create a new project based on your target board. You can select a MCU or a board to create a project and start your embedded development. A board is a set of components including basic components, driver components and app examples. If CooCox supports your target board, it is recommended to create a new project based on your target board. When you select the board, CooCox will show you all the components and examples that suitable for your board. You don’t need to do any modification on the examples and components. 5.1.1 Create Project by Chip Model To create an embedded project using CoIDE by chip model, you only need to perform the following steps: 1. Select “Project > New Project” from the menu or select “Create a New Project” from the welcome page.

59

2. A wizard window will pop up, enter a name for the project (for example: GPIO_Test), You can also modify the Project Path.

60

3. Choose a model. For example, select ''Chip Model', then click “Next”.

4. Select a chip. For example, select ''MKL05Z32VFM4''.

61

5. Click "Finish". CoIDE automatically generates GPIO_Test.coproj file and one configuration: "GPIO_Test".

6. Check a component; for example, select 'GPIO'. CoIDE will automatically check the components, which are depended by the checked component.

62

7. You can view the result in Component View.

8. You can also click Drivers to view the Driver pages and add the driver components to your project.

63

5.1.2 Create Project by Board Model To create an embedded project using CoIDE by board model, you only need to perform the following steps: 9. Select “Project > New Project” from the menu or select “Create a New Project” from the welcome page.

64

1. A wizard window will pop up, enter a name for the project (for example: Cookie_Test)

65

2. Choose a model. For example, select ''Board Model''. Then click “Next”.

3. Select a board. For example, select '' Cookie NuMicro'' which produced by CooCox.

66

4. Click "Finish". CoIDE automatically generates Cookie_Test.coproj file and one configuration: "Cookie_Test".

5. Click "Document". CoIDE will show document about cookie board in “Help” View.

67

6. Check a driver component; for example, select 'LCDShield'. CoIDE will automatically check the components, which are depended by the checked component.

7. You can review the result in “Peripherals” Page.

68

8. You can also click Drivers to view the Driver pages and add the other driver components to your project.

5.2 Manage Target/Groups/Files and Switch Chip 5.2.1 Target List Management in the Multi-configuration There is a default configuration target after creating project: Flash configuration target.

Click Target Manage button to manage configuration list. You can modify the configuration name, increase configuration, delete configuration, and change the sort order of configuration, set as current target and so on. Click OK to confirm.

69

In the project view, select the parent directory in which you want to create the Group (If you do not select the parent directory, the default is the root directory of the project), select Add Group in context menu:

Group edit box pops up, and you can add the Group.

70

Click Add Files menu item to add a link file to the project view:

Click the “New File” menu item to create a new file. As it is shown in the following figure, after clicking ''Open'' you can create a file and add the file to the project view as a link file.

71

Double click the file name in Project view to open and edit it.

72

5.3 Project configuration

Click Configuration button to open project configuration view. Configuration area is divided into seven different configuration items: Device, Compile, Link, Output, User, Debugger and Download. The first five configurations are building and linking configurations, the last two are debugging/programming configurations. 5.3.1 Change device Device can be changed in the latest version of CoIDE. However, the new chip might not be compatible with component files or other configuration you checked in the old chip, so errors or warnings could occur. User needs to consider carefully and modify appropriately. 1. Click ''Device'' in context menu in project view to change project chip.

73

2. Select the target file you need to change, and then click “Change Device”.

3. CoIDE will prompt you to confirm the change.

74

4. Click OK, then CoIDE will show you the following view. Peripherals view and all the other views will be associated to the new chip.

5.3.2 Compile configuration

1) Option area:

75

a) FPU: Select MCU type, it includes Not use FPU, FPU soft and FPU hard (Note: If you select the FPU hard, you need to enable FPU module in the code) b) Optimization: Select the level of optimization, it includes (None(-O0), Optimize(- O1), Optimize More(-O2), Optimize Most(-O3), Optimize Size(-Os)) 2) Include paths area: Add / Remove header files’ paths The added paths will be associated to the current path of the project file to be processed. 3) Defined Symbols area: Add / Remove pretreatment (macro definition) Symbol 4) Misc Controls area: User can edit (add) user-defined compile commands. 5) Compile Control String area: Show compile commands (do not edit) 5.3.3 Link configuration

1) Options area: a) Use Memory Layout from Memory Window (Checked by default) Check: Memory Areas will be available; Scatter File will be unavailable. Mean to use memory Areas memory data, and use IDE default link file (such as link.ld). Uncheck: Memory Areas will be unavailable; Scatter File will be available.

76

The system will add default link.ld/arm-gcc-link.ld and the memory.ld file in the directory of the project file, at the same time, the link file path is filled into the Scatter File area, and user can select a custom link file in the Scatter File area. b) Discard unused sections Allow recovery of unused input section. Segments that contain the entrance symbol and all the segments of undefined symbols in the command line will be retained. Segments that contain a dynamic object reference symbol will also be retained. Check this option to reduce code size. c) Don’t use standard system startup files

Do not use the standard system startup files when linking. The standard system libraries are used in default unless ‘-nostdlib’ or ‘-nodefaultlibs’ is used. d) Library select list Select link library: Not use C Library, Use base C Library, Use nano C Library*, Semihosting, Retarget Options: Printf float, Scanf float Note: “Use nano C Library” only work if you are using gcc-arm-none-eabi-4_7-2012q4 or higher version. If you choose “Use nano C Library”, it will provide two more options “Printf float” and “Scanf float”. Just like the following picture.

2) Linked Libraries area: Add/remove library file. Library is collection of a series of procedures, external function and variables. It is integrated into an application program by the compiler and linker during compilation, and made into a target file and an executable file that can run independently. The CoIDE library is the GCC library. 3) Memory Areas area The memory area is only available when “Use Memory Layout from Memory Window”) is checked. a) Select: Debug in Flash (default), Debug in RAM b) In “Memory Areas” area, start address and size for IROM and IRAM can be customized:

77

IROM and IRAM start address and size is automatically changed according to your choice, or you can manually modify these values. c) In Start line, IROM and IRAM start address can be customized; in Size line, IROM and IRAM size can be customized. 4) Scatter File area Scatter File area (available when uncheck “Use Memory Layout from Memory Window”, at the same time system in project file directory provides a default link file) In the area user can specify a custom link file path. 5) Misc Controls area Edit link command area, users can add custom link command. 6) Linker Control String area Cannot be edited, display the link commands information. 5.3.4 Output configuration The configuration area of output files after building project.

The files generated after building a project will be saved under a directory named with the formation of Executable+”/”+ Name of Executable. 1) Name of Executable: Specify the folder of the output files, the default is the configuration name of the current project configuration; 2) Path of Executable: Specify the output file path

78

3) Create Executable(.elf) :: Generate. elf executable files, by check / uncheck decide whether to generate the HEX or BIN file 4) Create Library(.a): Generate. a library file 5.3.5 User configuration Customize IDE implementation program Before Build, After Build and Before Debug.

In Before Build/Rebuild area implementation program before Build/Rebuild can be customized; in After Build/Rebuild area implementation program after Build/Rebuild can be customized. You can directly enter commands, or import. bat or. exe files. After configuration, you need build or rebuild the project. In Before Debug, if “Auto Compile Before Debugging” is checked, CoIDE will automatically execute incremental compile before debugging launched.

79

5.3.6 Debugger configuration

1) Hardware area a) Adapter: CoIDE supports Colink, CoLinkEx, Nu-Link, ST-Link, J-Link and Stellaris-ICDI debug adapter. b) Port: CoIDE supports SWD and JTAG debug modes. c) Max Clock (Hz): You can select the clock frequency from 2M, 1M, 500K, 300K and 100K. 2) Startup area Need to check or uncheck Run to main. 3) Advance area a) Reset Mode: There are three reset modes: HW RESET, VECTRESET and SYSRESETREQ. b) Semihosting Enable: Check to enable Semihosting function. c) CacheRom Enable: Check to enable ROM cache. 4) TargetInfo area Target Info area displays the host name and port number.

80

5) J-link Info area

In Adapter configuration items of the Hardware area, some special link such as J-Link Adapter has the particular configuration items, as shown below. It displays J-link debugger configuration information.

5.3.7 Download configuration

81

1) Auto Download Before Debugging: automatically download programs before debugging. 2) Verify After Download: verify programs after download. 3) Erase Full Chip: erase the full chip before download. 4) Erase Effected: erasing the affected sectors before download. 5) Do not Erase: do not erase the chip before download. 6) Programming Algorithm Will display Programming Algorithm file. 7) Add..., Remove and Default are used to configure Flash algorithm file. 5.4 Build project To build a project using CoIDE, you only need to perform the following steps: 1. Select Project > Build. If necessary, you can select Rebuild to recompile your project or select Clean to clean-up the project that has been compiled.

82

2. View compile information in the Console window.

5.5 Open project To open an existing project using CoIDE, you only need to perform the following steps: 1. Select Project > Open Project...or click Open a Project in the welcome page.

83

2. Find the project files with extension name as ''.coproj'' or ''.cob''.

3. View the opened project.

84

6 Debug 6.1 Introduction 6.1.1 Enter debug mode

You can click the Debug button” ” to enter into debugging mode. The debug mode has a quiet different interface comparing with edit mode. To learn more, you can go to Chapter 4.4 Debug View 6.1.2 Debug control The debug execution controls are realized by breakpoints. For example, if you attempt to step over a function and the program hits a breakpoint, it pauses, regardless of whether the function is completed. You can control your debug execution in various ways, but they all rely on a core set of debug controls. To control the debug session, you can use the buttons in the toolbar of debug mode. Reference: Chapter 4.2.2 Debug Toolbar Actions 6.1.3 Set breakpoints A breakpoint can be set on an executable line of the program. If a breakpoint is enabled when you are debugging, the execution will be suspended before the code of that line is executed. To add a breakpoint point, you could double-click the marker bar located in the left margin of the C/C++ Editor beside the line of code where you want to add a breakpoint. A dot will display in the marker bar and in the Breakpoints View, along with the name of the associated file. 6.1.4 Step mode CoIDE support two kinds of step modes: C code step and instruction step. C code step is the default option. C code step means executing the lines in c code area one by one, while the instruction step means executing a single assembler instruction at a time. To activate the instruction step mode, you just need to click the Instruction Stepping Mode option ( ) on the Debug view toolbar. Then when you click the step button ( ), the Debugger switches to the instruction stepping mode, the Disassembly view will be opened automatically. If you want to switch back to c code step mode, click the Stepping Mode option ( ) again.

85

6.1.5 Debug Example 1. Click Debug button to start debugging.

2. After debugging is stared successfully, CoIDE will enter into debugging mode.

86

3. Set a breakpoint by double clicking the marker bar.

4. Step in C code mode.

87

5. Step in instruction step mode.

6. Stop debugging.

88

6.2 How to use debug views The initial debug UI only shows a few debug views, you can open the other debug views through view menu. 6.2.1 Disassembly view The Disassembly view allows you examine your program as it is running disassembled code under stepping mode. This is useful when the instruction pointer enters a function for which it does not have the source. To open the Disassembly view, select View > Disassembly menu.

89

6.2.2 Memory view To open the Memory view, select View > Memory menu. Input the memory address you want to view, for example 0x20000000, then press Enter or click the Go button. Then you can view the memory space.

90

6.2.3 Variables view 1. To open the Variables view select View > Variables menu. Click Add Global Variables to add a global variable.

2. Check the global variables you want to add, then click OK button.

91

3. Right click on the variable and select the Change Value item to change the value of the variable.

4. Input the new value of the variable and click the OK button.

92

7 Components, Examples and Boards 7.1 Components In CooCox CoIDE, the reusable code is called component. A component can be a library, or a collection of source files, etc. It must provide useful functions, be easy to understand and use, and most importantly, it can work correctly. Each component has its corresponding code snippets, usage, documentation and comments. 7.1.1 Add Components 1. When you have created a project and selected a chip, CoIDE will show you a Repository View, which lists all the components that fit for the chip.

93

2. Check the Component you want to add to your project.

3. CoIDE will add the component and the dependent components to your project automatically.

94

4. You can also click the Driver page to view and add driver components.

5. Click the components’ names to view the help documents.

95

6. You can view the Doxygen documents for the component by clicking the related links in help view.

7. For the driver component, we have more documents that guide you to use.

96

7.1.2 Refresh and Update Components Refresh operation will synchronize the component list with remote server. Update operation will update the content of one component to latest. They are different. 1. If you want to refresh basic component list, click "Refresh Component List" button in the “Peripherals” page of “Repository View”.

97

2. If you want to refresh driver component list, click “Refresh Component List” button in the “Driver” page of “Repository View”.

3. CoIDE will show you a dialog to remind you which components can be downloaded or updated.

98

4. The right side of repository view shows the components which can be updated (or downloaded) with the state “Update” (or Download).

5. Click “Update” to update the component, and then it turns into “Available”.

99

7.1.3 Upload Components If you have a good component, you can upload it through CoIDE. Then, the other engineers over the world could see it after refresh component and benefit from it. Sharing make the world better. 7.1.3.1 Upload Basic Components What is a basic component? When we introduce COX interface, we used a picture. We will use it again to interpret basic component conception.

Beyond that, Basic components also include components of following categories:

 Algorithm  Board Support  System Boot  Startup Code  Common Files  File System  RTOS To upload a basic component, you need to perform the following steps:

100

1. There are two entries for uploading basic component, click the Upload Component button in the Repository View or in the Project menu.

2. Select “Basic Component”, and then click “Finish”.

101

3. Input the necessary information: “Component Name”, “Component Description”, and “Keywords”.

4. If your component has used CoX interfaces, select “Yes” and set the CoX interfaces you have used. Otherwise, just keep the default setting.

102

5. If you click “Advance”, you can define the Micro Definition for your component. If you define a micro definition, for example “My Comp Micro Definition”, when this component is checked, CoIDE will add “My Comp Micro Definition” to the compile setting: “Define Symbols” automatically.

103

6. Step 2-“Classification”. 1) Choose the manufacturer, for which your component is suitable. Put your cursor into the textbox, a pop up window will show you all options. If your component is suitable for all manufacturers, you should choose “All”. 2) Choose the chips for which your component is suitable. Put your cursor into the textbox, after a while, a pop up window will show you all chips according to the manufacturer you selected. 3) Choose the category, to which your component belongs. CoIDE will show your component in “Repository” View at a certain location according to the category you defined here.

104

105

7. Step 3-“Component Dependency”. “Component Dependency” is a conception that defines the relation of dependency between your component and other components existing in CoIDE. For instance, when you implemented the component “COX.Peripheral.KLx.xGPIO”, it referenced the interfaces provided by “xStartup”,”xLowLayer”,”xSysCtl” and “xCore” . Therefore, you have to specify the list of these four components required for the operation of “COX.Peripheral.KLx.xGPIO”. When other users check “COX.Peripheral.KLx.xGPIO”, CoIDE will check the other four components automatically according to the “Component Dependency” you defined before.

106

8. Step 4 - “Source Files”. Select your component source files from project or choose files from your file system.

107

9. Step 5-“Document Files” and you can edit your component document in “HTML Editor”. a) The Create APIs Document button: (the second button on the toolbar) can help you to create the APIs of your component code. If your code comments are Doxygen style, it will also create the API description for you.

108

b) If your document has already been prepared, you should choose “File System”. After all component document files have been added, you need to set the index of the document. The index of the document is just like the index page of a website.

109

c) After finish your document, you can click “Preview” button to preview the effect of your documents.

110

10. Step 6 - Publish. Congratulations! You can set your component version and then click “Publish” to share your component.

7.1.3.2 Upload Driver Components What is a driver component? When we introduce COX interface, we used a picture. We will use it again to interpret driver component conception.

In CoIDE, we define the code for the peripherals outside the chip as a Driver component. The Driver component is suitable for a Driver device such as LCD, Sensor, EEPROM, SD card, etc. They are classified by the device type, not the MCUs.

111

1. There are three entries for uploading driver components. Click the Upload Component button in the Repository View or in the Project menu. You can also click Upload Driver in Project View’s Context Menu.

2. Select “Driver Component” and then click “Finish”.

112

3. Input the necessary information: “Driver Name”, “Driver Description”, “Communication Interface” and “Keywords”. If your driver does not use CoX interfaces, just keep the default setting. Otherwise, choose “Yes”, and Choose the CoX interfaces you have used.

113

4. Step 2 - “Supported Device”. First, you can click “Add” to search the devices that already existed in CoIDE. If you can’t find the device, click “New” to create one.

114

5. The other options for uploading the driver component is the same as uploading the basic component. You can refer to 7.1.3.1 Upload Basic Component.

115

7.1.4 Modify or Delete Components 1. If you want to modify your components, you must login in first. Click the sign in to CooCox…

116

2. After you login in, find your basic component in “Repository” view and right click on the component, then choose “Modify” or “Delete”.

3. Then you can modify the content gradually. The modification UI is the same as uploading component. If you forget what the meaning of the content is, refer to the 7.1.3.1 Upload Basic Component.

117

4. After you finish the modification, go to step 6 and click “Save” button.

118

7.2 Examples CoIDE integrates many infrastructure components. In order to allow users to use these components more easily, each component can be associated to multiple sample code fragments. You can view them and add them to your project. You also could upload your own examples to the Internet. 7.2.1 View examples 1. Click the component which shows "with x example(s)" in the Component View of CoIDE.

119

2. The example view will appear and display all the code snippets of the selected component.

3. Click “view “ to view the examples you are interested in.

120

4. The code snippet will display in the code editor viewer.

5. You can click "More Example for xxx" to view more examples for the selected chip.

121

6. Other examples will be show in “More Examples” view based on the component classifications.

7. Click the example name to open the example in the edit view.

122

7.2.2 Adding code snippet 1. Click “add ” to add the example you are interested in.

2. A dialog will show you where the example will be located. Click "yes".

123

3. The code snippet will be automatically added to the project.

124

7.2.3 Upload Examples If you want to upload an example, make sure you have logined in first. You can upload an example for a basic component or a driver component or a board. 7.2.3.1 Entries for Uploading Examples 1. The first entry: “Upload Example” in the Project Menu. 2. The second entry: Click the component which you want to upload an example for in “Components” view, then the “Examples” view will show all examples existed which belong to the component. Click “Have a better example snippet? Share with others?” to upload an example. 3. The third one, “Upload Example” in Project View’s Context Menu. 7.2.3.2 Upload an Example 1. Click “Have a better example snippet? Share with others?”

125

2. Input the necessary information: “Example Name”, “Example Description”.

3. Specify the example source files.

126

4. Set “Add to Main()”. If you check “Add to Main ()”, when users add the example code to his project, CoIDE will automatically add the function of “Blinky.c” to “main.c”.

127

5. Step 2 -“Dependency”: Select the Example type, for a basic component or a driver component. If your example used interfaces which provided by other components when you implement, you should specify those components in “Example Dependency”. Then when users add your example to project, CoIDE will automatically add the components that your example depends to project too.

128

6. Step 3 -“Document Files”. Edit your document in “HTML Editor”. If your document had been prepared already, choose “File System”. After all component document files have been added, you have to set the index of the document. After finish your document, you can click “Preview” button to preview the effect of your documents.

129

7. Then you can click “Publish” to share your example.

130

7.2.4 Modify an Example 1. After you login in, you can modify or delete an example of your own. You need to find your example in “Examples” view, and click “modify”.

131

2. Then you can modify the content step by step. The modification UI is the same as uploading example. Refer to the chapter 7.2.3.2 Upload An Example.

3. After you finish modification. Go to step 4 and click “Save” button.

132

7.3 Board Board is actually a set of components including basic components, driver components, app examples that are suit for the board. Therefore, if you have a board, which is already existed in CoIDE, it is very convenient to start your development against the board. CoIDE has offered a board model in “New Project” wizard; you can create a new project of “Board Model”. Refer to Chapter 5.1.2

133

1. The first entry for viewing board list is in “New Project” wizard.

2. The second entry for viewing board list: after you create a new project by “Board Model”, you can view board list in “Board List” page of “Repository” view.

134

7.3.1 Refresh Board List In “Board List” page of “Repository” view, click “Refresh Board List” to refresh board list.

7.3.2 Update a Board In “Board” page of “Repository” view, click “Refresh” to update your current board to latest.

135

7.3.3 Upload a Board There are two entries for uploading a board, in “Project” menu, “Board” page of “Repository” view. You need to do the following operations.

136

1. Input necessary information: “Board Name”, “Board Description”. If you want users know more about your board, you should input more information.

2. Input the necessary information: “Board Name”, “Board Description”.

137

3. Step 2-“Classification”. “Chip Manufacturer” means the manufacturer of the chip that your board based on. “Chip” means the chip that the board uses. “Board Manufacturer” means the manufacturer that makes the board. For instance, the cookie board which make by CooCox (more info: http://www.coocox.org/Cookie.html ). The cookie board uses the chip M0516LBN that make by Nuvoton. So i set “Nuvoton” for “Chip Manufacturer” and set “M0516LBN” for “Chip”.

138

4. Step 3-“Associate Components”. Specify driver components that are suitable for your board. When other users choose your board, they could see the driver components that you specified at this step in “Board” page of “Repository” view.

139

5. Step 4-“Associate Examples”. If you have app examples for the board, you should upload these app examples first (Refer to chapter 7.2.3 Upload Example), and then you can associate these examples with the board by this step. When other users choose your board, they could see the app examples which you specified at this step in “Board” page of “Repository” view.

140

6. Step 5-“Document Files”. Edit your board document in “HTML Editor”.

7. Set your board image and then click “Publish” to upload your board.

141

7.3.4 Modify a Board 1. After you login in, in “Board” page of “Repository” view, if you are the committer of the board, the “Modify” button will be enabled. Click “Modify”, then you can modify your board.

2. Then you can modify the board. Refer to the chapter 7.3.3 Upload a Board.

142