The impacts of using libraries in firmware development


I am a person who loves Open source and freedom software since I am young! I know the meaning of open source libraries, and the feelings of share the solutions together to move the next stage of technology, in this article I will talk against my feelings for open source libraries, I will critic the use of these libraries to developing the firmware of products. 

The growth of electronics consumption for the last 20 years affected the availability the development tools for the hobbyist's people (The backend power of the technology). Today, many development tools are low-cost and easy to use, for anyone who wants to make a new device or solution for anything (DIY)! But can this change the professional world? 

Before making thinking decisions, we need to know the impacts of using the libraries, hardware circuits, and anythings that hobbyists create on the professional world. When I write this note, I am an Embedded system engineer & Software developer, I will talk only about the impacts of using libraries in the development of the firmware of the products and devices, I hope other people from other fields take a look at the impacts of using other hobbyists things (like libraries) in their parts of their field. I will give general ideas but also examples from my engineering life to be clear.  

What do you do if you want to receive an IR signal (signal receivers, decoder, etc.) from Remote control for the next TV products of your company? from where you start, depending on the task time and other things, we can say that you will start from your best search box (DuckDuckGo, Google, ...) and search about IR receive library for your microcontroller/processor/SoC, that's good! What if you have an old remote control, and you want to adapt it to your new TV products, so you need to define it (define the keys), it is greater if you have a document about this remote, but what if you do not have it? for this problem, and depend on the time you will use old code to define the codes, or using a speed prototyping board (like Arduino boards) to receive the codes, and define the remote control keys to adapt it to your next part of IR receive; If you use Arduino and search about the library for IR receiver to define your remote control you probably use IRremote library, you trust this library because the developers say that support multiple protocols and has excellent reviews! Is this ok? non this is not ok!, I have remembered this scenario for my last IR remote controller prototyping, I have using an oscilloscope to define the protocols that a specific IR remote control using, someone suggests to me to use Arduino with IRremote to define it! I take a look, it gives me the protocol type, but when I test to define the HEX code it gives me just part from the code (7 from 9 codes), and it has lost the other codes! For me, it is greater that someone thinks to make an excellent remote control receiver for Arduino board, but we can not use it in the professional life because we will be working with the limitations of this libraries, this example can give you ideas about the impacts of using libraries when you debugging, and you can see that it is so dangerous to use libraries from hobbyist to debug somethings need precision, in communication try to see the signals before trying to debug your code or hardware with a fast prototyping board with a library, the developer of the library can make the library for specific cases and can give you a wrong idea about what is happening without you know that! but what does happen if you implement a code based library codes?

If you implement a code-based library code, we can talk of moving the limitation of this library to your firmware! I have remembered when I test a sensor by Arduino and get a suggestion to move the code directly to the main microcontroller (I like to implement my code). For me this is so dangerous, I take a look at the datasheet of the sensor and I found that there are register can call it and give you an idea if the sensor is connected correctly with your microcontroller! the person that writes the code for Arduino did not write it, but when you have a complex system that needs to check the sensors (this may be in the norms), you will found you with a problem, and you will return to read the datasheet of the sensor or think again for other solution! why are you losing time? why do not you read the datasheet from the beginning? and then you can use any prototyping board you like (Arduino, STM32, ESP32, etc).

Using "non-native libraries" can be very dangerous for your firmware, your imagination will be limited by libraries codes not only by your board's limitations!. I have used here the new term "non-native libraries", which means that the library did not create by the founder of the board. The different in Embedded systems between the libraries created by the founders and the other is that the founders know the architecture of the system very closely (microcontroller, sensor, etc.), so the native library is very close to the limitation to the board limitation (that not very true if system based to another system, so if a company develop a processor-based ARM). If you want to use non-native libraries on your firmware, try to take your time to analyze it, do not move the algorithm or codes directly to your firmware! read the datasheets! try to work from the correct base, do not think that you will lose your time if you use anything directly, something works it does not mean that Is correct, and do not has deep bugs.

There are two microcontrollers that I have seen it has great native libraries that you can use to implement base things (UART, I2C, ADC, etc.), the first is ESP32/ESP8266 (my love 💗microcontroller ) from Espressif systems (see espressif docs), and second is Renesas family microcontroller (see Applilet tool). I hope other companies think about this problem, if you develop a new sensor/board/microcontrollers, or other things, try to create a software API (libraries) to develop the basic things, engineers and developers will use your board/sensor to give a technic solution for a problem, the main problem is not to create for example UART but to use UART to create solutions. 

No comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel