Library heap not functional when migrating from SES 5.70a to SES 7.32

My project works fine in SES 5.70a, but I want to migrate to SES 7.32

When first opening the project and attempting to build, I got this error

7> SEGGER_RTT_Syscalls_SES.c:73:22: error: unknown type name ‘__printf_tag_ptr’
7> 73 | int __putchar(int x, __printf_tag_ptr ctx) {
7> | ^~~~~~~~~~~~~~~~
7> Build failed

To resolve it I did this:

Removes these file from the project

SEGGER_RTT.c
SEGGER_RTT.h
SEGGER_RTT_Conf.h
SEGGER_RTT_Syscalls_SES.c

Then:

  1. Under 'Solution->Options->Common->Private Configurations->Library' changed 'Library I/O' to 'RTT'
  2. Make sure the 'Debug' and 'Release' configurations inherits the same value
  3. 'Preprocessor'->'Preprocessor Definitions'
  4. Changed 'RETARGET_ENABLED=1' to 'RETARGET_ENABLED=0'
  5. Clicked OK and rebuilt the project.

I came to this solution after reading this:

devzone.nordicsemi.com/.../unknown-type-name-__printf_tag_ptr-retarget-c, devzone.nordicsemi.com/.../nrf5-sdk-17-1-0-examples-is-not-compiling-in-latest-ses-6-20a and wiki.segger.com/Embedded_Studio_Library_IO

Now the project builds and we come the the actual problem: the library heap is not functioning:

Added the following

int main() {
  void * test = malloc(1);
  printf("%p\n", test);
  //.. rest of main()

Run the code on a nRF52840 target (like a devkit)

Observed how the printf prints `00000000` indicating the malloc() failed. The same code works with Segger 5.70a

Checked the heap size in project options. It is set to 1024. Confirmed in the map file that the `.heap` symbol is size 0x400

We are using nRF SDK version 15.2.0 with S140 SoftDevice v6.1.0

  • Hello,

    Unfortunately, my recommendation is to stay on version 5.70a unless there is a strong need to upgrade. Segger removed the Embedded Studio v4 runtime library from SES in the v6.20 release, which is the library our SDK has been developed and verified with. From v6.20 and later, you are forced to use their emRun l library instead. This is the main reason most of the SDK examples will fail to build out of the box with the new versions (v6.20 and above). If I recall correctly, there have also been instances where the newer GCC versions have led to runtime errors.

    Let me know if you still want to migrate to SES 7.32. In that case, I can try to investigate why you can't allocate memory from heap.

    Best regards,

    Vidar

  • Hi Vidar

    Our only concern with 5.70a is the license. We've found that the Nordic SES licence doesn't activate it anymore. We have workaround it by installing 7.32 and activating it. Then 5.70a is also activated

    I actually thought I was missing something trivial when migrating to 7.32, but your comment makes me think that it is not the case. And I also think this is only the first runtime issue, and there are many more hiding behind it. For now we can close this case

  • Hello,

    This is the first time I'm hearing of issues with license activation on older SES versions, but it's good to hear that you have a way to get around this issue. Yes, there can be other potential unreported issues with using version 7.32

    Best regards,

    Vidar 

Related