Using printf() via UART in a bare metal project

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

Using printf() via UART in a bare metal project

2,019 Views
djz
Contributor I

I have LS1046RDB board.

I installed CodeWarrior, set up bareboard project example and I managed to run the program via GDB and using built-in CMSIS-DAP I run it from RAM.

By default, printf() uses GDB redirection to CodeWarrior console. I followed Targeting Manual and changed linked library from simrdimon.specs to uart.specs.
But I don't see any output in a serial terminal on my PC.

Should I invoke any UART configuration / init function? Targeting Manual says only about changing the library. Is there any documentation of this UART library? Any API description or whatever?

I tried invoking InitializeUART, but to no avail and it was guessing. How can one use UART in a bare metal project?

Labels (1)
0 Kudos
4 Replies

1,482 Views
djz
Contributor I

Yes, I did like that. But it was not working.

I think the problem is that I use hard-coded RCW. And from the Reference Manual it seems that the both possible hard-coded RCWs disable UART pins and configure them as GPIO...

But I don't know how to override RCW via JTAG. I tried using Initialization Script and commands:


   gdb.execute("monitor rcw data set RCW11 0x00038000")
   gdb.execute("monitor rcw apply")

But it either doesn't take any effect or return an error: "monitor rcw apply" failed. [GTA: error writing register].

0 Kudos

1,482 Views
mark_xingchangy
Contributor II

Hi Dariusz,

Does your board work with UART printf? If yes, how do you solve it? I have met the same issue on LS1043ARDB EVK board now. Thanks!

B.R.

Mark Yang

0 Kudos

1,482 Views
mark_xingchangy
Contributor II

Update on LS1043ARDB:

It works after the 2 steps as mentioned above

1. Change project properties as C/C++ Build -> Settings -> Tool Settings -> Cross ARM C Linker -> Miscellaneous as showed by Clipboard02.jpg in Pavel's reply above.

2.Change Target Initialization File in CodeWarrior as the following

# Override RCW using a safe hard-coded RCW option

USE_SAFE_RCW = True

... ...

gdb.execute("monitor rcw data set RCW12 0x00038800")

gdb.execute("monitor rcw apply")

Thanks!

B.R.

Mark Yang

1,482 Views
Pavel
NXP Employee
NXP Employee

Check your UART terminal setting.

There are no problems if UART is used via MBED under CodeWarrior.

See attached snapshot.


Have a great day,
Pavel Chubakov

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

0 Kudos