Got Problem on C Program Running in Keil5

Status
Not open for further replies.

KMW

Newbie level 5
Joined
Jul 8, 2022
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
64
I am beginner to learn TM4C123G LaunchPad. I have managed to build the first project of blinking LED through Keil5.

I tried to run another problem to calculate the area of square and print the result into the UART by simulation function of Keil5.

However, I could not build the target.

Is anyone can help me how to obtain stdio.h and uart.h files such that I can add them into the Sources Group of Keil5?

Thanks in advance!

KMW
 

Please find two files for your reference.

The first is the error messages and the other is the screen-shot of Keil5.

Best Regards
 

Attachments

  • 20220709A-C-01-Error-Message.pdf
    237.7 KB · Views: 291
  • 20220709A-C-01-Keil-Screen-Shot.pdf
    282.5 KB · Views: 198

You must fix problems in the order they appear in the compiler output, since following errors can be caused by an earlier. In this case, make sure that you have the file UART.h, and that it is in the compilers search path for include files.
With an include file name enclosed in double quotation marks (") the compiler will only find it by itself it is in the same directory as the current source file (the file with the #include statement).
 

I had attached the screen-shot file in my former thread to indicate an UART.h has been linked into the sources group.
However, it was still not read by the C program.
 

I don't use Keil but try changing:

"UART.H" to
<UART.h>

It changes the path to where the file is expected to be. I would think something like a UART definition would be part of the compiler package.

Brian.
 

I had tried < > instead of " " but not working too.
 

Hi,

still the compiler does not find the UART.h.
Show us the complete path where it is placed.

Klaus
 

For me, it works!!!

Pay attention ion line 10!!! You must have a clear line at the end (newline).

See if all files have this!!!

Don't forget to save all files!!!





 
Last edited:

May I know where USART.h and UART.h have been obtained? Is it automatically generated by Keil5?
 

I've created this files!
Just added the .h file!!!

Simple question, you are using '' ( ' twice) or "?

Where stdio.h has been obtained?

Could you share the project?
 

The stdio.h was linked by keil5. Please find attached the sources files for your trial.
Thanks in advance!
 

Attachments

  • running-C-01.zip
    6.5 KB · Views: 168

You can follow these steps:

1 - Remove the two files thats were wrong:



2 - Add again, like image below: (you can skip this step, if you prefer):



3 - And replace all comments that use // to /* and */ in UART.h file.
And comment the last line "void Output_Color(uint32_t newColor);".
The type uint32_t is not supported by my compiler, you can change for other supported.



4 - And its done!

PS: Sorry for the bad english, it's not my primary language!
 
Last edited:

Thanks! I have modified as per your advice. Now UART.h is readable. However, the outcome is different.
I am also surprised why you did not have any errors from startup.h.
I re-attached the modified UART.h with the supporting files for your reference.
Could you also share your setting in Options for Target and Software Packs for cross-checking?

 

Attachments

  • 20220714A-Running-C-01.zip
    6.5 KB · Views: 155

Go to Project, New uVision Project... Select your target...



Next window, tick Startup...



Click on button Resolve to solve problems...



You can use more drivers, if you prefer.
Click on OK button.
Now you must to add code:



You can rename Targer 1 and Source Group 1.
Inside the Source Group 1, add your files running-C-01.c and UART.h... startup.s isn't necessary!!!



Click on button Save All (Only to prevent any problem).

Click on Project menu, Option for Targeg .... (ALT+F7)



You can specify to create .HEX file... tick Create HEX file, on tab Output.



If you click on button Build, no expected errors.



I sent my project in attach/ts.
 

Attachments

  • Running.zip
    110.4 KB · Views: 140

Thanks again! I have taken your advice steps and successfully made the target. When I run in Debug Mode under either Simulation or Stellaris ICDI, the expected text was unable to show on screen.

With reference to the demo video, the program is not required to select the CMSIS and the Device.
When running in Evaluation Mode on the demo video, another screen of UART #1 is appeared to shown the printout as below.







Have you perform some similar evaluations before? Could you able to advise me what are missing?
 

Referring to your rectified program, could you able to run it and display the expected context within printf command on the screen?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…