Post Go back to editing

[ARM] Enabling newlib on FREERTOS

Category: Software
Software Version: FreeRTOS 10.4.6

Hi Team,


Context:

  • Using SC573 ezkit
  • Using FreeRTOS10.4.6 with CCES 2.10.1 ARM toolchain running on SC573 ARM core.
  • Using Clion rather than CCES IDE (pre-defined requirement)
  • Have migrated the FreeRTOS port provided in https://www.analog.com/en/design-center/evaluation-hardware-and-software/software/freertos.html#software-overview to Clion
    • FreeRTOS standard demo building and running successfully on SC573 ezkit
  • Using Cmake with ninja generator and ADI arm-none-eabi-gcc to build the bsp and application
  • Using ADI arm-none-eabi-gdb and OpenOCD for debugging (in Clion)
    • using the following cfg files for OpenOCD
      • source [find interface/ice1000.cfg]
      • source [find board/adspsc573_ezkit.cfg]
  • Using linker script provided by ADI for linker script
    • /opt/analog/cces/2.10.1/ARM/arm-none-eabi/arm-none-eabi/lib/ldscripts/adsp-sc573-l3.ld
    • let me know if I should be using adsp-sc573-l2.ld instead
  • Cmake flags
    • -g
    • -gdwarf-2
    • -mcpu=cortex-a5

Problem:

Trying to use newlib_reentrant with #define configUSE_NEWLIB_REENTRANT              1
Which works in CCES2.10.1 and compiles properly, but not working in CLion because for some reason the preprocessor header _ADI_THREADS is enabled by default in the ADI ARM compiler?

This can be seen in the file include/sys/lock.h, with configUSE_NEWLIB_REENTRANT defined as 1. CCES automatically recognises that _ADI_THREADS is not defined and imports <newlib>.

While in CLion, with the same freertosconfig.h, _ADI_THREADS is defined and thus doesn't import <newlib.h>

In a old sharc compiler documentation (VisualDSP++ 5.0 C/C++ Compiler Manual for SHARC Processors) it shows that by defining -threads switch in compiler option, it also defines _ADI_THREADS macro to 1 at compile time. Not sure if this was carried on to the CCES 2.10.1 compiler.

Parents
  • Rest of the compiler flags

    -mabi=aapcs
    -mfloat-abi=hard
    -MMD # same as above but only uses user header files
    -MP # Emits dummy dependency rules
    -MF # specifies file name for the makefile dependency rule (MMD)
    -msi-revision=any #silicon revision
    -mproc=ADSP-SC573
    -D__ADI_FREERTOS #enables the freeRTOS version of osal functions, which are used by BSP libraries
    -DADI_DEBUG
    -mdebug-libs
    -lm
    -D__ADSP215xx__
    -DCORE0
    -Wl,--gc-sections -madi-threads -mdebug-libs -lm
    --specs=${CMAKE_CURRENT_LIST_DIR}/third_party/bsp/SC573/FreeRTOS/portable/ARM_CA5/freertos.specs
    -fdata-sections # Generates one ELF section for each variable
    -ffunction-sections # Generates one ELF section for each function
Reply
  • Rest of the compiler flags

    -mabi=aapcs
    -mfloat-abi=hard
    -MMD # same as above but only uses user header files
    -MP # Emits dummy dependency rules
    -MF # specifies file name for the makefile dependency rule (MMD)
    -msi-revision=any #silicon revision
    -mproc=ADSP-SC573
    -D__ADI_FREERTOS #enables the freeRTOS version of osal functions, which are used by BSP libraries
    -DADI_DEBUG
    -mdebug-libs
    -lm
    -D__ADSP215xx__
    -DCORE0
    -Wl,--gc-sections -madi-threads -mdebug-libs -lm
    --specs=${CMAKE_CURRENT_LIST_DIR}/third_party/bsp/SC573/FreeRTOS/portable/ARM_CA5/freertos.specs
    -fdata-sections # Generates one ELF section for each variable
    -ffunction-sections # Generates one ELF section for each function
Children
No Data