Eclipse + CDT + yagarto + j-link,stm32 Open Source development environment Setup and commissioning

Source: Internet
Author: User
Tags windows x86 java se

Eclipse+cdt+yagarto+j-li; Open source development environment setup and commissioning; Chongqing e-mail: [Email protected] ; Document version: V1.0; release date: 2014-08-04; This document is based on the LGPL protocol, which is published on the basis of open source, because of the small information on the online open source MCU and microcontroller development platform, it is because of the keiluvision development environment of ARM company. ; Because Eclipse is a

Eclipse + CDT + Yagarto + j-link,stm32

Open Source Development environment Setup and commissioning

Author: Chongqing

Email: [Email protected]

Document Version: V1.0

Release Date: 2014-08-04

Objective

This document is published in the spirit of open source, based on the LGPL protocol. If revised and republished, please indicate the original author, email, original version and date of revision.

Because the online open source SCM, microcontroller development platform information is very few, so publish this document, readers.

Using ARM's Keil uvision development environment to develop microcontrollers, microcontrollers and publishing commercial products involving copyright issues requires a hefty royalty fee, which is a huge expense for small and medium-sized companies. Therefore, the search for Keil uvision alternative solutions.

Because Eclipse is an open source development platform and supports the development of various plug-ins, it is possible to build an open source development platform in Eclipse + CDT + Yagarto + j-link.

Eclipse is an open source, free, cross-platform, integrated development environment that supports plug-in extensions for Java, C/s + +. Eclipse can be a better support for C + + development through CDT, and readers can download the CDT version of Eclipse directly from the Eclipse website. Adding the GNU arm Eclipse plug-in to eclipse, combined with the Yagarto GNU arm toolchain and J-link emulation debugger, is a good way to support STM32 development and debugging.

But Eclipse has its drawbacks. Eclipse is easy to do Java development, code editing and hints, code compilation is very convenient, but the code hints for C + + is inconvenient. Eclipse is bloated and code compilation is slow. Eclipse's GNU ARM Environment is complex and difficult to debug. Here, I still recommend the use of em::blocks. Em::blocks small, not as big as Keil uvision, nor as bloated as eclipse. Em::blocks installation, configuration relative Keil uvision is simpler and easier, and Eclipse's environment configuration is more complex and error-prone. Em::blocks's code-editing environment is quite intelligent and relatively keil uvision much better than eclipse. Em::blocks embedded the GNU compiler, the code is compiled at a speed that Keil uvision and Eclipse cannot match. Em::blocks embedded in the support of several JTAG emulation debugger, debugging convenient and fast, compared to Keil uvision is no inferior. Eclipse's code hints, configuration, compilation, debugging experience is very poor, do not repeat here. Em::blocks STM32 development environment in the "Emblocks + j-link,stm32 Open Source development environment Setup and commissioning" in this document is detailed.

Development environment

System: Windows 7 Ultimate Edition.

Development tools:

1.

2, because Eclipse is developed in Java, so need Java environment, just download the installation JRE, here we download and install

(contains JRE), Windows x86,32_bit;

3. To enable eclipse to support arm development, you need to download and install a plugin: (Ilg.gnuarmeclipse.repository-1.8.1-201401111229.zip);

Because the CDT plugin is already included in our downloaded Eclipse IDE for C + + developers, we do not need to install it manually, 4, CDT plugin,

If you are downloading another version of Eclipse, you need to manually install the CDT plugin yourself;

5, Yagarto,gnu ARM toolchain:

Official website:, Tools download official website:

Download install: (yagarto-tools-20121018-setup.exe) and (yagarto-bu-2.23.1_gcc-4.7.2-c-c++_nl-1.20.0_gdb-7.5.1_eabi_20121222. EXE),:

6, J-link Drive Kit: Setup_jlinkarm_v434d.zip.

, version: 4.3.1,32_bit;

To install the cross-compilation tool:

1, the above tools are downloaded well, first install the Java SE Development Kit 7u51, yagarto-tools-20121018 (prior to Yagarto

GNU arm toolchain installation), Yagarto GNU arm toolchain and J-link Drive Toolkit;

2, decompression eclipse to the specified directory, enter the directory, open Eclipse.exe, configure the Eclipse working directory;

3. Install the GNU ARM Eclipse plug-in plugin, eclipse? Help? Install New Softwares, click "Add" to the right of "work with",

Click "Local ..." to the right of "Name" in the pop-up box, add the extracted GNU ARM Eclipse Plug-in plugin directory, click OK, then step down until Eclipse restarts;

Eclipse Configuration:

1. Eclipse Encoding Format configuration:

(1) Window? Preferences, left navigation tree to general? Workspace, right "Text file Encoding", select "Other",

Changed to "UTF-8";

(2) Window? Preferences, left navigation tree to general? Content Types, right "content Types" tree, click "Text",

Select "C Source File", in the following default encoding box, fill in "UTF-8", click on the right "Update";

2, display line number: Window? Preferences? General? Editors? Text Editors, select the "Show line numbers" check box on the right, and select the "Insert Spaces for tabs" checkbox, with a space instead of tab, so that code alignment issues occur when you compile with another compiler;

3, modify the font: Window? Preferences? General? Appearance? Colors and Fonts, in the right-side tree list, select C/C + +? Editor?

You can edit the text font;

4, modify the default code format: Window? Preferences? C + +? Code Style? Formatter, click "New" on the right to create a new format configuration, modify the configuration, and then save it. You can also export the configuration through the "Export all" and simply import the configuration when you reload eclipse;

5. Display spaces and tabs: Window? References? General? Editors? Text Editors, check the right "show whitespace characters", you can also click "Configure Visibility" to select the white space characters to display, here you can cancel "carriage Return" and "line "Trailing" Display of the Feed ";

6, display the maximum column width range: The general code specification will require that the maximum column width of the code is 80 characters, and Eclipse provides the maximum line width hint: Window? Preferences? General? Editors? Text Editors, on the right, check "Show print margin";

7. In order to prevent files from being modified in the project directory outside of Eclipse causing the file to be unsynchronized, the "Resource ' project name ' is out of sync with the file system." Problem, workaround: Window? Preferences? General? Workspace, on the right, select "Refresh using native hooks or polling" and "Refresh on Access"

8, the modified code does not have to save the direct compilation: Window? Preferences? General? Workspace, on the right, select "Save automatically before build";

, click "Edit" on the right,

Compile the configuration:

1. Ctrl + N, create a new project, select "C Project" under C + +, click "Next", and in the pop-up box, select

And, add the item name, point "Next", in

Set the processor parameters in the pop-up box because our processor is STM32F103VET6, so chip family instead

, Flash size changed to 512,ram size to "next", "Next",

"Next", to the cross GUN ARM toolchain box, toolchain name to

, Toolchain Path instead

Yagarto

The path of the GNU ARM toolchain, such as

Explorer to see the structure of the project, and after you click OK, you can

2. Right-click the project name? Properties,c/c++ Build? Tool Chain Editor, change the right of current builder to

3, after the configuration, put your own. c files into the SRC directory of the project root directory, the. h file is placed in the Include directory of the project root, select

Eclipse directory tree, right-click Refresh or F5, you can see the file you just added, click

See compilation generated hex file.

4, just start our code default to debug mode, if you want to modify the release mode, right-click the project name? Preperties, in the popup box of the

In the left tree directory, select C + + Build? Tool Chain Editor, click on the upper right corner of the "Manage configurations" in the pop-up box to select the release? Click Set Active? Click OK, then Crtl + B, Sir into release version of Elf and hex files Open Debug Configurations? In the pop-up box, click

Under Page, click, under Custom Configuration, in the box below the main tab on the right, select the release version of the Elf file, click "OK", or CTRL + B, you can

5. If you already have an Eclipse project, you can import an existing project: File? Import or right-click the Eclipse directory tree? Import, in the box that pops up

Select General?

And

Here, the compilation configuration is complete

Next,select root directory Select the project root, select, click "Finish" to complete;

Debug Configuration:

1. Open Debug Configurations? In the pop-up box, double-click the left tree

2, on the right of the main tab, under the C + + application text box, click, in the pop-up box has been assumed to create a new configuration;

Generated elf files and the default debug generated elf files, if you want to change the release generated files, and then change;

3. Under the Debugger tab, gdb command text box, select the Yagarto compiler to install the GDB debugging tools, such as:

, if Yagarto has automatically modified the environment variable when installing Yagarto, you can

To directly fill in the "Arm-none-eabi-gdb.exe"; Port number changed to 2331;jtag device to generic TCP/IP (if not, change to j-link);

4. Under the Startup tab, in the Initialization commands text box, enter the following:

Monitor Flash device = Stm32f103ve

Monitor Flash download = 1

Monitor Flash breakpoints = 1

Monitor CLRBP

monitorendianlittle;monitorspeed5;monitorreset;monitorsleep100;monitorspeedauto;monitorwriteu320xe000ed0; note: among them, Monitorflashdevice required; runcommands text box fill in the following:; Monitorregr13= (0x0000000;mo

Monitor Endian Little

Monitor Speed 5

Monitor Reset

Monitor Sleep 100

Monitor Speed auto

Monitor Writeu32 0xe000ed08 = 0x00000000

Note: The monitor flash device needs to modify itself according to its own STM32 device;

In the Run commands text box, fill in the following:

Monitor Reg R13 = (0x00000000)

Monitor reg PC = (0x00000004)

Break Main

Continue

Note: Please do not tick the option in Runtime option.

Then click Apply and make sure GDB server (such as open Segger j-link gdb server v4.34d from the Start menu) is turned on and connected properly, click Debug to Start Debugging.

The Eclipse + CDT + yagarto + j-link,stm32 Open Source development environment is complete.

Comparison of several compilation environments

1, Keil uvision + j-link

Keil Uvision is an integrated development environment provided by ARM, which is mainly used in the field of microcontrollers. Relatively stable and reliable, for a variety of chips have better support. The target code generated by Keil uvision is highly efficient, the assembly code is compact and easy to understand. The disadvantage is that Keil uvision need a lot of licensing fees, not suitable for small and medium-sized companies to develop commercial software, Keil uvision project construction and configuration is not very convenient; Keil uvision code editing is not very convenient.

2. Eclipse + CDT + Yagarto + j-link

As an open source development platform, Eclipse Yagarto as an open source GNU development tool chain that combines to provide a better open source STM32 development environment. Eclipse's source editing environment is very friendly and can speed up the editing of your source code. Eclipse is primarily used to develop Java, which can be supported by the CDT plug-in, but it is bloated, slow, and not very friendly to the dev/C + + source editing environment, which is not as convenient as Java. Installing the GNU ARM Eclipse Plug-in plug-in in Eclipse, configuring the compilation and debugging environment is cumbersome, very error-prone, when debugging, the first to open the J-link GDB Server, then debug the interface to debug, debugging CPU can not reset, Every debugging to re-burn flash, time-consuming, while frequent burning flash also reduce the flash life.

3, Em::blocks + J-link

The Em::blocks integrated development environment is based on the Code::Blocks integrated development environment. Code::Blocks is an open-source, free, cross-platform, plug-and-build integrated development environment that supports plugin extensions. Code::Blocks supports the development of multiple applications and is small, stable, reliable and fast, and is a very powerful integrated development environment. Em::blocks inherits the advantages of Code::Blocks and is only developed for the embedded platform and optimized for the embedded development environment. The GNU arm compiler is embedded in em::blocks, with support for JTAG emulation debuggers such as J-link. There is no need to do too much configuration for GNU arm and J-link when installing Em::blocks. Compiling the code is very fast. Code editing, code hinting relative to Keil Uvision did a great job, and no less than eclipse. Creating a project is easy, Em::blocks automatically adds firmware library code based on the processor you chose when you created the project, as long as you add your own project code. When debugging, Em::blocks automatically calls J-link GDB Server, or it can reset the CPU, or execute programs in RAM to reduce flash burning.

Em::blocks relative Keil uvision Open source, free, at the same time the project management is convenient, code editing, hints are very good; em::blocks relatively small, fast, embedded in the GNU and J-link support, configuration is very convenient, Debug automatically calls J-link, can reset the CPU, greatly simplifies the operation under Eclipse. The em::blocks is a very powerful, integrated development environment that is very friendly to embedded development support.

Eclipse + CDT + yagarto + j-link,stm32 Open Source development environment Setup and commissioning

Related Article

Contact Us

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

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

A Free Trial That Lets You Build Big!

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

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

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