ConnectivityFoundry / AwaLWM2M

Awa LWM2M is an implementation of the OMA Lightweight M2M protocol in C.
BSD 3-Clause "New" or "Revised" License
102 stars 66 forks source link

Question about building only lwm2m static client #330

Closed cobynano closed 7 years ago

cobynano commented 7 years ago

hello,

I'm new to AWA and I'm trying to get the smallest footprint needed for the lwm2m client. I've gone through and removed the deamons from my awa directory and I see that the dependency is there for the xml files, so I've put those back in and removed everything else. I am also stripping out the api directory from anything that references the server.

I'm not sure if there's an easier way to build a small footprint of the lwm2m client. Also, I'm not quite sure if there's a strict dependency on xml and why that would be. I have a feeling that's the reason why I get a 500KB client everytime (because of the xml). I'm not building tests or anything extra.

Any guidance on how I can do this easily and the right way would be greatly appreciated? If this is not the correct place to address this, please let me know of other ways to ask these questions.

Thanks, Maya

seank-img commented 7 years ago

Hi Maya,

Have you followed the Awa Static API tutorial? The Static API library referenced in the tutorial should be the bare minimum to support the Static API LwM2M client (without libxml). The executable created by the Static API tutorial should be small.

FYI, If you want to know the source files to build the bare minimum to support the static client, have a look at the files listed in the Makefile.client and Makefile.common Makefiles for contiki. These are the files used to build our Contiki static client, which should be small. Libxml is not used with the contiki static client. Makefile.common contains the sources for network and coap abstraction for the platform (network_abstraction_contiki.c and coap_abstraction_erbium.c for contiki).

cobynano commented 7 years ago

Hi Sean, Thanks for the response. I have followed the awa static API tutorial but I wasn't sure if that was building the smallest footprint. When I look at the output, it's about 600kB for that static-client-tutorial.minimal-net application. I'm assuming it is pulling in the static lib which is quite bit (500KB roughly) is what I'm seeing. Is that correct? Is that the minimal footprint?
Also, are you saying that if I pull in all the files in Makefile.client and Makefile.common and Makefile.erbium, into my own environment, that would be enough to build the most minimal client? Based on the informaiton I have, the contiki build system will pull those files in and build the application there, but, there's nothing that's defined to build the lwm2m client as standalone with a minimal footprint without going through contiki? Thanks Maya

datachi7d commented 7 years ago

Hi Maya,

I've created a pull request (#332) with a release option to the build - on my system the static client library was ~500kb with all the symbols/debug, but now is now ~200kb with no symbols/debug and size optimization. Once #332 is merged you should be able to use make DEBUG=0 to build a release version. Hopefully this will get you a smaller footprint.

Yes the files in Makefile.client, Makefile.common and Makefile.erbium are the minimum source code required to build a LwM2M client that provides the Static API. As per my previous response (from my other account) there are a few platform specific files in there. For contiki they are lwm2m_util_contiki.c and network_abstraction_contiki.c. There are Linux versions, which are lwm2m_util_linux.c and network_abstraction_linux.c.

boyvinall commented 7 years ago

Hi @cobynano, I just took a look at Sean's changes, which look good. I've merged #332 now, so I'll close this issue - but please re-open if you still have trouble with this.

cobynano commented 7 years ago

Hi @seank-img, @datachi7d. Thank you for the feedback and for the pull request. That's great. Much appreciated.