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

Problems Instrumenting Code

Hello All,

 

We are attempting to instrument our software and yours. The desired output is data for a call-graph list and time stamps for each entry and exit into a function. We are currently starting by attempting to instrument one source file – main.c.

 

We are using:

  • Nordic nRF5 SDK v15.2.0
  • SoftDevices S140 v6.1.0
  • SEGGER Embedded Studio for ARM 4.12.

 

The following was added to ‘common’ compiler options for main.c:

 

-finstrument-functions

-fprofile-arcs

-ftest-coverage

 

The following was added to our main.c

 

/* Function prototypes with attributes */

void main_constructor(void)

    __attribute__ ((no_instrument_function, constructor));

 

void main_destructor(void)

    __attribute__ ((no_instrument_function, destructor));

 

void __cyg_profile_func_enter(void *, void *)

    __attribute__ ((no_instrument_function));

 

void __cyg_profile_func_exit(void *, void *)

    __attribute__ ((no_instrument_function));

 

The following was added to the project’s linker options:

 

-shared

-fprofile-arcs

 

The program compiles successfully. There are linker errors:

 

C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 4.12/lib/libc_v7em_fpv4_sp_d16_hard_t_le_eabi.a(libc_asm.o): relocation R_ARM_THM_MOVW_ABS_NC against `__RAL_uidiv_inverse_lut' can not be used when making a shared object; recompile with -fPIC

 

Questions:

  • Can you provide us with the source code for the above referenced program?
  • Or do we have to contact Segger regarding this?
  • Do you have an alternative strategy for obtaining the coverage data?
  • Is the source for the Nordic libraries available? (we are under NDA).

 

Thanks in advance.

Parents
  • The above referenced program is libc, it's part of the arm gcc toolchain which you can, with enormous amounts of pain, download and build yourself. 

    You can contact Segger but they'll tell you it's a standard C library

    This isn't a Nordic library so there's no source to be had. 

    -shared means absolutely nothing on a platform with no OS or dynamic linking and loading. If you need -shared, it's not going to work, which means, it's not going to work. You might just get somewhere with instrument-functions as I've seen code which outputs trace data via the ARM trace macrocell and even may have seen Segger/Crossworks attempt to consume this data, but that's about the best you're going to do. 

Reply
  • The above referenced program is libc, it's part of the arm gcc toolchain which you can, with enormous amounts of pain, download and build yourself. 

    You can contact Segger but they'll tell you it's a standard C library

    This isn't a Nordic library so there's no source to be had. 

    -shared means absolutely nothing on a platform with no OS or dynamic linking and loading. If you need -shared, it's not going to work, which means, it's not going to work. You might just get somewhere with instrument-functions as I've seen code which outputs trace data via the ARM trace macrocell and even may have seen Segger/Crossworks attempt to consume this data, but that's about the best you're going to do. 

Children
No Data
Related