HOWTO: Migrate project created in S32DS Power v1.x into v1.2+

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HOWTO: Migrate project created in S32DS Power v1.x into v1.2+

HOWTO: Migrate project created in S32DS Power v1.x into v1.2+

Bare-metal project migration from an older version of S32DS into a newer one is typically pretty straightforward.

Despite of that the migration into S32DS Power v1.2+ requires more attention due the fact it includes a new version of GCC compiler + GCC binutils (see the GCC release notes - here). This version of GCC is now fully EABI VLE compliant  (in contrast to previous versions of S32DS Power  v1.0 and v1.1) and it has several consequences for the project migration

  • object code/libraries are not backward compatible - if you have an object code/library built by a previous version of S32DS Power v1.x you have to rebuild it in new S32DS v1.2+ compiler.
  • default compiler setup has changed - bitfield access is not volatile anymore. This may have a impact on a peripheral registers access via standard header file bitfield structures. Such access may require a specific load/store instruction e.g. "stw" but if compiler is allowed to optimize the access (e.g. use "stb" instead of "stw") an exception may occur. Therefore it is recommended to add  -fstrict-volatile-bitfields  flag into your project GCC compiler settings:

pastedImage_2.png

  • linker script file (*.ld) requires some additional linker sections - Linker script file in S32DS Power v1.2+ must contain the sections below:

•  KEEP for .init and .fini sections

.ctors and .dtors sections

.preinit array .init array and .fini array sections

If the linker script file is not updated and the linker warnings are ignored you may experience an exception at the runtime - typically when __init routine is executed. Missing .init section causes that an invalid instructions is fetched and causes the core IVOR exception.

pastedImage_2.png

There is an easy way how to automatically fix the linker script file issue directly in IDE.

If you import and build an older project in S32DS Power v1.2 the linker issues these linker script related warnings:

pastedImage_9.png

Right click on the warning and select Quick Fix:

pastedImage_10.png

Select "Add missed section in linker script"  + "Select All" and press "Finish".

pastedImage_11.png

Repeat these steps until all the linker script warnings disappears.

If you don't use IDE project you have to add the sections below into your linker script manually:

.text_vle : 
 { INPUT_SECTION_FLAGS (SHF_PPC_VLE) 
 *(.text.startup)
 *(.text) 
 *(.text.*)
 KEEP (*(.init))
 KEEP (*(.fini)) 
 . = ALIGN(16); 
 } > m_text /* that will force pick VLE .text sections */ 
 
 .ctors :
 {
 __CTOR_LIST__ = .;
 /* gcc uses crtbegin.o to find the start of
 the constructors, so we make sure it is
 first. Because this is a wildcard, it
 doesn't matter if the user does not
 actually link against crtbegin.o; the
 linker won't look for a file to match a
 wildcard. The wildcard also means that it
 doesn't matter which directory crtbegin.o
 is in. */
 KEEP (*crtbegin.o(.ctors))
 KEEP (*crtbegin?.o(.ctors))
 /* We don't want to include the .ctor section from
 from the crtend.o file until after the sorted ctors.
 The .ctor section from the crtend file contains the
 end of ctors marker and it must be last */
 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
 KEEP (*(SORT(.ctors.*)))
 KEEP (*(.ctors))
 __CTOR_END__ = .;
 } > m_text

.dtors :
 {
 __DTOR_LIST__ = .;
 KEEP (*crtbegin.o(.dtors))
 KEEP (*crtbegin?.o(.dtors))
 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
 KEEP (*(SORT(.dtors.*)))
 KEEP (*(.dtors))
 __DTOR_END__ = .;
 } > m_text
 
.preinit_array :
 {
 PROVIDE_HIDDEN (__preinit_array_start = .);
 KEEP (*(.preinit_array*))
 PROVIDE_HIDDEN (__preinit_array_end = .);
 } > m_text

.init_array :
 {
 PROVIDE_HIDDEN (__init_array_start = .);
 KEEP (*(SORT(.init_array.*)))
 KEEP (*(.init_array*))
 PROVIDE_HIDDEN (__init_array_end = .);
 } > m_text

.fini_array :
 {
 PROVIDE_HIDDEN (__fini_array_start = .);
 KEEP (*(SORT(.fini_array.*)))
 KEEP (*(.fini_array*))
 PROVIDE_HIDDEN (__fini_array_end = .);
 } > m_text‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This may help you to avoid time consuming debugging to figure out the root cause of the core exception. 

コメント

This resolved my issue.

The example code (bare metal) package downloaded from official site (https://www.nxp.com/downloads/en/board-support-packages/DEVKIT-MPC5748G-QSP.zip) should be updated according to the instructions. The code in the package can't be run in S32DS 2017 if failed to notice this. 

Xuewei,

Thank you for your report!

I've contacted responsible team to fix this issue.

Regards,

Stan

評価なし
バージョン履歴
最終更新日:
‎09-10-2020 02:34 AM
更新者: