Open Source在嵌入式系统开发中的使用
关于Why – 为什么要使用open source software
个人对于open source的接触,是开始于3年前的汽车项目。那么为什么要使用开源的源代码呢?这是我们首先要想明白和思考的问题。
直接的回答是,站在巨人的肩膀上。也许不是巨人,但至少是前人的肩膀上。开源软件一般都有社区维护,贡献者众多。也汲取了大家的智慧。另外还有,可以缩短开发的周期;免费也是一个原因,可以降低初始阶段开发成本。但需要注意的是,在决定开源代码的选择时,就不在是免费的了。后续就需要持续的开发投入了,还包括培训和维护。
当然,开源代码也有些弊端。对于维护状态活跃度不高的开源项目,基本没有后期的维护。并且缺少必要的相关技术文档。对于有持续演进和维护的软件来讲,这两点是比较重要的。
Anyway, 总的来时是利大于弊的。通过在开源社区的项目观察,可以看出。软件的开源,开源社区的管理,于开源社区的合作这两年正在中国如火如荼的开展着。之前听说,有的高校会有open source/open source community的相关专业。
本人用的比较多的开源代码托管服务平台,一个是国外的github(发现国内打不开了); 一个是国内的gitee.
关于How – Selecting the right open source Component
知道了开源软件的好处,那么我们应该怎么做来选择合适的开源软件呢。
Kepner Tregoe(KT) Matrix 提供了一种step by step的从,
- Situation appraisal – 状况评估
- Problem Analysis – 问题分析
- Decision Analysis – 决策分析
- Potential Problem Analysis – 潜在问题分析
KT Matrixes 限制了我们在做选择时有意识或无意识的偏见,从而引导我们不偏离我们选着开源软件要实现的主要需求目标。
嵌入式开发常用的开源软件举例:
-
Free RTOS link
Real-time operating system (RTOS) for microcontrollers licensed under the MIT. Supports over 40 different architectures with supporting libraries and integrations.
-
OpenCV link
OpenCV is an open source computer vision and machine learning software library. It is licensed under BSD-3. OpenCV is designed to accelerate the use of machine perception in the commercial products.
-
FatFS link
FatFS is a generic FAT/exFAT filesystem module for small embedded systems. The library is supported by more than a dozen microcontroller architectures and is often integrated in auto generation tools.
-
Yocto link
The Yocto Project is an open source collaboration project that provides templates, tools and methods to create custom Linux-based systems for embedded system deployments
关于What – 使用open source software的具体注意事项
Best Practices - Open Source Software
- Select software that has an active community, not a one-off example.
- Perform a software audit and quality analysis.
- Have the license reviewed by an attorney.
- Use an abstraction layer to remove dependencies.
- Leverage integrated software when possible to minimize issues.
- Build an acceptable testing process to verify the software’s robustness.
- Be extremely careful when upgrading to a new software version
- Carefully read any existing documentation and example code.
- Perform an unbiased analysis to determine if the software is right for you.
- Try it in your target application space before “buying it”.
另外,关于Open Source Architecture Integration有两个注意事项:
Atypical embedded software application
-
Avoid tightly coupling your application code with your libraries
-
We can selectively swap out a component without having to update and change our application code
*Before:
*After: