0
\$\begingroup\$

I am using stm32f303k8t6 nucleo board and Keil V5 IDE. I want to measure temperature with DS18S20 sensor over one wire interface. I have downloaded the HAL library from https://github.com/nimaltd/ds18b20.

But how do i add these library to my project in Keil. Can some one help.

My project window looks like this enter image description here

And the files inside the GitHub library looks like this. enter image description here

Please tell let me know what is the proper way to add these files to my project.

I have added a group to my project->Sensor->add existing files->what next?? enter image description here

I have removed the .h files, text files and licences from the Sensor folder and followed what you have suggested. enter image description here

I have done the same as above once again and it seems like added the c files to my project successfully. enter image description here But it couldn't find some other header file related to the library**(#include "gpio.h" , #include "cmsis_os.h")**. Is it the error in the library file or project setup error.?

\$\endgroup\$
  • 1
    \$\begingroup\$ Add the path to the header file (.h) via the target options -> C/C++ -> Include Paths. Then, right-click your Application/User folder and choose add exisiting files. Browse to your source file (.c) associated with your header file and add it. Now in your main.c (or wherever you want to use it) include it via #include "headerfilename.h" at the top of your file. Do this for all your source/header files. \$\endgroup\$ – BertVano Aug 14 '18 at 14:39
  • 1
    \$\begingroup\$ You could also create a seperate group for your source files by right-clicking the top folder and choosing 'Add Group...' \$\endgroup\$ – BertVano Aug 14 '18 at 14:42
  • \$\begingroup\$ Thank you BertVano. Please see the photo and suggest next \$\endgroup\$ – litun bls Aug 14 '18 at 14:57
  • \$\begingroup\$ Include Paths -> ... -> New -> ... -> browse to path where your header files are located and add the path. It is not necessary to add the header files in your folder 'Sensor'. Source files should suffice. Upon rebuild, Keil will link the source files to their header files if you selected the path correctly. \$\endgroup\$ – BertVano Aug 14 '18 at 15:08
  • \$\begingroup\$ Also, use Options for Target, not for Options for Group so your whole project can use the path to the header files. Icon right of 'Load' icon. \$\endgroup\$ – BertVano Aug 14 '18 at 15:13
0
\$\begingroup\$

Here is a step by step instruction for setting up Keil for programming STM32. Hope this is what you are looking for.

STM32 with Keil uvision

\$\endgroup\$
  • \$\begingroup\$ Not exactly. I know setting projects in keil. Adding external library without any error is tricky. \$\endgroup\$ – litun bls Aug 14 '18 at 14:48
  • \$\begingroup\$ Point number 17? Isn't that working? I used Keil a couple of years back and mostly followed this website, if I remember correctly. I haven't got it anymore, otherwise would post the screenshots. \$\endgroup\$ – SappyM Aug 14 '18 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.