FRDM-KL05Z Code Warrior Processor Expert

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

FRDM-KL05Z Code Warrior Processor Expert

ソリューションへジャンプ
1,409件の閲覧回数
danreltek
Contributor III

Hi,

I've created a LED Blink Project in CodeWarrior 10.6, using Processor Expert as described in the help section under Processor Expert Tutorials.It works beautifully. I've now extended the project by adding component AsynchroSerial. I can send characters out no problem. But what I would like to do is use printf and all the other standard io functions. When I try to include these headers there seems to be no end to errors. I am unsure if they are even compatible with the code generated by processor expert. So before I dent my forehead too badly against my keyboard, can someone please tell me which headers to include, and how to include them in order to get to get printf to work.

Thanks

Dan

ラベル(1)
0 件の賞賛
返信
1 解決策
1,058件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Dan:

A detailed tutorial on how to use printf and the like with Processor Expert is in the next link, created by colleague Erich Styger:

Tutorial: Printf() with (and without) Processor Expert | MCU on Eclipse

You will notice however that it is not recommended to use it, or use it only during prototyping phase, as explained in other of his posts:

Why I don’t like printf() | MCU on Eclipse

Regards!,

Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
6 返答(返信)
1,059件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Dan:

A detailed tutorial on how to use printf and the like with Processor Expert is in the next link, created by colleague Erich Styger:

Tutorial: Printf() with (and without) Processor Expert | MCU on Eclipse

You will notice however that it is not recommended to use it, or use it only during prototyping phase, as explained in other of his posts:

Why I don’t like printf() | MCU on Eclipse

Regards!,

Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
1,058件の閲覧回数
danreltek
Contributor III

OK. I see why printf() is unpopular. I am happy to use puts() instead. I'm still having trouble understanding

1. where the right header file is

2. how to include it to the project

3. which project folder to include it to.

I'd appreciate some help please.

Thanks

Dan

0 件の賞賛
返信
1,058件の閲覧回数
BlackNight
NXP Employee
NXP Employee

As for including header files, it should be enough to use

#include <stdio.h>

Otherwise: you would need to post more information (your project, the errors you are seeing, etc).

Erich

1,058件の閲覧回数
danreltek
Contributor III

OK. When I

#include <stdio.h>

I get no problem. Project builds ok.

When I add this 1 line of code:

puts("A");

I get the following result:

**** Build of configuration FLASH for project BMS_01 ****

"C:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j6 all

'Building file: ../Sources/main.c'

'Executing target #2 ../Sources/main.c'

'Invoking: ARM Ltd Windows GCC C Compiler'

"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" "../Sources/main.c" @"Sources/main.args" -MMD -MP -MF"Sources/main.d" -o"Sources/main.o"

'Finished building: ../Sources/main.c'

' '

'Building target: BMS_01.elf'

'Executing target #19 BMS_01.elf'

'Invoking: ARM Ltd Windows GCC C Linker'

"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc"    @"BMS_01.args" -o"BMS_01.elf"

C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv6-m\libuart.a(uart_console_io.o): In function `__init_uart_console':

ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:200: undefined reference to `InitializeUART'

C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv6-m\libuart.a(uart_console_io.o): In function `__read_console':

ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:93: undefined reference to `ReadUARTN'

C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv6-m\libuart.a(uart_console_io.o): In function `__init_uart_console':

ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:200: undefined reference to `InitializeUART'

C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv6-m\libuart.a(uart_console_io.o): In function `__write_console':

ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:151: undefined reference to `WriteUARTN'

mingw32-make: *** [BMS_01.elf] Error 1

I get the feeling there is something I need to do to connect the functionality of puts() with the functionality of the component AsynchroSerial.

Can they even be connected?

If so, How?

Thanks

Dan

0 件の賞賛
返信
1,058件の閲覧回数
BlackNight
NXP Employee
NXP Employee

AsynchroSerial does provide you all the low level functions needed for the EWL printf() or puts().

You need to add your own functions implementing InitializeUART(), ReadUARTN() and WriteUARTN().

You might have a look at http://mcuoneclipse.com/2013/04/17/printf-with-the-frdm-kl25z-board-and-without-processor-expert/

and Tutorial: printf() and “Hello World!” with the Freedom KL25Z Board | MCU on Eclipse which outlines the basic steps.

Erich

0 件の賞賛
返信
1,058件の閲覧回数
danreltek
Contributor III

Actually, I've just reread your advice on how to use printf() and I got rid of AsynchroSerial and replaced it with ConsoleIO. No errors!

Thanks.

0 件の賞賛
返信