This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Compiler error when migrating to SES 3 and SDK14

Hello, I'm practicing this blog; Segger Embedded Studio - A Cross Platform IDE

on the following environment.

  • 64-bit Windows 10 desktop

  • SEGGER J-Link 6.16h

  • 64-bit SEGGER Embedded Studio (SES) 3.26

  • PCA10040 v1.1.1

  • nRF5_SDK_14.0.0_3bcc1f7

  • imported Keil MDK 5 project using ble_app_cts_c example

The blog showed several steps.

  • Importing a Keil uVision project

  • Nuances

  • Adding nRF5 MDK Files

  • Peer Manager/Flash Data Storage

  • Building

and more. I have used ble_app_cts_c example instead of the beacon example.

SESOpt

I have tried until Peer Manager/Flash Data Storage.

Also, I have configured the compiler further like this.

Option0

I chose GNU11.

However, compared to Keil MDK 5 that it was compiled and build successfully, I observed two compiler errors.

- When configured to GCC; variably modified '_do_assert' at file scope

Compile Error 0

// In app_util.h
/**@brief Macro for doing static (i.e. compile time) assertion.
*
* @note If the EXPR isn't resolvable, then the error message won't be shown.
* @note The output of STATIC_ASSERT will be different across different compilers.
*
* @param[in] EXPR Constant expression to be verified.
* @hideinitializer
*/
#define STATIC_ASSERT(EXPR) \
    extern char (*_do_assert(void)) [sizeof(char[1 - 2*!(EXPR)])]

- When configured to Clang; unknown register name 'vfpcc' in asm

Clang Config

Compile Error 1

#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) /* in cmsis_gcc.h*/
  /* Empty asm statement works as a scheduling barrier */
  __ASM volatile ("");
  __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
  __ASM volatile ("");
#endif

Surprisingly, looks like I'm the only person who had this type of trouble while migrating to SES. :(

  • Are there extra configurations needed to solve these compile errors?

  • Additionally, is it impossible to use Clang?

  • Lastly, I use STM32 boards with SES. The blog tells me to modify the thumb_crt0.s file.

I haven't used that file when I was working with STM32 boards.

Then this modification won't affect other projects, right?

/*************************************************************************************/

Edited: 7, Sept. 2017

<!DOCTYPE Linker_Placement_File>
<Root name="Flash Section Placement">
  <MemorySegment name="$(FLASH_NAME:FLASH)">
    <ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START:)" />
    <ProgramSection alignment="4" load="Yes" name=".init" />
    <ProgramSection alignment="4" load="Yes" name=".init_rodata" />
    <ProgramSection alignment="4" load="Yes" name=".text" />
    <ProgramSection alignment="4" load="Yes" name=".dtors" />
    <ProgramSection alignment="4" load="Yes" name=".ctors" />
    <ProgramSection alignment="4" load="Yes" name=".rodata" />
    <ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end" />
    <ProgramSection alignment="4" load="Yes" runin=".fast_run" name=".fast" />
    <ProgramSection alignment="4" load="Yes" runin=".data_run" name=".data" />
    <ProgramSection alignment="4" load="Yes" runin=".tdata_run" name=".tdata" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" runin=".fs_data_run" name=".fs_data" />
  </MemorySegment>
  <MemorySegment name="$(RAM_NAME:RAM);SRAM">
    <ProgramSection alignment="0x100" load="No" name=".vectors_ram" start="$(RAM_START:$(SRAM_START:))" />
    <ProgramSection alignment="4" load="No" name=".fast_run" />
    <ProgramSection alignment="4" load="No" name=".data_run" />
    <ProgramSection alignment="4" load="No" name=".tdata_run" />
    <ProgramSection alignment="4" load="No" keep="Yes" name=".fs_data_run" address_symbol="__start_fs_data" end_symbol="__stop_fs_data" />
    <ProgramSection alignment="4" load="No" name=".bss" />
    <ProgramSection alignment="4" load="No" name=".tbss" />
    <ProgramSection alignment="4" load="No" name=".non_init" />
    <ProgramSection alignment="4" size="__HEAPSIZE__" load="No" name=".heap" />
    <ProgramSection alignment="8" size="__STACKSIZE__" load="No" place_from_segment_end="Yes" name=".stack" />
    <ProgramSection alignment="8" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
  </MemorySegment>
  <MemorySegment name="$(FLASH2_NAME:FLASH2)">
    <ProgramSection alignment="4" load="Yes" name=".text2" />
    <ProgramSection alignment="4" load="Yes" name=".rodata2" />
    <ProgramSection alignment="4" load="Yes" runin=".data2_run" name=".data2" />
  </MemorySegment>
  <MemorySegment name="$(RAM2_NAME:RAM2)">
    <ProgramSection alignment="4" load="No" name=".data2_run" />
    <ProgramSection alignment="4" load="No" name=".bss2" />
  </MemorySegment>
</Root>

This is the content of the flash_placement.xml file.

I think I have to edit the flash_placement.xml due to the following error message;

ERR

elf section `.log_dynamic_data' will not fit in region `UNPLACED_SECTIONS'
undefined reference to __stop_log_const_data
undefined reference to __start_log_const_data
undefined reference to __start_log_dynamic_data

I think these fields should be written in the XML file. However, I don't know how and what specifications are needed.

Did you add something in the XML file, @Joakim?

Or do I need to remove a preprocessor?

-Best Regards

Related