Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12618 Discussions

How to change from unicode to ansi char for altera_16550_uart_read ?

Honored Contributor II



I am building a Nios design using an 16550 Uart. (C++) 


The primitives for altera_16550_uart_read are unicode versions. 

altera_16550_uart_read(altera_16550_uart_state* sp, wchar_t* ptr, int len, int flags); 


However i would like to use the ansi version: 

altera_16550_uart_read(altera_16550_uart_state* sp, char* ptr, int len, int flags); 


I searched header files, compiler settings etc. 

=> If i change all wchar_t types to char in the driver source files, the problem is solved for the current application. 


However there must be a more elegant way: 


=> In the properties of my application, / C/C++ / Preprocessor Include Paths / GNU C++ there is an entry : _wchar_type__=int. i cannot change this entry. Is it possible to change this entry to char, and will this do the trick ? If so, how can I change this setting? At this time the entry seems to be read only. 


=> I looked with the BSP editor at various settings, I could have overlooked someting, but as far as I can see, there are not UNICODE / ANSI strings settings to be found. Is there a way to make the proper settings via the BSP editor? 


=> I also looked in stddef.h, but since in C++ wchar_t is a type and not I defined type, i think that the solution for the issue is not there. But i am not sure. 



Thanks for any help, 

0 Kudos
0 Replies