Migrating projects from Embedded Studio V4 to V5

From SEGGER Wiki
Jump to: navigation, search

With the update of Embedded Studio to version 5 you get access to the new SEGGER Compiler, SEGGER Run Time Library for even smaller and faster code and a updated SEGGER Linker. So if you have an old project that was created with Embedded Studio V4 or older the following must be considered when migrating from V4 to V5. Make sure all points are considered. All referenced files can be found in the Embedded Studio installation folder.

New Startup File

Due to improvements on how the SEGGER toolchain handles the target startup code the Cortex_M_Startup.s and SEGGER_THUMB_Startup.s must be updated. You can find the latest version of this file in your Embedded Studio installation folder under /samples/Cortex_M_Startup.s and /samples/SEGGER_THUMB_Startup.s

Note: When setting up a RAM debug config with the sources provided via CPU support packages please note that the preprocessor define for the VTOR config has changed to __VTOR_CONFIG.

Note: The preprocessor define MEMORY_INIT has changed to __MEMORY_INIT.

New Run Time Lib

To use the new SEGGER run time library the following project option must be set: Code->Library->Run Time Library->SEGGER

If you are using RTT sources in your application, make sure the SEGGER_RTT_Syscalls_<ToolChain>.c file is removed.

Also make sure to set the correct I/O type for your project in project setting Library I/O.

New Linker File

The new linker script can be found under /samples/SEGGER_Flash.icf if you are using a Flash based project or /samples/SEGGER_RAM.icf if RAM based.

The most important change is that the following two lines need to be added to the initialization block:

initialize by symbol __SEGGER_init_heap     { block heap  };                                        // Init the heap if there is one
initialize by symbol __SEGGER_init_ctors    { block ctors };                                        // Call constructors for global objects which need to be constructed before reaching main (if any). Make sure this is done after setting up heap.

Assembler Projects

When using an assembler project with the new linker script file make sure the following file is also included in your project /samples/SEGGER_crtinit.s