3 years, 2 months ago.

How does mbed work


I am new to mbed and I want to thoroughly understand how it works. When I compile a program I see that it compiles a bunch of files and then links them. Can I get any further details? Is there a verbose flag or something? Are there any papers on detailed working of mbed?

Also why does it compile and link so many files if I only want to blink an LED?


2 Answers

3 years, 2 months ago.

How it compiles and links is standard c / c++, any tutorial on the subject will do, they all work in the same basic way.

Why so many files? The mbed libraries take the mbed API function calls and convert them into the correct hardware commands for the device you are targeting. This is called hardware abstraction, you take the nasty implementation details and wrap them in a layer of software that takes care of things for you. Once that's written you don't have to worry about the details anymore. Some of the functions within mbed have a couple of layers of abstraction on top of each other. e.g. Serial is based on RawSerial which is then calls the correct uart driver for the part you are using. Generally each piece of hardware will have it's own files e.g. uarts are in one set of files, GPIO in another, SPI in another etc... You end up with a lot of different files.

But most of them only have to be compiled once. Generally the compiler is smart enough to realize that the library files haven't changed between compiles and so the second time it doesn't compile them again, it just has to link in the results from the previous compile.

So if I am using only one component of the board, it would still compile the libraries for all other components as well? Or just the ones it needs to light the LED?

posted by Tehreem Fatima 09 Oct 2018
3 years, 1 month ago.

Programming is a difficult topic to master. Given its wide range and variety, it is important that they can be used in a number of places. So students should get a fair idea of this topic. With myhomeworkhelp programming homework help they can understand basics and other facets as well. https://myhomeworkhelp.com/programming-languages-homework/