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 the following cfg files for OpenOCD
- 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.