2484 views|2 replies

227

Posts

0

Resources
The OP
 

What should I pay attention to when migrating a project from Embedded Studio V4 to V5? [Copy link]

background

With the update of Embedded Studio to version 5, you can use the new SEGGER compiler, SEGGER runtime library and the new SEGGER linker to get smaller and faster code. Therefore, if you have an old project created in Embedded Studio V4 or earlier that needs to be migrated to Embedded Studio V5, you must consider the following and make sure that nothing is missed during the migration. The files needed in this article can be found in the Embedded Studio installation directory.

  1. New startup file

Due to changes in the way the SEGGER toolchain handles target startup code, Cortex_M_Startup.s and SEGGER_THUMB_Startup.s must be updated. You can find the latest versions of this file in the Embedded Studio installation directory /samples/Cortex_M_Startup.s and /samples/SEGGER_THUMB_Startup.s.

NOTE : When setting up a RAM debug configuration using the source code provided by the CPU support package, note that the preprocessor define for the VTOR configuration has changed to __VTOR_CONFIG.

Note : The preprocessor define MEMORY_INIT has been changed to __MEMORY_INIT.

Note : Normally the initial stack pointer is not set, as this is usually done by hardware. But if you want to set up a RAM debug project, you can set it manually. To do this, just edit the Startup.s file as described in the source comments. Also set the project option "Starting Stack Pointer Value" to __stack_end__.

  1. New runtime library

To use the new SEGGER runtime library, you must set the following project options: Code->Library->Run Time Library->SEGGER

If you use the RTT source code in your application, make sure to delete the SEGGER_RTT_Syscalls_<ToolChain>.c file.

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

  1. New linker file

If you use Flash or RAM based projects, you can find new linker scripts in the directory /samples/SEGGER_Flash.icf or /samples/SEGGER_RAM.icf.

The most important changes are to add the following two lines 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.

  1. Compile Project

When using the assembler project with the new linker script, be sure to include the following file /samples/SEGGER_crtinit.s in your project.

  1. troubleshooting

Error: unsupported relocation on symbol

The original error message might be similar to:

-------------------------------------------------- ------------------------------------------

<inline asm>:1:2: error: unsupported relocation on symbol

movs r1, $1

^

SEGGER_RTT.c:730:3: error: unsupported relocation on symbol

SEGGER_RTT_Conf.h:158:73: note: expanded from macro 'SEGGER_RTT_LOCK'

<inline asm>:2:2: note: instantiated into assembly here

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.

Stack dump:

0. Program arguments: segger-cc -cc1 [...]

1. <eof> parser at end of file

2. Code generation

-------------------------------------------------- ------------------------------------------

This error message is cryptic, but its cause and solution are as follows:

Some legacy code uses '$' instead of '#' to represent immediate values in inline assembly. Although '$' is used in i386 asm, arm assembly syntax only defines the use of '#'. Old versions of GCC and clang support this. clang-11 and segger-cc 11 (included in Embedded Studio V5.20) no longer support the use of '$'.

Source code that uses it must be changed to compile with Embedded Studio V5.

This post is from Embedded System

Latest reply

Is it also based on llvm?   Details Published on 2021-11-26 17:10
Personal signature

欢迎关注“麦克泰技术”


7462

Posts

2

Resources
2
 

Is it also based on llvm?

This post is from Embedded System
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 

227

Posts

0

Resources
3
 
freebsder posted on 2021-11-26 17:10 Is it also based on llvm

Segger's own C compiler is similar to the GNU organization's GCC compiler

This post is from Embedded System
 
Personal signature

欢迎关注“麦克泰技术”

 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list