Re-entrant library for RX needed for running FreeRTOS?

Our software, running on the RX72N and compiled with e2studio 2021-04 with RX CCRX Compiler v3.03 is migrating to FreeRTOS. Previous software wasn't running on an OS. It was a 'simple' while (1) without tasks. There were some interrupts, but nothing else.

While checking all the project settings I saw the flag 'Generate re-entrant library (-reent)' in the Library Generator -> Object settings.

I was wondering, is it necessary to turn on this flag because several tasks are running now that can all call, for example, sprintf()?

In the CC-RX compiler user manual v3.03.00, chapter 7.3 a list is given which library functions are reentrant and which not:

[Reentrant column O: Reentrant X: Non-reentrant D: Sets the errno variable]

We example use the sprintf() function in multiple tasks.

When turning on the flag the following linker errors were given:

<see first reply, somehow I couldn't post the linker errors included in this post>

So to summarize my question(s):

1. It is needed to turn on the flag 'Generate re-entrant library (-reent)' if we are using FreeRTOS?

2. If it is needed, how can I solve the linker errors?

Parents
  • I still don't have an answer from an expert, while it is a very important issue for us. Can someone help us directly or is there another way to contact Renesas about this question?

  • Hi,

    In the CC-RX user's manual there is the following table.

    So, if the re-entrant option is used then the specified low-level routines must be defined by the user.

    If you search the manual for wait_sem you will find some example code for these functions. The example code uses an array for the semaphores. As you are using FreeRTOS I would implement wait_sem and signal_sem using FreeRTOS semaphores. You will need 4 semaphores. One each for malloc, strtok, _Files and mbrlen. Depending on the success of the wait_sem and signal_sem operations the below errno values should be set.

    Ian.

  • Thank you for this answer. It's clear why the linker errors occur and we will read this part of the manual.

    However, it doesn't answer my first question. Should/must we generate a re-entrant library when using FreeRTOS with multiple tasks that use, for example, sprintf() functions?

    We don't use malloc, strtok, fopen, mbrlen, _Files directly, but I don't know what, for example, sprintf() uses.

    Thanks

Reply
  • Thank you for this answer. It's clear why the linker errors occur and we will read this part of the manual.

    However, it doesn't answer my first question. Should/must we generate a re-entrant library when using FreeRTOS with multiple tasks that use, for example, sprintf() functions?

    We don't use malloc, strtok, fopen, mbrlen, _Files directly, but I don't know what, for example, sprintf() uses.

    Thanks

Children