PRNTF() problem using Empty board files configuration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PRNTF() problem using Empty board files configuration

2,434 Views
shauldorf
Contributor V

My tools are: MCUXpresso 10.1 & FRDM-K64F KSDK v 2.4

Configuring new project with "Empty board file",  generates simple main.c with

PRINTF("Hello World").

Using SDK debug console  with "UART" option, PRINTF() is executed but no output to console.

The same setup but with  "Semihosting"  is working  well.

0 Kudos
9 Replies

1,896 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello shaul dorf,

When you  Configuring new project with "Empty board file", there is no configure code for UART,

the inti UART pins function "BOARD_InitBootPins();" and init configuration UART function "  BOARD_InitDebugConsole();"  are all empty. so you can't printf data through UART. 

So If you want use UART to printf, you can choose "Default board files" when create new project,

or copy the UART configuraiton code into your own project .

BTW, recommend you use the latest version MCUXPresso IDE v10.2.1 :https://community.nxp.com/community/mcuxpresso/mcuxpresso-ide/blog/2018/07/27/mcuxpresso-ide-v1021-n... 


Have a great day,
TIC

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

0 Kudos

1,896 Views
shauldorf
Contributor V

Hello Alice

Thank's

My idea was to have tool which opens empty project with console debugging option.

This project will be used to configure peripherals without API (direct access to peripheral registers)

Your suggestion is working fine,  but manual adjustments are needed:

  1. Modification board.c and board.h to support console debugger option. Editor cut and paste
  2. Setting Sys Clock to 120 MHz (by MCUXpresso config).

If you want to use this project as a template than you will need export and import without

Debug.lunch and *.mex files.

I think it works fine but a lot of overhead.

My assumption was that it is done with "empty board" option

Shaul

0 Kudos

1,896 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Shaul,

Printf to Console view of IDE (without UART) is working well when create  empty proejct .

If you want to use UART  printf to teminal  of PC  , we need configure UART, also the configuration code of UART

can directly setting registers by yourself (do not use the SDK API) 。

BR

Alice

0 Kudos

1,896 Views
shauldorf
Contributor V

Using MCU config tools to configure UART doesn’t solve the problem.

In attached to can see my solution (doc and project zip).

Shaul

0 Kudos

1,896 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello shaul dorf,

Please add the definition of "SDK_DEBUGCONSOLE" as below :

pastedImage_2.png

then clean , build your project , it can work well , I test on my side :

pastedImage_1.png

Hope it helps,


Have a great day,
TIC

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

0 Kudos

1,896 Views
shauldorf
Contributor V

Alice Thanks

Sorry I don't know where to fined this definition of "SDK_DEBUGCONSOLE"?

Shaul

0 Kudos

1,896 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Shaul,

I take screenshots to show the steps :

pastedImage_1.png

pastedImage_2.png

Hope it helps,


Have a great day,
TIC

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

0 Kudos

1,896 Views
shauldorf
Contributor V

Hello Alice

I just created new empty board project and have added:

SDK_DEBUGCONSOLE=1

REDLIB

FSL_RTOS_BM

SDK_OS_BAREMETAL

CR_INTEGER_PRINTF

PRINTF_FLOAT_ENABLE=0

CPU_MK64FN1M0VLL12

CPU_MK64FN1M0VLL12_cm4

_MCUXPRESSO

USECMSIS

DEBUG

The result was no print to terminal or console.

In my demo that you have tested I changed board.c file to support debugger.

I have attached doc. file how to create empty project that will support printf.

I'm attaching this doc. again.

A. So my question is:

1. using this doc I generate empty project (as a template for empty project)

2. export this project as zip file

3. import it to working space

4. rename it and use it for a new project.

What wrong with this procedure?

B. Another way is:

In working directory:

1. Use Cut and Paste for new project (Which generates new project with different index)

2. Rename it

Regards

Shaul

0 Kudos

1,896 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Shaul,

Your proejct can work well on my side.

When you import proejct, Recommend you use import project button in Quickstart Penal :

pastedImage_1.png


Have a great day,
TIC

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

0 Kudos