Skip to main content
GMeur
Associate III
Feb 13, 2025 8:22 AM UTC
Question

UChar.h is missing

Hi,

I just found out <uchar.h> is missing from standard c header files in \STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\arm-none-eabi\include. How am I supposed therefore to use char16_t and char32_t then? Ofc I could just define them myselves but I'd rather work with default library headers tbh. I checked wchar.h and stdint.h to see if those types were defined there with no avail.

I'm quite surprised such a basic header is missing?

Thanks.

 

This topic has been closed for replies.

4 replies

Pavel A.
Feb 15, 2025 8:06 PM UTC

Indeed uchar.h header is defined for C11 and should be available. But you are the first person who noticed it.

The C library for CubeIDE is originated from RedHat newlib. You can request update from them.

Meanwhile you can do something like this:

#if __has_include(<uchar.h>)
#include <uchar.h>
#else
typedef uint16_t uchar16_t;
typedef uint32_t uchar32_t;
#endif
GMeur
GMeurAuthor
Associate III
Feb 17, 2025 10:18 AM UTC

Yeah, it's what I did for now, but as stated in my first msg, I'd rather use default headers.

As to get Unicode support from touchgfx, I kind of agree. Problem is, I mixed up char16_t and touchgfx::Unicode::UnicodeChar and it's just an old code I'm migrating from iar to cubeIDE and I'd rather not touch it besides the obvious modifications to make it compile on gcc.

STTwo-32
ST Technical Moderator
Feb 15, 2025 8:33 PM UTC

Hello @GMeur 

Thank you so much for escalating this. I've sent your feedback to our team to review his implementation on the STM32CubeIDE (under internal ticket number 203895).

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Pavel A.
Feb 15, 2025 8:51 PM UTC

Newlib deliberately omitted Unicode support because of large data tables needed for conversion (and need to update these tables every time when somebody invents new weird characters :pile_of_poo:). But they can provide just the uchar.h and mbstate_t.h, without implementation of mbrtoc32, c32rtomb and so on.

MCU users that really want Unicode should get it from the GUI software such as TouchGFX.