undefined reference to `__read_console'

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

undefined reference to `__read_console'

ソリューションへジャンプ
5,444件の閲覧回数
prashantsathe
Contributor III

Working on MAC57D5MB for freeRtos.

 

I am working on adding a printf functionalities. Build get failed at the send saying

 

C:/Freescale/S32_ARM_v1.2/S32DS/arm_ewl2/lib/armv7e-m\libc99.a(ansi_files.o):(.data.__files+0x40): undefined reference to `__read_console'

C:/Freescale/S32_ARM_v1.2/S32DS/arm_ewl2/lib/armv7e-m\libc99.a(ansi_files.o):(.data.__files+0x44): undefined reference to `__write_console'

 

Could you help me on this ?

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
3,610件の閲覧回数
prashantsathe
Contributor III

Console read/write for printf was not configured In my case(Libs functions).

I have implemented the custom printf directing to UART.

Anyway thanks

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
3,611件の閲覧回数
prashantsathe
Contributor III

Console read/write for printf was not configured In my case(Libs functions).

I have implemented the custom printf directing to UART.

Anyway thanks

0 件の賞賛
返信
3,610件の閲覧回数
geniusxiong
Contributor I

Can you tell me how to implement the custom printf directing to UART?

Thanks

0 件の賞賛
返信
3,610件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can look at this Example - https://community.nxp.com/docs/DOC-335240 

It is for FreeRTOS - but basics are the same. You can re-use console.c and console.h files in your project. 

Hope it helps. 

Jiri 

0 件の賞賛
返信
3,610件の閲覧回数
geniusxiong
Contributor I

Thank you!

With this reference example, I add console.c and console.h to my project , and then I can use printf and scanf , that's good!

But another problem, if i scanf some words from lpuart, and then use PINS_DRV_SetPins this function for setting gpio ,

PINS_DRV_SetPins will not work, i don't know why. Can you help me?

console.c and console.h I have not changed these two files.

0 件の賞賛
返信
3,610件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

um - what you mean by PINS_DRV_SetPins doesn't work? I tried toggle pin ( PINS_DRV_TogglePins(LED_GPIO, (1 << LED2)); ) right after scanf - and for me is working normally. Is your particular pin (driven by PINS_DRV_SetPins) set as an output? 

Jiri

3,610件の閲覧回数
geniusxiong
Contributor I

ok, thanks!

The problem has already been solved yet.

And another question:

I don't know if I can use scanf to get a string, for example,  char msg[100]; scanf("%s", msg); I try and test with existing console.c maybe can not use

scanf to get a string, so i will modify the function __read_console in console.c? and how do i modify it ?

天雄

0 件の賞賛
返信
3,610件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can use scanf for string read. You need to specify length of your buffer (in the rtos printf example is max size 256 bytes). There is no buffer overflow check in console.c file - it is good idea to add it (exit from read console if size exceed maximum allowed size). 

It depend for what purpose you need to read string. scanf function is dedicated for keyboard input. For transfer string data for example from file is better idea use LPUART_DRV_ReceiveData SDK function. 

Jiri 

0 件の賞賛
返信
3,610件の閲覧回数
geniusxiong
Contributor I

Thank you very much!

天雄

0 件の賞賛
返信