git - Should CMSIS libraries be included in version control?
问题描述
Normally, I used to include device specific headers & sources provided by the chip vendor (ST) and CMSIS-Core headers in version control. There are not many of them and I didn't have a habit to update them. I use STM32 microcontrollers, but I don't use the CUBE framework or the Standard Peripheral Library.
Recently, I needed to use CMSIS-DSP libraries. CMSIS-DSP library comes with a large number of header and source files. I decided to use the precompiled library (libarm_cortexM4lf_math.a), which is around 5.4 MB. But now I started to question if they should go into the version control.
I know that managing the binary files in version control isn't a good idea. But as far as I know, CMSIS is not updated very often. So I'm confused. These are the options I can think of:
- Include CMSIS headers and static binaries in repo: It may be good idea if I decide not to update these libraries. CMSIS itself doesn't get new releases very often and even if a new version is released, it may not be necessary to update it in the project. Or I may skip a few releases before I update it in my project.
- Include CMSIS header and source files in repo: Similar to option 1, but git will be happier to work with text files instead of a 5+ MB binary. But I'm not sure if letting 3rd party code changes to contaminate my source history is a good idea (Option 1 suffers the same problem, but header files only).
- Don't include CMSIS in repo: This results in a clean repo, but then I have to manually copy library files into project directory after cloning the project. I can also specify a system wide installation folder for CMSIS and add it to the project but it causes a "works-on-my-machine" situation.
- Find a way to fetch the library automatically: The first thing comes to mind is git submodules. However, I'm not sure if fetching the whole CMSIS repo will work, because I need to restructure it as there are lots of unneeded files, including precompiled binaries. I guess I need some kind of post processing script?
What is the best approach here? Can there be other options?
There is a similar question here: Storing third-party libraries in source control It seems people have different opinions about the subject. But I believe using CMSIS in an embedded C project is a specific case and deserves its own question.
解决方案
使用 CMSIS 的 IMO 嵌入式项目应包含使用的版本。CMSIS 不像 C 标准库那样标准化,而且新版本通常与旧版本不兼容。
链接的帖子已有 12 年历史,并且(IMO)回购的规模远没有当时那么重要。现在嵌入式程序员使用的计算机的存储、内存、计算能力和上行连接带宽都比不上12年前的计算机。
推荐阅读
- assembly - Check that register is a negative 4 bytes value in NASM
- javascript - Page refresh displays entire localstorage object
- html - 如何将div堆叠在一起?绝对位置不起作用
- c# - 从 Razor 视图返回列表到操作
- objective-c - 在 ObjC 类别中声明属性会覆盖在公共接口上声明的同名属性吗?
- reactjs - 组件的渲染方法应该有返回类型 React.ReactNode 还是 JSX.Element?
- angular - 在多个 MatSelect 中,重新启用的复选框显示为已禁用
- javascript - 找到离原点最近的 K 个点 (0, 0)
- php - Laravel: can't login user after revoke token in api testst
- python - 如何使用海龟模块绘制斐波那契数列