Difference between revisions of "Embedded Studio"

From SEGGER Wiki
Jump to: navigation, search
(ES PRO Options)
(83 intermediate revisions by 9 users not shown)
Line 1: Line 1:
Embedded Studio, SEGGER product, 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, 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.
 
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.
Line 9: Line 9:
 
</div>
 
</div>
   
  +
== Installation & Licensing ==
= Nordic Semiconductor license =
 
  +
[[How to get a free commercial license for Embedded Studio]]
We at SEGGER have partnered up with Nordic Semi to provide their customers with Embedded Studio licenses for free that can also be used for commercial products if a Nordic Semi target device is used.
 
You can acquire such license through Embedded Studio directly by simply building any project. This will prompt you with a "Non commercial-use license detected" text. There you will find an option "Activate Your free license". Alternatively you can also request the license via your web browser under: http://license.segger.com/Nordic.cgi
 
   
  +
[[Get a License for Nordic Semiconductor Devices]]
'''Note:''' The license is only valid for Nordic Semi target devices. If your project is not set up to use a Nordic Semi target device Embedded Studio will show that no valid license is available (for the currently open project). So simply switch the target device to a Nordic Semi one and you are good to go.
 
License installation instructions will come with the activation e-mail after registering.
 
Should you still be running into issues feel free to contact us at our forum at https://forum.segger.com
 
   
  +
[[Get a Embedded Studio license for Serious Integrated development kits]]
== License renewal ==
 
Once a license is requested it is valid for 1 year. It stays valid for all Embedded Studio release versions that are released in that time period. If you install a newer Embedded Studio version that is outside this time period you will be prompted with the message that you need a new license. To get a new once simply request a new license as you did the first time. It will also work for the same MAC address.
 
   
  +
[[Installation on newer Linux Versions]]
== Install renewed license ==
 
To install your renewed license you first need to remove the old license. For this go to Tools->License Manager->Manage Activations.
 
   
  +
[[Installation issues on macOS Catalina]]
Now select the license and press "Remove License". Now the new license can be installed like you did the first time in the license manager under "Activate Embedded Studio".
 
   
  +
[[Start multiple Embedded Studio instances on macOS]]
= ETB trace on NXP TWR-K65F =
 
ETB trace with the OpenSDA on-board which is on the NXP TWR-K65F board and for which SEGGER also provide a firmware. Further information regarding the J-Link OpenSDA firmware can be found on the SEGGER webpage: [https://www.segger.com/opensda.html https://www.segger.com/opensda.html]. In general, to get ETB up and running, just make sure to configure ETB as ''Trace Interface Type'' in the Embedded Studio project settings:
 
''Debugger'' --> ''Target Trace Options'' --> ''Trace Interface Type'' --> ''ETB''
 
[[File:ES_ProjectConfiguration_ETB.png]]
 
   
  +
[[License installation on a headless system]]
Once the debug session has been started, the most recent executed instructions will be shown in the instruction backtrace window. The window can be opened at:
 
''Debug'' --> ''Other windows'' --> ''Execution Trace''
 
[[File:ES_ExecutionTrace_ETB.png]]
 
   
  +
[[Embedded Studio evaluation period error]]
Below a sample project that is already prepared for ETB trace on the K65 is available for download.
 
* [[File:Freescale_MK65FN2M0xxx18_ETBTrace_SES.zip]]
 
   
  +
[[Linux Studio build failed]]
=How to port projects from IAR EWARM to SEGGER Embedded Studio=
 
==Introduction==
 
This wiki article describes how to import IAR EWARM projects into SEGGER Embedded Studio using the build in project importer. With the project importer you can either keep using the IAR compiler inside Embedded Studio or <br />
 
use the GCC/Clang compiler that is used inside Embedded Studio. By switching your project to Embedded Studio you can directly benefit from features like multi-threaded compiling, fast and simple project search, indexing and more. <br />
 
Many features are even available should you still decide to be using the IAR compiler inside Embedded Studio.
 
A full feature list can be found [https://www.segger.com/ses-introduction.html here].
 
   
  +
[[Using Embedded Studio remotely via X11 on a docker image not working]]
==Setup==
 
The following import tutorial will be based on the following Hardware and Software combinations:
 
   
  +
[[Update the J-Link DLL]]
* SEGGER Embedded Studio 3.12 64-bit (Project importer works on 3.10 or later)
 
* IAR EWARM 7.80
 
* Target Evalboard: SEGGER emPower
 
   
  +
[[Embedded Studio Package Manager]]
The following file contains the example project for you to try out:
 
   
  +
== Performance ==
[[Media:IAR_to_ES_Tutorial.zip|IAR_to_ES_Tutorial.zip]]
 
  +
[[Resolving slow build / high CPU usage issues]]
   
  +
== Project Setup and Build ==
==Import tutorial==
 
  +
[[Port Projects from IAR Embedded Workbench to Embedded Studio]]
   
  +
[[Port Projects from Keil uVision to Embedded Studio]]
* Open your copy of Embedded Studio and go to File -> Import IAR EWARM / Keil MDK Project... then navigate to the project file you want to import and select it.
 
[[File:1_Navigate_to_IAR_projectfolder.PNG|thumb|IAR Example Project Folder|none]]
 
   
  +
[[Import projects from STM32CubeMX to Embedded Studio]]
* Now you will have the opportunity to choose between:
 
** External Toolchain: imports the project and configures it to be built with the original toolchain.
 
** Internal Toolchain: imports the project and sets the configuration for the Embedded Studio tool chain.
 
** Internal and External Toolchains: creates a set of build configurations to build with the original tool chain and one set to build with the Embedded Studio tool chain.
 
** "IAR Installation Directory" where you get the option to use a different external IAR compiler if you have multiple IAR EWARM versions installed.
 
* To migrate to Embedded Studio it is recommended to create build configurations for internal and external tool chains so you can easily switch between the tool chains later on.
 
[[File:2_Start_Project_Importer.PNG|thumb|Project importer options|none]]
 
   
  +
[[Use an external Toolchain with Embedded Studio]]
* If everything worked out well the following status window should pop up:
 
[[File:3_Successful_Import.PNG|thumb|Successful import|none]]
 
   
  +
[[Porting from GCC to SEGGER Linker]]
* Embedded Studio will automatically create build configurations for debug and release versions with the internal and external compiler that have been present in the existing IAR project.
 
* To switch between them the drop down menu in the "Project Explorer" can be used.
 
[[File:4_Configurations_Internal_and_External.PNG|thumb|Build configurations window|none]]
 
   
  +
[[Add new Memory Sections and Segments]]
* To debug the example project with the IAR compiler choose "Debug_External" in the drop down menu and build the project by pressing F7.
 
* For most projects this will work out of the box, if it does not build out of the box please refer to section "Troubleshooting".
 
   
  +
[[Create a RAM Function]]
==How to switch to internal Embedded Studio compiler==
 
   
  +
[[Multiple projects in one solution in Embedded Studio]]
* To use the full potential of Embedded Studio it is required to use the internal compiler which is based on GCC/Clang.
 
* This can be done in the provided example project by simply going to the drop down menu and select "Debug_Internal".
 
* The project will now be built when pressing F7 with the internal GCC compiler by default. Clang can be enabled in the project options instead.
 
* After a successful build with the internal compiler Embedded Studio will automatically calculate how much flash and RAM will be occupied on your target device and represent it visually in the output window.
 
[[File:Flash_Usage.PNG|thumb|Code flash and RAM usage|none]]
 
   
  +
[[How to create a library project and use it in executable project]]
* Note: this feature is only available when using the internal compilers.
 
* For most projects switching to the internal compiler work out of the box, if it does not build out of the box please refer to section "Troubleshooting".
 
   
  +
[[Using User Build Steps in Embedded Studio]]
==Troubleshooting==
 
   
  +
[[Embedded Studio project file format]]
While imported projects will usually re-build with the external tool chain out-of-the-box, for GCC/Clang based project build configurations, some manual changes may be required.
 
   
  +
[[Migrating projects from Embedded Studio V4 to V5]]
In some cases the sources are created to be GCC compatible, then you can seamlessly switch between original tool chain and GCC. When the original project is created from a software pack or SDK, it might already come with GCC compatible source files which can replace the former tool chain compatible files.
 
   
  +
[[Migrating from Embedded Studio V7 to V8]]
The following points list the most common changes which are required to migrate a project to Embedded Studio.
 
   
  +
[[Static code analysis in Embedded Studio]]
===Memory Linker Script===
 
The Embedded Studio project importer does not import linker scripts (e.g. IAR icf files). It sets up the basic memory map for the selected target device, which will put code into the internal flash and data into the internal SRAM.
 
   
  +
[[Embedded Studio Library IO]]
For more advanced or different configurations, the memory map file and the section placement file have to be set up accordingly.
 
   
To place memory segments there are two options available in Embedded Studio:
+
[[How to create a simple FreeRTOS project with Embedded Studio]]
   
  +
[[C++ Support in Embedded Studio]]
# Place segments directly via project options under "Linker -> Section Placement Segments"
 
# Create a memory map .xml file or edit the default file provided by Embedded Studio and set it in project options under "Linker -> Use Manual Linker Script"
 
   
  +
[[Creating a solution with bootloader and application]]
For example, a memory-map file representing a device with two memory segments called FLASH and SRAM could look something like this in the memory-map editor.
 
   
  +
[[Bootloader Handling In Embedded Studio]]
<pre>
 
<Root name="Device1">
 
<MemorySegment name="FLASH" start="0x10000000" size="0x10000" />
 
<MemorySegment name="SRAM" start="0x20000000" size="0x1000" />
 
</Root>
 
</pre>
 
   
  +
[[Default file encoding in Embedded Studio]]
A corresponding section-placement file will refer to the memory segments of the memory-map file and will list the sections to be placed in those segments. This is done by using a memory-segment name in the section-placement file that matches the corresponding memory-segment name in the memory-map file.
 
   
  +
[[How to implement interrupt handlers for RISC-V]]
For example, a section-placement file that places a section called .stack in the SRAM segment and the .vectors and .text sections in the FLASH segment would look like this:
 
<pre>
 
<Root name="Flash Section Placement">
 
<MemorySegment name="FLASH" >
 
<ProgramSection name=".vectors" load="Yes" />
 
<ProgramSection name=".text" load="Yes" />
 
</MemorySegment>
 
<MemorySegment name="SRAM" >
 
<ProgramSection name=".stack" load="No" />
 
</MemorySegment>
 
</Root>
 
</pre>
 
   
  +
== Project Configuration ==
To add new segments or sections simply edit the default file linked by Embedded Studio. The linked file can be found in the project options under "Linker -> Section Placement File".
 
  +
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 ===
More information about how to setup such files can be found in the Embedded Studio Help window in chapter "Linking and section placement".
 
  +
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.
===Third Party Software and Libraries===
 
  +
This is what Private Configurations and Public Configurations are used for.
Third party software, especially libraries, might be configured for one tool chain and do not compile with other tool chains.
 
  +
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.
Check if there is a port of the software for Embedded Studio / GCC or configure and rebuild the software for Embedded Studio / GCC.
 
   
  +
Include Directories and Preprocessor Definitions are always extended.
Although libraries built for another tool chain may link with Embedded Studio, always take care and check that interfacing with the library works as expected.
 
  +
"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.
===Assembly Code===
 
  +
"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.
The syntax of assembler code and control commands in assembler files can be different across tool chains.
 
   
  +
=== Override Options ===
Although the resulting assembled instructions are identical, the assembler code to be written can be different across tool chains, for example numerical constants need to be declared differently for IAR and GCC/Clang.
 
  +
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.
Control commands which help writing assembler code is different, too. The syntax for symbols, labels, function definitions, and alike needs to be adjusted to work with the GNU assembler.
 
  +
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.
The following table shows some "popular" assembler directives that can be substituted by the corresponding conjugate:
 
  +
This also makes it possible to change the option of any level depending on the selected Build Configuration.
   
  +
=== Project Options ===
{| class="wikitable"
 
  +
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...
|-
 
! IAR assembler directive !! GCC/Clang assembler directive
 
|-
 
| PUBLIC || .global
 
|-
 
| SECTION || .section
 
|-
 
| MACRO || .macro
 
|-
 
| ENDM || .endm
 
|-
 
| THUMB || .thumb_func
 
|-
 
| END || .end
 
|-
 
| EXTERN || .extern
 
|-
 
| DC32 || .word
 
|}
 
   
  +
In the upper left of the Options Dialog the Public or Private Configuration to change the options in can be selected.
For a complete list please refer to the corresponding assembler reference manuals.
 
  +
By default the active Build Configuration is selected.
   
  +
The "Search Options" text input enables easy filter for the option to be modified.
===Preprocessor Defines===
 
Tool chains use different built-in definitions to identify the compiler which is used and to allow conditional compilation based on the configuration of core, device, endianess, and other settings.
 
   
  +
When "Show Modified Options Only" is checked, only options which do not have default values are shown.
It is mandatory to choose the correct definitions and recommended to make sure the code throws a warning or error when required definitions are not defined.
 
  +
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 ====
IAR defines __ICCARM__ and __IAR_SYSTEMS_ICC__ which can be used for identification, Embedded Studio defines __SES_ARM and __GNUC__.
 
  +
''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.
For the target device IAR defines __ARM7M__ and __CORE__=__ARM7M__ when compiling for Cortex-M4, Embedded Studio uses __ARM_ARCH_7M__ instead.
 
   
===Tool Chain Intrinsics===
+
==== Debug Options ====
  +
''Main Article:'' [[Embedded Studio Debug Options]]
Compiler-specific functions like __disable_interrupt() or __no_operation() might not be available in Embedded Studio. Write corresponding replacement functions or avoid using them at all.
 
   
  +
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.
A replacement function for __no_operation() could look like this for GCC/Clang:
 
   
  +
==== ES PRO Options ====
<pre>
 
  +
''Main Article:'' [[Embedded Studio PRO Options]]
#define NO_OPERATION() __asm volatile ("nop")
 
</pre>
 
   
  +
The ES PRO Options are available when the Embedded Studio PRO Package is installed.
To make it backwards compatible with IAR such a redefinition can be nested within preprocessor defines; __ICCARM__ for IAR EWARM and __SES_ARM for Embedded Studio.
 
  +
They configure which components of ES PRO to use in the project and how the libraries should be configured.
   
===Project Settings===
+
== Debugging ==
  +
[[Configure_instruction_trace_in_Embedded_Studio|Configure Instruction Trace in Embedded Studio]]
Most project settings are set automatically by the project importer for the external and internal build configuration. In some more complex projects certain project settings need to be added manually.
 
   
  +
[[Configure SWO in Embedded Studio]]
For example by default no files are excluded from the internal build configuration, so if there is a compiler incompatible file the compiler will try to compile it and show errors (e.g. GCC/Clang incompatible assembler files).
 
   
  +
[[Enable RTOS Awareness in Embedded Studio]]
To do this right click your project in the project explorer and select "Edit options". More information about the individual settings can be found in the Embedded Studio user manual.
 
   
  +
[[Connect to remote J-Link via J-Link Tunnel Server]]
===User Included Directories===
 
Many more complex projects link their sources from multiple folders in different paths. Make sure all needed folders are included in the build configuration under "Preprocessor -> User Include Directories".
 
   
  +
[[Embedded Studio with GDB Server|Debug with Embedded Studio and GDB Server such as OpenOCD]]
===Pre/Post Build Commands===
 
Embedded Studio offers the possibility to use pre/post build commands familiar to the ones in IAR EWARM. However the project importer does not import these as the syntax between IAR and Embedded studio differs.
 
   
  +
[[Set User-dependent J-Link connection in Embedded Studio]]
Should you be using such commands in IAR make sure you mimic them in Embedded Studio in the internal and external build configurations accordingly .
 
   
  +
[[RTT in Embedded Studio]]
To execute multiple commands at once the use of a batch script is possible.
 
   
  +
[[Use ST-Link in Embedded Studio]]
For example to enable a post link batch script go into the project options for the intended build config, go to "User Build Step" and edit the entry "Post-Link Command".
 
   
  +
== SEGGER Linker ==
Now enter the relative or absolute path of the bat file and the optional parameters: Path/Example.bat Param1 Param2 ...
 
  +
[[How to enable SEGGER Linker in your Embedded Studio project]]
   
  +
[[Placing external library symbols at specific address]]
=How to configure Embedded Studio to use SWO=
 
SEGGER Embedded Studio can use SWO for printf Output to the Debug Terminal and for code profiling and execution trace. This article describes the configuration of a project in Embedded Studio to enable SWO.
 
   
  +
[[Correct typing of Thumb functions]]
== Example Setup ==
 
The setup guide will be based on the following hardware and software components:
 
* J-Link Software Package V6.18c or later
 
* Embedded Studio V3.26a or later
 
* [https://www.segger.com/evaluate-our-software/segger/empower/ SEGGER emPower] evaluation board
 
* Any J-Link/J-Trace hardware
 
* Physically connected SWO pin to debug interface
 
   
  +
[[Place Functions in RAM with SEGGER Linker]]
== Setup Guide==
 
# Open your project in Embedded Studio
 
# In the Project Explorer select the project and go to Project-> Edit Options...
 
# Go to Debug -> Target Trace
 
# Select SWO as Trace Interface Type
 
# Enter the Trace Clock Speed: The trace clock speed is usually the target CPU speed while the application is running.
 
# Enter the SWO Baud Rate: The SWO baud rate (or SWO speed) needs to match the trace clock speed and the used J-Link.
 
# Click OK
 
# Start a debug session
 
# Open the Execution Profile Window (View -> More Debug Windows -> Execution Profile)
 
# Open the Execution Trace Window (View -> More Debug Windows -> Execution Trace)
 
[[File:1_Check_Target_Device.PNG|thumb|Check if correct device and debugger is selected|none]]
 
[[File:2_SWO_Settings.PNG|thumb|Set SWO speed and baud rate|none]]
 
[[File:3_Execution_Profile.PNG|thumb|Execution Profile|none]]
 
[[File:4_Execution_Trace.PNG|thumb|Execution Trace|none]]
 
   
  +
[[Integrity checks with Embedded Studio and SEGGER Linker]]
A basic ES project for the emPower board with all settings applied can be found here: [[Media: EmPower_ES_SWO.zip | emPower_ES_SWO.zip]]
 
   
  +
[[Thread-Local Storage]]
== Measuring CPU speed ==
 
If the target CPU speed is not known it can be measured with J-Link Commander or J-Link SWO Viewer.
 
   
  +
[[Place Functions in RAM before SystemInit with SEGGER Linker]]
=== Measuring with J-Link Commander ===
 
* Open J-Link Commander
 
* Connect to your device
 
* Execute "testcspeed <RamAddress>"
 
[[File:Test_CPU_Speed.PNG|thumb|Measure CPU clock in J-Link Commander|none]]
 
   
  +
[[How to use Linker-generated symbols]]
=== Measuring with J-Link SWO Viewer ===
 
* Open J-Link SWO Viewer
 
* Select target device
 
* Click measure
 
[[File:SWOViewer_GUI_Conf.png|thumb|Measure SWO clock|none]]
 
   
  +
[[How to place variables in Flash]]
== Calculating the SWO speed ==
 
The supported SWO speeds depend on the connected emulator. They can be retrieved from
 
the emulator. To get the supported SWO speeds for your emulator, use J-Link Commander, connect to your target and execute the command "SWOSpeed" without quotations marks.
 
The listed speeds can be set as SWO baud rate.
 
   
  +
[[How to call global constructors]]
== Troubleshooting ==
 
   
  +
== Version Control ==
* The Terminal I/O windows are still not showing any information even after following the setup guide step by step.
 
  +
[[VCS Configuration]]
** Make sure the SWO pin is actually connected to your J-Link debug hardware, many J-Link OBs for example do not have SWO routed to them.
 
** Check if the selected target device is correct.
 
   
  +
== Embedded Studio PRO (ESPRO) ==
* I want to use SWO and JTAG simultaniously, how can i do that?
 
  +
ESPRO is SEGGER's all in one solution for modern Embedded development. For more information see [https://www.segger.com/products/development-tools/embedded-studio/editions/pro-cortex-m/ here].
** This is not possible as the TDO (JTAG) signal is sharing the same pin as SWO. To be able to use SWO a SWD debug connection is required.
 
   
  +
[[ESPRO_Board_Support_Package|Overview of available ESPRO packages]]
* I can't start a debug session
 
** Is the target device powered properly? You can open the J-Link Commander to see what voltage is currently showing as VTREF in the console output. Is that value expected?
 
   
  +
[[Migrate projects to latest ESPRO versions]]
   
  +
[[How to create a custom ESPRO BSP]]
If there are still issues persisting feel free to contact our support: [mailto:support@segger.com support@segger.com]
 
 
=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.
 
 
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.
 
 
== 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.
 
 
Once you have installed the command line client, you must configure Embedded Studio to use it.
 
 
'''To configure Subversion:'''
 
# Choose Tools > Options.
 
# 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.
 
 
'''To configure Git:'''
 
# Choose Tools > Options.
 
# Select the Source Control category in the options dialog.
 
# 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.
 
 
'''To configure Mercurial:'''
 
# Choose Tools > Options.
 
# Select the Source Control category in the options dialog.
 
# 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.
 
[[File:SVN_Example.PNG|thumb|Example with SVN|none]]
 
 
== 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.
 
 
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.
 
 
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.
 
 
'''User credentials'''
 
 
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.
 
 
'''Note'''
 
 
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.
 
 
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.
 
 
'''Source-control operations'''
 
 
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.
 
 
More information can be found in the Embedded Studio user manual: ''SEGGER Embedded Studio > SEGGER Embedded Studio User guide > Using source control''
 
 
== Set up external diff tool ==
 
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:
 
 
# 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]]
 
 
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:
 
 
* $(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]]
 
 
=Installation on newer Linux versions=
 
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:
 
 
'''''xhost si:localuser:root'''''
 
 
This workaround has been confirmed to work for:
 
 
* Ubuntu 17.10
 
* Fedora 26
 
...
 
 
This list will be updated once other Linux versions have been confirmed to work with that workaround.
 
 
 
'''Note:''' We strongly suggest to revoke the root rights after a successfull installation.
 
To do that simply execute the following command in terminal:
 
 
'''''xhost -si:localuser:root'''''
 
 
=How to enable RTOS thread awareness=
 
== Enable thread awareness for embOS ==
 
 
* First download the latest thread awareness script from our website: https://www.segger.com/products/rtos/embos/tools/plug-ins/embedded-studio/
 
* Open your Embedded Studio project
 
* Go to: Project->Edit Options...->Debug->Debugger->Thread Script File
 
* Set path to your downloaded thread awareness script and press ok
 
 
== Thread awareness for other OSs ==
 
The following thread awareness scripts are provided as is without claim for support.
 
Setup steps are the same as with embOS.
 
 
[[Media:FreeRTOS_ThreadScripts_ES.zip | FreeRTOS thread awareness scripts]]
 
 
'''Note:''' When using FreeRTOS the scripts require FreeRTOS to be compiled such
 
that the referenced symbols do not have static qualifier (so the
 
debugger can access them).
 
 
=How to place a function in RAM=
 
 
For some situations it may be beneficial or even necessary to place a function in RAM instead of flash. This for example is needed in case a bootloader (that runs from flash) shall update a firmware (running from the same flash but different sectors). As the flash is not accessible for read accesses while it is programmed, the flash programming routines itself need to run from RAM.
 
 
In order to put a function into RAM, it needs to be placed into the '''.fast''' section. This is done as follows:
 
__attribute__ ((section(".fast"))) // Place the following function in RAM
 
void _Delay(void) {
 
[...]
 
}
 
 
=How to use an external toolchain with Embedded Studio=
 
Embedded Studio offers the option to build project with an external toolchain of your choice. The following guide will show an example implementation of such a setup with the ARM GCC toolchain.
 
 
== Example implementation with external GCC toolchain ==
 
 
* First install the external toolchain of your liking, in this example the currently latest ARM GCC 7-2017-q4-major will be used.
 
* Create a new externally build project using the Embedded Studio project wizard and selecting ''A C/C++ executable for ... processor(internal and external GNU tools)''.
 
[[File:New_Project.png|thumb|New external build project|none]]
 
* Select your target device, next set the toolchain path and finish the project setup by letting all settings on default.
 
* Make sure the memory section placement segments are located in the correct memory areas. This can be found int he Common project settings under Linker-> Section Placement Segments
 
* Now select build configuration "Debug External" and build the project to build with the external toolchain.
 
* If the build succeeds you can download it into your target application and debug it.
 
 
== Optional steps for more complex builds ==
 
 
When adding more complex projects to Embedded Studio as an external build usually additional steps are required to make full use of the external compiler. The following are the most common:
 
 
* Preprocessor definitions: Under ''Preprocessor->Preprocessor Definitions'' in the external build configs missing preprocessor definitions can be set.
 
* User include directories: Under ''Preprocessor->User Include Directories'' in the external build configs missing include directories can be added.
 
* All other commands that can't be set directly through the Embedded Studio GUI need to be set manually to the external build command line which can be found under ''External Build'' in one of the external build project configurations.
 
 
=Connecting to J-Link via J-Link Remote Server=
 
 
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.
 
 
In order to connect to a J-Link Remote Server using Embedded Studio, follow these instructions:
 
 
* 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'''
 
 
From then on, the J-Link is handled the same as if it was connected directly via USB.
 
   
 
[[Category:Software Tools]]
 
[[Category:Software Tools]]
  +
[[Category:Embedded Studio]]

Revision as of 15:19, 19 February 2024

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

How to get a free commercial license for Embedded Studio

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

Linux Studio build failed

Using Embedded Studio remotely via X11 on a docker image not working

Update the J-Link DLL

Embedded Studio Package Manager

Performance

Resolving slow build / high CPU usage issues

Project Setup and Build

Port Projects from IAR Embedded Workbench to Embedded Studio

Port Projects from Keil uVision to Embedded Studio

Import projects from STM32CubeMX 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 projects 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

Migrating from Embedded Studio V7 to V8

Static code analysis in Embedded Studio

Embedded Studio Library IO

How to create a simple FreeRTOS project with Embedded Studio

C++ Support in Embedded Studio

Creating a solution with bootloader and application

Bootloader Handling In Embedded Studio

Default file encoding in Embedded Studio

How to implement interrupt handlers for RISC-V

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

RTT in Embedded Studio

Use ST-Link 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

Thread-Local Storage

Place Functions in RAM before SystemInit with SEGGER Linker

How to use Linker-generated symbols

How to place variables in Flash

How to call global constructors

Version Control

VCS Configuration

Embedded Studio PRO (ESPRO)

ESPRO is SEGGER's all in one solution for modern Embedded development. For more information see here.

Overview of available ESPRO packages

Migrate projects to latest ESPRO versions

How to create a custom ESPRO BSP