8 years, 9 months ago.

How to use mbedTLS library in Keil or IAR IDEs?

I want to do an RSA encryption/decryption using my AT91SAM7S256 ARM MCU. After googling I found mbed TLS library. I download it on my Windows and extracted it in the directory of my project.

I was created the project using Keil IDE as below:

  • 1- Project >> New mVision Project
  • 2- Assigning a name to the project
  • 3- Choosing "AT91SAM7S256" under Atmel MCUs
  • 4- Accepting the following suggestion: /media/uploads/ebloader/1.jpg

After that, in the following tab, I added the path of mbed TLS extracted directory to the Include Pathof Keil(Path of header files, I think):

Project >> Option for Target "MyProjectName" >> C\C++

As the last step I did a right click on the project name in the right sidebar and using Add files to group AGroupName I added rsa.h and rsa.c of mbed TLS files to my project. I added a file named main.c that I myself was created it already with the simplest content:

main.c

#include "rsa.h"

int main(){
	return 0;
}

Here are the pictures of above steps:

/media/uploads/ebloader/2.jpg

/media/uploads/ebloader/3.jpg

Finally I tried to build this project from Project >> Build all target files, but I faced the following error :

Errors wrote:

Build target 'Target 1'

assembling SAM7.s...

compiling rsa.c...

mbedtls-2.0.0\library\rsa.c(30): error: #5: cannot open source input file "mbedtls/config.h": No such file or directory compiling main.c...

main.c(1): error: #5: cannot open source input file "rsa.h": No such file or directory Target not created

Well, I added config.h to the group just like rsa.c and rsa.h and replaced "mbedtls/config.h" with "config.h" in the rsa.c file and that error removed. but another similar error appeared. Well I added about 10 files and edit the content as described but I still faced similar error.

  • 1- I want to ask if is this the correct way? Am I should manually add all the files one by one? Or there is a better and efficient way?
  • 2- As the contents of mbed TLS library shows(make, makeinstall and so on) and as the extension of downloaded file shows(".tgz"), it is written for linux platform. Does that mean I can't use it in windows?
  • 3- As a starter, witch one is better for the above described project? Keil vs IAR IDE? Windows vs Linux platforms?

Note that this is the first step of project, I think I must add other algorithms also.

Thanks in advance.

Be the first to answer this question.