Keil Uvision V4

1 view
Skip to first unread message

Charlesetta Blare

unread,
Aug 3, 2024, 5:27:16 PM8/3/24
to westmegunra

I started with an example project in keil from Nordic SDK. This question is not about the nordic sdk, but rather how Keil connects header files and source files. After what I can understand Keil hides all header files merged into the main.c file, see figure below.

I want to add my own header file called "physical.h" where I define additional hardware that I added.Sometimes I want to add a header file and source files "*.c" files.What can I specifically do to add a new file, and compile this new file with my main.c file? A walkthrough would be appreciated.

I believe Keil is not intuitive in the folder structure sense. However, it is probably good for a modular design as it can easily include files from many places on your computer (git, library etc...).

Let's start with problem one (adding a header file):The header files in the main.c file is an image of whats already included and "working". Add a new file by right clicking the parent folder of main.c and click "Add new item to group ". From within the menu, choose C-file/H-file or any other appropriate file.

Now, what might confuse you is that the .h file will not appear in the folder you just created it. The .c files will appear, but not .h! You will find your file at the open in a new window. Right click that tab with the filename you just created, and click "copy full path".

Here comes the tricky part.Go to the project tab in Keil menu, and click "options for target " or ALT+F7.Go to the tab "C/C++" tab. In the "Include Paths" slot, the will be a button indicating "...", click it. In the top right corner, holding over the first icon will show "New (insert)", click it. Click the new button "..." in the slot you just created, this will open a folder menu. This is where you find your file and add the parent folder of that file. However, you may need to move the file you created in order to find a good structure.

The structure inside Keil Uvision 5 is just virtual folders, and creating a file will just put it in the project folder with no structure. Finding a good solution now, is up to you, comment if you come up with one.

The last part I would like to add is what happens when you just included this file. Well, go into your main.c file, include the header file, as in normal C convention. #include "myfile.h". If you try to compile, it should show no error, and your main.c file will have a sub-file of that same .h file you just included.

Second problem:For C-files you can just add them, the same way as earlier, however, Keil will dump them all at the source of your project, having no structure at all. For structure, you must do that outside of Keil unfortunately.

Keil MDK does not have a program like Processor Expert. Processor Expert (PE) will create a uVision project that you can subsequently use as the heart of your development. Processor Expert currently does not support S32K. Hopefully we can head in this direction soon. I understand that PE is inside S32-DS. uVision is the IDE of Keil MDK.

If you create a project using S32KDS - it is fairly easy to port it to uVision. I did this relatively easy with the NXP AN5413 Cookbook examples: www.keil.com/appnotes/docs/apnt_304.asp You can add or use FreeRTOS.

uVision has the utility Manage Run-Time Environment (MRTE) that you can select various components into your project. In the window below you can see components you can select. You can get the evaluation version of MDK to expand on these.

uVision supports FreeRTOS - just select it in MRTE (or Arm Keil RTX) and the files are added to your project. You can now configure FreeRTOS or Keil for your needs. Keil RTX has a Apache 2.0 license. -software/CMSIS_5

I worked with Keil uVision. For analysing Keil uVision code I followed instruction of the +MDK-ARM+Support document. I create bdf file and I import my code and bdf file to standalone C++test ide. Then I tried to do static analysis for this code.

After the project has been successfully imported, no additional configuration steps are required for running static analysis.
For details on performing static analysis, see Static Code Analysis and Flow Analysis.

It says that no additional steps are reduired for running static analysis. Therefore I select one .c source file and I run a static analysis with using this file. Then C++test does not analyse this file because in the scope tab current document number 0/0 it means that I can not run this file for static analysis. Therefore after anaysis zero violation found and task was not reported.

I looked at the your posted document. I followed the instruction of it. I work in command line also. I try to related command line which creates bdf file but the bdf file did not generate correctly. Then I try to compile code with - r command, it compiled correctly. There is no problem for compile. Why the bdf file does not created correctly? Related screen shot is added to question.

Hi @MichaelC, we try to generate bdf file with the tutorial which you linked to discussion. We tried also --cpptesttraceQuoteCmdLineMode=sq command but bdf file did not generated correctly. One thing which we did not do is we did not generate batch file from keil. It is mondatory? How batch file uses while creating bdf?

Hello @fatmanur61, building the batch file is mandatory for creating a bdf. The batch contains all of the necessary dependencies of your Keil project that C++test needs to generate a bdf and run analysis.

Hi @MichaelC . We managed static analysis for Keil. The bdf file created correctly by using batch file. Then we try to generate unit tests for keil project. We generated tests successfully. After that we try to run this tests via "Unit tests->Embedded-> Keil configurations ". But we took error. Then I search the error internet and I added extra compiler options. Added compiler option was shown in image. Related images are added to discussion. How can we solve this problem?

The procedure I used to get the mbed online compiler led blinky example to workis based on App note 207 from Keil, along with example blinky uVision project. ://www.keil.com/download/files/apnt207.zip

I simply followed the application note to the word and got it working in about 2 min.I didn't run into any of the linking problems that the old thread goes into detail about, so it looks like it's all sorted out now.

Hopefully those arduino nuts will stop winning about the online cloud compiling thing and be willing to use a microcontroller with some real balls. Yea I know that Keil uVision isn't opensource, and the eval version only supports 32kb, which is half the available ram on the mbed, but with the arduinos you only have 32kb anyway.

It took me a little longer than 2 minutes because I am using some features from a later mbed library than the one in the apnt207.zip file so had to download the latest files from here: download the header files and the other files, copying them over those from the zip file.

Another issue I had was that I am using '\e' to determine that the escape key has been pressed, this initially caused the Keil software to issue a warning and the Escape key wasn't recognised. I was able to correct this problem by adding a '- -gnu' instruction to the compiler options (see the 'Misc Controls' section):

Should I download the files that Sophie said? btw, How did you do it? I mean, I didn't find an option to download the .h files directly, I would have to copy the text and then delete the file numbers and stuff (which would be quite annoying).Thanks in advance!!

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.

because there was two empty files referenced on the linker cycodeshareexport.ld / cycodeshareimport.ld ? any idea what this files should have, uvision was unable to find them I guess because they were empty.

the program compiled but somehow the hex file is not in the right format, I have tried adding the compiler flags but no luck, so the kitprog and miniprog are not allowing the programming to happen (the project runs and debugs fine from creator)

I was able to export and program a Psoc4 Creator project to Keil uVision. After exporting please follow the steps given in this documentation(page no:440), kindly follow the steps given from page 509-511 for GCC settings in uVision.

I did follow that process it is not working as easy and straight forward as the document presents it, are you able to get a sample project setup? I managed to get it to compile but the generated hex file is not accepted by the kitprog/miniprog

c80f0f1006
Reply all
Reply to author
Forward
0 new messages