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

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 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

      Source Code

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



      To resolve it I did this:
      Removes these file from the project

      Source Code

      1. SEGGER_RTT.c
      2. SEGGER_RTT.h
      3. SEGGER_RTT_Conf.h
      4. SEGGER_RTT_Syscalls_SES.c
      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 rebuild the project.


      I came to this solution after reading this:
      devzone.nordicsemi.com/f/nordi…printf_tag_ptr-retarget-c, devzone.nordicsemi.com/f/nordi…iling-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

      Source Code

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

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

      Observed how the `printf` prints `00000000` indicating the `malloc()` failed.

      Things already tried
      Checking the heap size in project options. It is set to 1024. Confirmed in the map file that the `.heap` symbol is size 0x400
    • Is the Code > Library > Library Heap option (in Project or Solution options) set to something other than None? The heap works for me -- my placement file includes these placements for the heap and stack:

      Source Code

      1. <MemorySegment>
      2. <!-- other sections in RAM deleted -->
      3. <ProgramSection alignment="8" size="__HEAPSIZE__" load="No" name=".heap" />
      4. <ProgramSection alignment="8" size="__STACKSIZE__" load="No" name=".stack" place_from_segment_end="yes" address_symbol="__StackLimit" end_symbol="__stack_end__" end_symbol="__StackTop"/>
      5. <ProgramSection alignment="8" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
      6. </MemorySegment>