4

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:

  1. 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.
  2. 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).
  3. 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.
  4. 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.

4

1 回答 1

2

使用 CMSIS 的 IMO 嵌入式项目应包含使用的版本。CMSIS 不像 C 标准库那样标准化,而且新版本通常与旧版本不兼容。

链接的帖子已有 12 年历史,并且(IMO)回购的规模远没有当时那么重要。现在嵌入式程序员使用的计算机的存储、内存、计算能力和上行连接带宽都比不上12年前的计算机。

于 2020-02-01T11:07:00.187 回答