admin管理员组

文章数量:1410705

I want to use the X-CUBE-CRYPTOLIB (CMOX) of my STM32 in Keil and installed it properly and selected my required modules. I can use the functions, header files etc. But if I want to compile, I am always getting the linker error saying it can't find the crypto lib even though I can 100% confirm the file is there.

..\file.axf: error: L6002U: Could not open file ..\STM32CubeExpansion_Crypto\Middlewares\ST\STM32_Cryptographic\lib\libSTM32Cryptographic_CM0_CM0PLUS.a : No such file or directory

Even copying the file to several folders of the project doesn't work. I also tried to use an absolute path instead of relative but no difference (also because Keil seems to automatically turn it back into a relative path). I also tried linking the using the compiler flag --libpath [path to .a file] as the documentation suggests.

All in all it really seems like it just can't open the file for some reason. It might even be an internal linker error.

I want to use the X-CUBE-CRYPTOLIB (CMOX) of my STM32 in Keil and installed it properly and selected my required modules. I can use the functions, header files etc. But if I want to compile, I am always getting the linker error saying it can't find the crypto lib even though I can 100% confirm the file is there.

..\file.axf: error: L6002U: Could not open file ..\STM32CubeExpansion_Crypto\Middlewares\ST\STM32_Cryptographic\lib\libSTM32Cryptographic_CM0_CM0PLUS.a : No such file or directory

Even copying the file to several folders of the project doesn't work. I also tried to use an absolute path instead of relative but no difference (also because Keil seems to automatically turn it back into a relative path). I also tried linking the using the compiler flag --libpath [path to .a file] as the documentation suggests.

All in all it really seems like it just can't open the file for some reason. It might even be an internal linker error.

Share edited Mar 11 at 9:43 halfer 20.4k19 gold badges109 silver badges202 bronze badges asked Mar 10 at 8:26 JakobJakob 1,9352 gold badges16 silver badges31 bronze badges 8
  • 1 Is the Keil compiler compatible with gcc archives? Could this be the issue. – artless-noise-bye-due2AI Commented Mar 10 at 14:09
  • @artless-noise-bye-due2AI Thanks for your answer. I did some research on your answer, but it seems like it should be compatible. I have also seen other people doing it. I am using the armlinker v6.22 (if that is important). Also I would expect a different exception than "No such file or directory". – Jakob Commented Mar 10 at 14:54
  • 1 It could be a '/' and '\' issue. Can you open if it is in the same location as the build (without any path)? Yes, you would expect a different diagnostic, but when things go wrong it is quite common to get bad guesses as to what went wrong. It is difficult to make good diagnostic messages. – artless-noise-bye-due2AI Commented Mar 10 at 15:55
  • 1 The .a is are archive. You should be able to extract (using -x option) the .o files inside and try to use them directly. Either as a solution and/or to help diagnose the issue. – artless-noise-bye-due2AI Commented Mar 11 at 12:53
  • 1 You are free to self answer. – artless-noise-bye-due2AI Commented Mar 12 at 17:40
 |  Show 3 more comments

1 Answer 1

Reset to default 1

Thanks to  artless-noise-bye-due2AI for suggesting the the working solution in the comments.

The solution was to extract the .a file using e.g. 7zip and import all extracted .o files into Keil.

本文标签: