Skip to main content
Associate II
February 22, 2024
Solved

x-cube-cryptolib - Adding to application in Keil IDE

  • February 22, 2024
  • 6 replies
  • 4309 views

Hello,

I've to add the x-cube-cryptolib to our application.

I added to include path, the file cmox_low_level.c and the library file libSTM32Cryptographic_CM3.a.

I get these errors:

\Middlewares\ST\STM32_Cryptographic\lib\libSTM32Cryptographic_CM3.a(1): error: A1167E: Invalid line start
\Middlewares\ST\STM32_Cryptographic\lib\libSTM32Cryptographic_CM3.a(2): error: A1167E: Invalid line start
\Middlewares\ST\STM32_Cryptographic\lib\libSTM32Cryptographic_CM3.a(3): error: A1167E: Invalid line start
\Middlewares\ST\STM32_Cryptographic\lib\libSTM32Cryptographic_CM3.a(4): warning: A1313W: Missing END directive at end of file

 

What can I do to fix these errors?

Thanks in advance!

 

This topic has been closed for replies.
Best answer by mƎALLEm

Yes. I reproduced the behavior.

You need to select "Library file" instead of "Assembly language .." in this menu:

SofLit_0-1708626273832.png

Right click on the library and select "Library file"

6 replies

mƎALLEm
ST Technical Moderator
February 22, 2024

Hello,

What if you try to build any example under Projects\NUCLEO-L152RE\ with Keil? do you have the same issue?

I pointed you to that folder because STM32L152 is a CM3 device and it is using libSTM32Cryptographic_CM3.a library.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KauneRAuthor
Associate II
February 22, 2024

Hello,

I'm not sure if the libSTM32Cryptographic_CM3.a is the correct one for me.

I have an STM32F101RD device.

I cannot build the Projects\NUCLEO-L152RE\ because I have not the required device for that project.

mƎALLEm
ST Technical Moderator
February 22, 2024

libSTM32Cryptographic_CM3.a is the correct one since STM32F101 is CM3 based MCU.

You can download the pack for STM32L151 from this link and have a try .. So this test can tell us if the lib is not corrupted.

PS: I build one of the projects under Projects\NUCLEO-L152RE and it compiled fine.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KauneRAuthor
Associate II
February 22, 2024

Hello,

I 've downloaded the pack and tried one of the projects under Projects\NUCLEO-L152RE and it compiled correctly.

But my application cannot be build with the crypto lib...

Could this be a reason?

I do not have any hal header of the form

/* #include "stm32<series>xx_hal.h" */

in my project. So, I did not adapted this line in the file cmox_low_level.c.

mƎALLEm
ST Technical Moderator
February 22, 2024

Ok.. So no issue with the library.

I don't think the hal header is the source of the issue. 

I suggest you to see how a project from Projects\NUCLEO-L152RE is constructed to inspire from it.

You need at least to have something like this:

SofLit_0-1708624135534.png

Don't forget to define the include paths and the defines here:

SofLit_2-1708624316182.png

 

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KauneRAuthor
Associate II
February 22, 2024

Hello,

Without crypto lib, my application can be build and is running.

For the adding of the crypto lib, I added the include path, the c-file cmox_low_level.c and the lib a file.

Do I have anything else to add like defines for the crypto lib or an additional entry for the linker or compiler?

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
February 22, 2024

Yes. I reproduced the behavior.

You need to select "Library file" instead of "Assembly language .." in this menu:

SofLit_0-1708626273832.png

Right click on the library and select "Library file"

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KauneRAuthor
Associate II
February 23, 2024

Yes, this helped!

For the first selection, a library .a file only could be taken as asm file. Change to library file, could build in the crypto library in my project.

But now, I get the errors:

Error: L6218E: Undefined symbol __HAL_RCC_CRC_CLK_ENABLE (referred from cmox_low_level.o).
Error: L6218E: Undefined symbol __HAL_RCC_CRC_RELEASE_RESET (referred from cmox_low_level.o).

From where can I get those defines?

Thanks in advance!

KauneRAuthor
Associate II
February 26, 2024

Where can I find this 

"stm32f1xx_hal.h"c file?

In my application, there is no *_hal.h file included. And within the drivers folder of the crypto lib, there is no "stm32f1xx_hal.h" file, only files for other STM32 products.

mƎALLEm
ST Technical Moderator
February 26, 2024

Hello,

Normally you can inspire from STM32CubeF1 examples from here  to understand the folder/files structures. All files you need are there.

Meanwhile I've tried to port a project on F103 platform. You need to add the folder STM32_Cryptographic under the path Middlewares\ST. It builds without any issue but I didn't test it. It's for a project build reference.

So you need to do it on your own. 

Hope it helps.

 

 

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KauneRAuthor
Associate II
February 26, 2024

Hello,

You suggested to 

Comment __HAL_RCC_CRC_RELEASE_RESET() as there is no CRC RCC reset feature on STM32F1 product.

Can I additionally comment __HAL_RCC_CRC_CLK_ENABLE?

Is there a negative side effect for this? Will the crypto lib still work correctly?

Our application uses self written code, there is no *hal.h header file.

And in the STM32Cube_FW_F1_v1.8.0.7 you gave me, the only line for __HAL_RCC_CRC_CLK_ENABLE is in the file 

stm32_hal_legacy.h

#define __CRC_RELEASE_RESET __HAL_RCC_CRC_RELEASE_RESET

 

So, there seems not to be a usage of this define.

mƎALLEm
ST Technical Moderator
February 26, 2024

Can I additionally comment __HAL_RCC_CRC_CLK_ENABLE?

Is there a negative side effect for this? Will the crypto lib still work correctly?

Our application uses self written code, there is no *hal.h header file.


You should not comment CRC clock enable as CRC is used by the cryptolib library. 


Our application uses self written code, there is no *hal.h header file.

And in the STM32Cube_FW_F1_v1.8.0.7 you gave me, the only line for __HAL_RCC_CRC_CLK_ENABLE is in the file 

stm32_hal_legacy.h

#define __CRC_RELEASE_RESET __HAL_RCC_CRC_RELEASE_RESET


I said previously and unfortunately, there is no CRC RCC reset feature in STM32F103. I don't know what is the impact on the project. So you need to do some tests to be sure.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KauneRAuthor
Associate II
February 27, 2024

Okay, thank you for the help.

I'll open a new thread for a new question, if necessary:-)