Difference between revisions of "Embedded Studio"

From SEGGER Wiki
Jump to: navigation, search
(Project Setup and Build)
(37 intermediate revisions by 4 users not shown)
Line 9: Line 9:
 
</div>
 
</div>
   
= Licensing =
+
== Installation & Licensing ==
 
[[Get a License for Nordic Semiconductor Devices]]
 
[[Get a License for Nordic Semiconductor Devices]]
   
  +
[[Get a Embedded Studio license for Serious Integrated development kits]]
= Project Setup and Build =
 
  +
  +
[[Installation on newer Linux Versions]]
  +
  +
[[Installation issues on macOS Catalina]]
  +
  +
[[Start multiple Embedded Studio instances on macOS]]
  +
  +
[[License installation on a headless system]]
  +
  +
[[Embedded Studio evaluation period error]]
  +
  +
== Performance ==
  +
[[Resolving slow build / high CPU usage issues]]
  +
  +
== Project Setup and Build ==
 
[[Port Projects from IAR Embedded Workbench to Embedded Studio]]
 
[[Port Projects from IAR Embedded Workbench to Embedded Studio]]
   
 
[[Use an external Toolchain with Embedded Studio]]
 
[[Use an external Toolchain with Embedded Studio]]
  +
  +
[[Porting from GCC to SEGGER Linker]]
  +
  +
[[Add new Memory Sections and Segments]]
   
 
[[Create a RAM Function]]
 
[[Create a RAM Function]]
   
  +
[[Multiple project in one solution in Embedded Studio]]
= Debugging =
 
[[Configure ETB Trace in Embedded Studio]]
 
   
  +
[[How to create a library project and use it in executable project]]
[[Configure SWO in Embedded Studio]]
 
   
[[Enable RTOS Awareness in Embedded Studio]]
+
[[Using User Build Steps in Embedded Studio]]
   
  +
[[Embedded Studio project file format]]
=VCS configuration=
 
Version Control System (VCS) is an essential tool for individuals or development teams. SEGGER Embedded Studio integrates with several popular source-control systems to provide this feature for files in your Embedded Studio projects.
 
   
  +
[[Migrating projects from Embedded Studio V4 to V5]]
The source-control capability is implemented by a number of third-party providers, but the set of functions provided by Embedded Studio aims to be provider independent. This article will explain how to set up such a system and how to use it.
 
   
  +
[[Static code analysis in Embedded Studio]]
== Set up source control system ==
 
Embedded Studio supports Subversion, Git, and Mercurial as source-control systems. To enable Embedded Studio to utilize source-control features, you need to install the appropriate command line client on your operating system for the source-control systems that you will use.
 
   
  +
[[Embedded Studio Library IO]]
Once you have installed the command line client, you must configure Embedded Studio to use it.
 
   
  +
== Project Configuration ==
'''To configure Subversion:'''
 
  +
Embedded Studio features a powerful project management that enables full flexibility to configure any part of the project for best results.
# Choose Tools > Options.
 
  +
As part of this, options can be changed on any node within a project while inheriting unchanged options from higher levels.
# Select the Source Control category in the options dialog.
 
# Set the Executable environment option of the Subversion Options group to point to Subversion svn command. On Windows operating systems, the Subversion command is svn.exe.
 
   
  +
=== Private & Public Build Configurations ===
'''To configure Git:'''
 
  +
Usually a project within any IDE is setup with different build configurations for different purposes.
# Choose Tools > Options.
 
  +
This can be one configuration to create code with output and information used for debugging (called "Debug") and one configuration which is optimized for size or speed to be used in the final product (called "Release").
# Select the Source Control category in the options dialog.
 
  +
There are some differences between these build configurations.
# Set the Executable environment option of the Git Options group to point to Git git command. On Windows operating systems, the Git command is git.exe.
 
  +
The configuration "Debug" is set up to produce debug information for the debugger, disables optimization, sets some defines to do additional checks in the code or to output messages to a debug terminal, or includes code used only for debugging.
  +
The configuration "Release" is set up to do only what is required in the product. Optimizations are enabled, defines are set to not do debug output, and debug runtime checks might be disabled.
  +
On the other hand a lot of options are shared between all build configurations.
  +
That can be the target processor, include directories, application-specific or device-specific defines, floating-point implementation, and compiler and linker configuration.
   
  +
With Embedded Studio default and shared options can be set in one place. Specific options can then be set or overridden per build configuration.
'''To configure Mercurial:'''
 
  +
This is what Private Configurations and Public Configurations are used for.
# Choose Tools > Options.
 
  +
A Public Configuration is a Build Configuration. It can be selected and built, and generates the output.
# Select the Source Control category in the options dialog.
 
  +
Private Configurations cannot be built. Instead Public Configurations can inherit the options set in one or more Private Configurations.
# Set the Executable environment option of the Mercurial Options group to point to Mercurial hg command. On Windows operating systems, the Git command is hg.exe.
 
  +
That way all Build Configurations ("Debug" and "Release") can inherit the shared options from the same Private Configuration ("Common").
[[File:SVN_Example.PNG|thumb|Example with SVN|none]]
 
  +
Target processor, include directories, ..., need to be set only in "Common" and are used in both, "Debug" and "Release".
   
  +
Private Configurations can also set defaults, which may be overridden or extended by Public Configurations.
== Source control capabilities ==
 
The source-control integration capability provides:
 
* Connecting to the source-control repository and mapping files in the Embedded Studio project to those in source control.
 
* Showing the source-control status of files in the project.
 
* Adding files in the project to source control.
 
* Fetching files in the project from source control.
 
* Optionally locking and unlocking files in the project for editing.
 
* Comparing a file in the project with the latest version in source control.
 
* Updating a file in the project by merging changes from the latest version in source control.
 
* Committing changes made to project files into source control.
 
   
  +
Include Directories and Preprocessor Definitions are always extended.
When Embedded Studio loads a project, it examines the file system folder that contains the project to determine the source-control system the project uses. If Embedded Studio cannot determine, from the file system, the source-control system in use, it disables source-control integration.
 
  +
"Common" might set the Include Directories "Inc; Setup; Device" and the Preprocessor Definitions "USE_OS;APP_VERSION=210;ENABLE_IPv6=0". These are used in "Debug" and "Release" builds.
  +
"Debug" might additionally add Include Directories "Config_Debug" and Preprocessor Definitions "DEBUG;ENABLE_CHECKS=1".
  +
"Release" might instead add "Config" and "NDEBUG;ENABLE_CHECKS=0".
   
  +
Selection Options, such as Optimization Level, Architecture, and FPU Type, can be overridden.
That is, if you have not set up the paths to the source-control command line clients, even if a working copy exists and the appropriate command line client is installed, Embedded Studio cannot establish source-control integration for the project.
 
  +
"Common" might set Architecture as "ARM v7EM", FPU Type as "FPv5-D16", and Optimization Level to "None".
  +
In "Debug" nothing has to be changed, as this already fits.
  +
In "Release" the Optimization Level might be overridden to "Optimize for Size".
   
  +
Now Include Directories, Preprocessor Definitions, and Optimization Level are different, while the common ones do not have to be maintained in each Build Configuration.
'''User credentials'''
 
   
  +
=== Override Options ===
You can set the credentials that the source-control system uses, for commands that require credentials, using VCS > Options > Configure. From here you can set the user name and password. These details are saved to the session file (the password is encrypted) so you won't need to specify this information each time the project is loaded.
 
  +
In Embedded Studio options cannot only be set on Solution or Project level. They can be set on any level, solution, projects, folders, and files.
  +
As with Build Configurations, all options that are not explicitly modified on a level, are inherited from the upper level.
  +
This enables modifying some options, such as defines, include directories, or optimization level, on one level, while retaining all other options.
   
  +
For example, a project should be optimized for size, but one module should instead be optimized for highest speed.
'''Note'''
 
  +
All options are set on project level. Only the optimization level of the module is changed.
   
  +
Private and Public Configurations also apply on all levels.
Embedded Studio has no facility to create repositories from scratch, nor to clone, pull, or checkout repositories to a working copy: it is your responsibility to create a working copy outside of Embedded Studio using your selected command-line client or Windows Explorer extension.
 
  +
This also makes it possible to change the option of any level depending on the selected Build Configuration.
   
  +
=== Project Options ===
The "Tortoise" products are a popular set of tools to provide source-control facilities in the Windows shell. Use Google to find TortoiseSVN, TortoiseGit, and TortoiseHG and see if you like them.
 
  +
To open the Project Options Dialog, select the item to change the options for in Project Explorer and go to Project -> Options... (Alt+Return), or right-click on the Item -> Options...
   
  +
In the upper left of the Options Dialog the Public or Private Configuration to change the options in can be selected.
'''Source-control operations'''
 
  +
By default the active Build Configuration is selected.
   
  +
The "Search Options" text input enables easy filter for the option to be modified.
Source-control operations can be performed on single files or recursively on multiple files in the Project Explorer hierarchy. Single-file operations are available on the Source Control toolbar and on the text editor's shortcut menu. All operations are available using the Project > VCS menu. The operations are described in terms of the Project Explorer shortcut menu.
 
   
  +
When "Show Modified Options Only" is checked, only options which do not have default values are shown.
More information can be found in the Embedded Studio user manual: ''SEGGER Embedded Studio > SEGGER Embedded Studio User guide > Using source control''
 
  +
Options which are modified on the selected item and configuration are marked with "modified".
  +
"inherited" indicates that the option has been modified in another configuration or on a higher level.
  +
Which value is inherited from which level and configuration is shown in the Description when the item is selected.
   
  +
==== Code Options ====
== Set up external diff tool ==
 
  +
''Main Article:'' [[Embedded Studio Code Options]]
To show the differences between the file in the project and the version checked into source control you can use the build in diff tool:
 
   
  +
The Code Options configure the build system, the toolchain (compiler, assembler, linker), the preprocessor, library configuration, and user build steps.
# In the Project Explorer, right-click the file.
 
# From the shortcut menu, choose Source Control > Compare.
 
[[File:Internal_Diff_Tool.PNG|thumb|ES internal diff tool|none]]
 
   
  +
==== Debug Options ====
You can also use an external diff tool in preference to the built-in Embedded Studio diff tool. To define the diff command line Embedded Studio generates, choose Tools > Options > Source Control > Diff Command Line. The command line is defined as a list of strings to avoid problems with spaces in arguments. The diff command line can contain the following macros:
 
  +
''Main Article:'' [[Embedded Studio Debug Options]]
   
  +
The Debug Options configure how the project should be debugged, which debug interface (J-Link, GDB Server, Simulator) should be used, and how the target should be configured on certain operations.
* $(localfile): The filename of the file in the project.
 
* $(remotefile): The filename of the latest version of the file in source control.
 
* $(localname): A display name for $(localfile).
 
* $(remotename): A display name for $(remotefile).
 
[[File:Diff_Cmd_Example.PNG|thumb|Cmd line example with WinMerge|none]]
 
   
  +
==== ES PRO Options ====
=Installation on newer Linux versions=
 
  +
''Main Article:'' [[Embedded Studio PRO Options]]
On some newer Linux versions root rights for installing Embedded Studio are not granted per default.
 
To counter that issue the following workaround can be applied. Simply execute the following command in the terminal:
 
   
  +
The ES PRO Options are available when the [[Embedded Studio PRO]] Package is installed.
'''''xhost si:localuser:root'''''
 
  +
They configure which components of ES PRO to use in the project and how the libraries should be configured.
   
  +
== Debugging ==
This workaround has been confirmed to work for:
 
  +
[[Configure_instruction_trace_in_Embedded_Studio|Configure Instruction Trace in Embedded Studio]]
   
  +
[[Configure SWO in Embedded Studio]]
* Ubuntu 17.10
 
  +
* Fedora 26
 
  +
[[Enable RTOS Awareness in Embedded Studio]]
...
 
   
  +
[[Connect to remote J-Link via J-Link Tunnel Server]]
This list will be updated once other Linux versions have been confirmed to work with that workaround.
 
   
  +
[[Embedded Studio with GDB Server|Debug with Embedded Studio and GDB Server such as OpenOCD]]
   
  +
[[Set User-dependent J-Link connection in Embedded Studio]]
'''Note:''' We strongly suggest to revoke the root rights after a successfull installation.
 
To do that simply execute the following command in terminal:
 
   
  +
== SEGGER Linker ==
'''''xhost -si:localuser:root'''''
 
  +
[[How to enable SEGGER Linker in your Embedded Studio project]]
   
  +
[[Placing external library symbols at specific address]]
=Connecting to J-Link via J-Link Remote Server=
 
   
  +
[[Correct typing of Thumb functions]]
The [https://newsitework.segger.com/products/debug-probes/j-link/tools/j-link-remote-server/ J-Link Remote Server] makes it possible for Embedded Studio to connect to a J-Link remotely, without needing a physical connection to the J-Link.
 
   
  +
[[Place Functions in RAM with SEGGER Linker]]
In order to connect to a J-Link Remote Server using Embedded Studio, follow these instructions:
 
   
  +
[[Integrity checks with Embedded Studio and SEGGER Linker]]
* Open your project options (right click on your project in the Project Explorer and select '''Options''')
 
* Under '''Debug''' select the '''J-Link''' menu item
 
* Edit the '''Host connection''' field
 
[[File:ES_ConnectToRemoteServer.png|thumb|Project options|none]]
 
* In the property editor, set the '''Host Connection'''
 
** For a remote server running in LAN mode, enter "IP <RemoteServerIP>".
 
** For a remote server running in tunneling mode, enter "IP tunnel:<SN/Nickname>[:<Pasword>[:tunnelserver[:port]]]"
 
[[File:ES_ConnectToRemoteServer_2.png|thumb|Property editor for J-Link host connection|none]]
 
* Click '''OK'''
 
   
  +
== Version Control ==
From then on, the J-Link is handled the same as if it was connected directly via USB.
 
  +
[[VCS Configuration]]
   
 
[[Category:Software Tools]]
 
[[Category:Software Tools]]
  +
[[Category:Embedded Studio]]

Revision as of 14:52, 27 October 2020

Embedded Studio, is a complete all-in-one solution for managing, building, testing and deploying your embedded applications: From the Project Generator which gets you easily started with common ARM microcontrollers, to the powerful Project Manager and source code Editor, the included C/C++ Compiler and the integrated Debugger with advanced debug information windows and direct J-Link integration, right through to version control features for automatic deployment of your applications.

Embedded Studio's uses a style similar to Microsoft's Visual Studio. It brings the same intuitive usage that PC developers are familiar with to the world of embedded engineering.

This wiki page explains and links to details and device specifics that can not be found on the Embedded Studio Product page.

Installation & Licensing

Get a License for Nordic Semiconductor Devices

Get a Embedded Studio license for Serious Integrated development kits

Installation on newer Linux Versions

Installation issues on macOS Catalina

Start multiple Embedded Studio instances on macOS

License installation on a headless system

Embedded Studio evaluation period error

Performance

Resolving slow build / high CPU usage issues

Project Setup and Build

Port Projects from IAR Embedded Workbench to Embedded Studio

Use an external Toolchain with Embedded Studio

Porting from GCC to SEGGER Linker

Add new Memory Sections and Segments

Create a RAM Function

Multiple project in one solution in Embedded Studio

How to create a library project and use it in executable project

Using User Build Steps in Embedded Studio

Embedded Studio project file format

Migrating projects from Embedded Studio V4 to V5

Static code analysis in Embedded Studio

Embedded Studio Library IO

Project Configuration

Embedded Studio features a powerful project management that enables full flexibility to configure any part of the project for best results. As part of this, options can be changed on any node within a project while inheriting unchanged options from higher levels.

Private & Public Build Configurations

Usually a project within any IDE is setup with different build configurations for different purposes. This can be one configuration to create code with output and information used for debugging (called "Debug") and one configuration which is optimized for size or speed to be used in the final product (called "Release"). There are some differences between these build configurations. The configuration "Debug" is set up to produce debug information for the debugger, disables optimization, sets some defines to do additional checks in the code or to output messages to a debug terminal, or includes code used only for debugging. The configuration "Release" is set up to do only what is required in the product. Optimizations are enabled, defines are set to not do debug output, and debug runtime checks might be disabled. On the other hand a lot of options are shared between all build configurations. That can be the target processor, include directories, application-specific or device-specific defines, floating-point implementation, and compiler and linker configuration.

With Embedded Studio default and shared options can be set in one place. Specific options can then be set or overridden per build configuration. This is what Private Configurations and Public Configurations are used for. A Public Configuration is a Build Configuration. It can be selected and built, and generates the output. Private Configurations cannot be built. Instead Public Configurations can inherit the options set in one or more Private Configurations. That way all Build Configurations ("Debug" and "Release") can inherit the shared options from the same Private Configuration ("Common"). Target processor, include directories, ..., need to be set only in "Common" and are used in both, "Debug" and "Release".

Private Configurations can also set defaults, which may be overridden or extended by Public Configurations.

Include Directories and Preprocessor Definitions are always extended. "Common" might set the Include Directories "Inc; Setup; Device" and the Preprocessor Definitions "USE_OS;APP_VERSION=210;ENABLE_IPv6=0". These are used in "Debug" and "Release" builds. "Debug" might additionally add Include Directories "Config_Debug" and Preprocessor Definitions "DEBUG;ENABLE_CHECKS=1". "Release" might instead add "Config" and "NDEBUG;ENABLE_CHECKS=0".

Selection Options, such as Optimization Level, Architecture, and FPU Type, can be overridden. "Common" might set Architecture as "ARM v7EM", FPU Type as "FPv5-D16", and Optimization Level to "None". In "Debug" nothing has to be changed, as this already fits. In "Release" the Optimization Level might be overridden to "Optimize for Size".

Now Include Directories, Preprocessor Definitions, and Optimization Level are different, while the common ones do not have to be maintained in each Build Configuration.

Override Options

In Embedded Studio options cannot only be set on Solution or Project level. They can be set on any level, solution, projects, folders, and files. As with Build Configurations, all options that are not explicitly modified on a level, are inherited from the upper level. This enables modifying some options, such as defines, include directories, or optimization level, on one level, while retaining all other options.

For example, a project should be optimized for size, but one module should instead be optimized for highest speed. All options are set on project level. Only the optimization level of the module is changed.

Private and Public Configurations also apply on all levels. This also makes it possible to change the option of any level depending on the selected Build Configuration.

Project Options

To open the Project Options Dialog, select the item to change the options for in Project Explorer and go to Project -> Options... (Alt+Return), or right-click on the Item -> Options...

In the upper left of the Options Dialog the Public or Private Configuration to change the options in can be selected. By default the active Build Configuration is selected.

The "Search Options" text input enables easy filter for the option to be modified.

When "Show Modified Options Only" is checked, only options which do not have default values are shown. Options which are modified on the selected item and configuration are marked with "modified". "inherited" indicates that the option has been modified in another configuration or on a higher level. Which value is inherited from which level and configuration is shown in the Description when the item is selected.

Code Options

Main Article: Embedded Studio Code Options

The Code Options configure the build system, the toolchain (compiler, assembler, linker), the preprocessor, library configuration, and user build steps.

Debug Options

Main Article: Embedded Studio Debug Options

The Debug Options configure how the project should be debugged, which debug interface (J-Link, GDB Server, Simulator) should be used, and how the target should be configured on certain operations.

ES PRO Options

Main Article: Embedded Studio PRO Options

The ES PRO Options are available when the Embedded Studio PRO Package is installed. They configure which components of ES PRO to use in the project and how the libraries should be configured.

Debugging

Configure Instruction Trace in Embedded Studio

Configure SWO in Embedded Studio

Enable RTOS Awareness in Embedded Studio

Connect to remote J-Link via J-Link Tunnel Server

Debug with Embedded Studio and GDB Server such as OpenOCD

Set User-dependent J-Link connection in Embedded Studio

SEGGER Linker

How to enable SEGGER Linker in your Embedded Studio project

Placing external library symbols at specific address

Correct typing of Thumb functions

Place Functions in RAM with SEGGER Linker

Integrity checks with Embedded Studio and SEGGER Linker

Version Control

VCS Configuration