mbed.lib and keil

18 Feb 2010 . Edited: 18 Feb 2010

Hello:

I just acquired the KEIL compiler tools (MDK-ARM 4.03).   I would like to create a project for compiling programs offline.   I noticed that I can grab the MBED headers from the SVN but I need the static LIBs to compile.   When I export a project form the site, it includes an mbed.lib but is very small (56 bytes).

Can you provide the mbed libs for offline compiling?

18 Feb 2010

The compiled object files for the mbed library are in SVN along with the headers ( http://mbed.org/projects/libraries/svn/mbed/trunk/ ) they're stored in either the LPC1768 or LPC2368 directory depending on which version of the mbed you want to target (you'll need to extract the mbed.ar file for most of the object files).

19 Feb 2010 . Edited: 19 Feb 2010

Sorry for the dumb question but what is a .ar file?   It doesn't seem that winrar, winzip ,etc can do anything with it.   Google keeps thinking I mistypef .rar file and hasn't yielded anything useful. 

19 Feb 2010

It's an archive created and extracted with "ar" under *nix, I believe some linkers will happily use this format directly. I'm afraid I don't make much use of Windows myself, so can't help you finding a Windows tool to extract it (assuming the KEIL linker can't use it directly).

19 Feb 2010

I just installed mingw under windows (which has ar).   I get an error that it is not a valid archive.  I assume that it is compiled for only x86 libraries with mingw.

 

Could someone at MBED clue me in to the correct setup to extract the libraries (or directly provide the .o or .lib files)?

19 Feb 2010 . Edited: 19 Feb 2010

I'll create a zip for you if you like, what processor are you targeting? Also what's your e-mail address? (I don't feel I should host a copy of the mbed object files on my own vaguely public server)

19 Feb 2010

Actually I just found the armar.exe in the keil bin folder.    Now I just have to get it to work with the compiler.  When I add the .o files to the project  the linker throws out errors such as:

mbed_test.axf: Error: L6218E: Undefined symbol mbed::Base::get_rpc_methods() (referred from DigitalOut.cpp.lpc1768.arm.obj).
mbed_test.axf: Error: L6218E: Undefined symbol mbed::Base::register_object(const char*) (referred from DigitalOut.cpp.lpc1768.arm.obj).
mbed_test.axf: Error: L6218E: Undefined symbol mbed::Base::rpc(const char*, const char*, char*) (referred from DigitalOut.cpp.lpc1768.arm.obj).
mbed_test.axf: Error: L6218E: Undefined symbol mbed::Base::new_name(mbed::Base*) (referred from DigitalOut.cpp.lpc1768.arm.obj).
mbed_test.axf: Error: L6218E: Undefined symbol mbed::Base::Base(const char*) (referred from DigitalOut.cpp.lpc1768.arm.obj).
mbed_test.axf: Error: L6218E: Undefined symbol mbed::Base::~Base() (referred from DigitalOut.cpp.lpc1768.arm.obj).

Usually when I include libaries it just works.  It looks like the .objs are confusing the linker as there are interdependencies in the symbol names.

 

Hint to Keil folks who may be watching.   As soon as I can demonstrate this working to my project manager, we will be buying seats (if this gets anyone motivated to help)!!

19 Feb 2010

I think you probably also want capi.ar from SVN (and the top level object files as well).

19 Feb 2010

Hi,

Sorry for the delay in replying; v. busy day!

The .ar file is a file created by the arm librarian program armar, which is basically a collection of .o files packaged as a library. You just include .ar files in the same way as .o files when you link. For more details on armar, see:

Here is a basic test example program that should build in Keil:

Hope that helps you get going.

Simon

21 Feb 2010

THanks!  This did the trick.   Keil's way of specifying libraries to link against seemed odd to me (The box was called Additional Control Codes or something ridiculous like that!).

 

 

22 Mar 2010

Hi Eli,,

 

Can you please let me know that you are using a complete version or evaluation version of keil.

07 Apr 2010

Complete.  But it should work with the eval.

31 Aug 2010 . Edited: 31 Aug 2010

Hello,

 

I tried the project provided by Simon Ford with Keil Eval, and it's works.

I am now trying to port it in Red Suite 3.

I created a new project and include all the .h, .o .ar and tuned the compiler and the linker.

Now the compilation is OK and the link is near OK, but i have an error at the end of link (in fact i hope it's the end) :

c:/code_red/redsuite3_3.4/tools/bin/......./ld.exe: test.axf: hidden symbol `__main' isn't defined

__main should be managed by libc and Red Suite provide a kind of libc called NewLib, but i am not able to have an idea on how to fix this problem.

Some help is appreciate :-)

Regards.

 

Patrick

16 Sep 2010

hi patrik,

can you export your test projekt and send me a copy?
i do have red suite 3.

what you describe is fixed soon, hopefully.

regards
robert

18 Dec 2010

 

I have been using Simon Ford "Hello World Project" for Keil but it would be nice if it is update it.

I'm having an issue with CAN attach function. It works fine in mbed.org but I get this message from Keil

mbed::can has no member "attach"

and I'm assuming that the library provided does not support attach.

Any comments are welcome.

Thanks

 

JC

19 Dec 2010

Found the latest  files at the /trunk directory (*.ar, *.o, ...)..

Have not tried the CAN.attach function yet but at least it compiles.

04 Jan 2011 . Edited: 05 Jan 2011
user Mike Sheldon wrote:

I'll create a zip for you if you like, what processor are you targeting? Also what's your e-mail address? (I don't feel I should host a copy of the mbed object files on my own vaguely public server)

Hello Mike,

Could you please send me a copy of the zip file? I am trying to run the program on evaluation board(MCU:LPC1766) with KEIL.Thank you for your help.My e-mail address: shwangjiaqi@hotmail.com.

Best regards,

Jiaqi Wang

16 Jan 2011

All Check this app note

http://www.keil.com/appnotes/files/apnt207.pdf

22 Jan 2011

Hello Some one can give me information how we can update all mbed files for Keil project without to have to click on all files to download ? Is ther à ZIP file containing new files version of mbed.

Regards

23 Jan 2011

All check this page http://www.keil.com/appnotes/docs/apnt_207.asp

here is the link for app note PDF http://www.keil.com/appnotes/files/apnt207.pdf

here is the link for the ZIP file http://www.keil.com/download/files/apnt207.zip

I hope this help

24 Jan 2011

I tried to load mbed project into keil, it worked.Hope to master more development info through this forum.

10 Feb 2011

Hello all,

I imported the "mbed.lib" to keil, but I couldn't import "User's made" library to my project. Is there another way to import them? It gives me errors such as: 'identifier "xxx" is undefined' and 'class "xxx" has no member "xxx"', but just in user's made library, not in the mbed.lib. Can someone help me? I don't know keil very well too, it might be part of the problem.

Thanks in Advance,

11 Feb 2011

Same here, the user libraries are not imported. How to go about this issue ?

11 Feb 2011

Hi,

If you click on the library in the compiler, there will be a link through to its homepage on the mbed website in the right pane. Go there, and you should find a download link.

Hope that gets you running!

Simon

11 Feb 2011

Ok, I got the libraries, but still can't use it on Keil. I did the "tutorial" to import the 'Hello_world' project to keil, and it worked. But i can't import another library, just the mbed.lib (that came with the project). I tried to put the *.cpp and *.h files inside the "mbed" folder, but got the same problem.

11 Feb 2011

I downloaded the EthernetNetIf library, included the relevant header files but the compiler says it cannot understand the format of EthernetNetIf.lib library

11 Feb 2011

If i exclude the mbed.lib and EthernetNetIf.lib files from build, it gives this error linking... .\build\UDPSocket.axf: Error: L6218E: Undefined symbol EthernetNetIf::setup(int) (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol EthernetNetIf::EthernetNetIf(IpAddr, IpAddr, IpAddr, IpAddr) (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol EthernetNetIf::EthernetNetIf() (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol Net::poll() (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol IpAddr::IpAddr(unsigned char, unsigned char, unsigned char, unsigned char) (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol UDPSocket::setOnEvent(void(*)(UDPSocketEvent)) (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol UDPSocket::bind(const Host&) (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol UDPSocket::sendto(const char*, int, Host*) (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol UDPSocket::recvfrom(char*, int, Host*) (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol UDPSocket::UDPSocket() (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol UDPSocket::UDPSocket() (referred from udpsocketexample.o). .\build\UDPSocket.axf: Error: L6218E: Undefined symbol IpAddr::operator [](unsigned) const (referred from udpsocketexample.o).

11 Feb 2011

Hi,

The .lib files in an mbed program are simply a text file containing a URL, which points to a location on the mbed website. They do not contain any of the library themselves. You can open them in a text editor and see the URL they contain.

The URL location will point to an mbed program or library hosted on the mbed website, where all the files for that library are stored. When you are using the mbed compiler, it will automatically fetch the files from this location for you, and build them as part of your program.

If you are using another tool such as Keil, you will have to fetch these library files yourself by visiting the URL, and downloading the files (either from svn if it is a svn repository, or as a zip if it is a published program/library). You can then manually include them as part of your project.

Simon

11 Feb 2011

I can compile the simple hello world program, but the udp socket example which includes EthernetNetIf library fails to build. Simon, i did not understand what you were trying to say. I have downloaded the user library, but it gives the error while linking if i remove the libraries from my build

11 Feb 2011

Simon, i am able to add all the user libraries header files as well, but then the above error while linking appears. What could be the reason ?