TMS570LS3137: TIClang 4.0.4.LTS & F021 Flash API – wchar_t Incompatibility

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Toolchain / IDE:

  • Code Composer Studio 12.8.1

  • TIClang 4.0.4.LTS

  • Target: TMS570LS3137PGE

Project context:

  • Firmware uses custom drivers (no HALCoGen).

  • Includes TI’s precompiled F021 Flash API library:F021_API_CortexR4_BE.lib (version 02.01.01).

Problem Summary

When linking my TIClang-compiled objects with TI’s prebuilt F021_API_CortexR4_BE.lib, I get #16032-Derrors about incompatible wchar_t types:
#16032-D object files have incompatible wchar_t types
("F021_API_CortexR4_BE.lib<...>" = --wchar_t=16,
"app.o" = --wchar_t=32)

 

I tested adding the TIClang option: -fshort-wchar
This makes my objects use --wchar_t=16, but then the linker reports new errors showing that TIClang’s own runtime libraries are all built for 32-bit wchar_t: 
divsi3.S.obj in .../libclang_rt.builtins.a      = --wchar_t=32
e_fmod.c.obj in .../libc.a                      = --wchar_t=32
hostexit.c.obj in .../libsysbm.a                = --wchar_t=32

So even if I match the F021 library, TIClang cannot link because its supplied runtimes do not support 16-bit wchar_t.

  1. Does TIClang officially support only 32-bit wchar_t?
  2. Was the F021 Flash API built using the legacy TI ARM CGT toolchain (tiarmcc) with 16-bit wchar?
  3. Is there an officially supported way to link F021 with TIClang?
  4. Is it safe to link my TIClang project without -fshort-wchar and ignore the warning.