如何在MCUXpresso IDE中使用第三方封装函数库(How to use the foreign library in "MCUXpresso IDE")

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

如何在MCUXpresso IDE中使用第三方封装函数库(How to use the foreign library in "MCUXpresso IDE")

1,628 Views
barber_chen
Contributor I

大家好!目前我有一个基于MCUXpresso IDE的LPC822M101的项目需要调用外来库文件(对方不披露源代码),但是发现调用过程中出现 undefined reference to `gt_24_data_B',然后网上搜索资料时发现只能找到自建lib.a的link方式(但这种方式下编写的一个简单return 程序竟然无法测量返回值(提示优化过度,但是我只做了1级优化)),对此实在盲目无策,不知道大家有没有遇到过同样的问题?多谢解答

Hello everyone ,Now I have a project is use the  MCU of "LPC822M101",its based on the MCUXpresso IDE,I have to include a foreign library(lib.a) to use some function.However,when I add the "xxx.a" and the "xxx.h"to the source file(it has inlcude to the project),then build the porject ,its display an error in the build console":undefined reference to `gt_24_data_B' ".Then, I have get a method whitch is"creating and linking to library projects"(here is the URL:Creating and Linking to Library Projects )

and this method can indeed call the foreign library function,but the return is can not be viewed when I debug it(its reminds me this value has been "optimized out"),but the optimization level is just set to "Optimize(-O1)".And then,because the source code would not be show me any more,so its useless in my project.

I wanna a useful method to build this porject successful, thanks!

pastedImage_1.png

0 Kudos
2 Replies

1,312 Views
jeremyzhou
NXP Employee
NXP Employee

非常感谢使用NXP产品,很高兴为你提供技术支持!

首先,你按照Creating and Linking to Library Projects  给出的方法来添加lib文件是可以的。接着,可以尝试一下以下的两个建议:
1. 将优化设置为:Optimize for size (-Os)
2. 可以参LPC824 Example Code Bundle LPCXpresso中例程,里面的例程也是要调用lib文件,希望你可以好好参考一下。

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,312 Views
barber_chen
Contributor I

多谢周工,根据您的建议已经可以使用

0 Kudos