I have an embedded systems project which needs to be developed and adapted easily for other microcontrollers. There are 3 types of files:
- Type-1: Hardware related files which will be independent of rest of the development like makefile, linker, source file for startup functions. This part of files will start microcontroller and do initial configuration, when new feature is added this part will not get affected very high probability.
- Type-2: Hardware related files which will be developed in time with the rest of the development process. For example calculating CRC, doing encryption and decryption with hardware. Same function name, same input parameters, same output parameter will be used for every hardware, only content of function (module and register names) may vary.
- Type-3: Application files which will be independent of hardware. It will use hardware but with Type-2 files. These part will be 90% of development process.
Let's say we have ST, NXP and Infineon microcontrollers (It can also be same brand different microcontrollers like ST SPC57xx and SPC58xx). We developed project on ST microcontroller and we want to adapt it to NXP microcontroller. We need to get Type-3 files without any change and adapt Type-1 and Type-2 files for NXP microcontroller. I want to find correct development environment and process.
About the folder structure and git repos I imagined something like below:
Project_Folder will have git repo and ignore Sub-folder_1. There will be branches for every microcontroller. When developer checks out any microcontroller branch build environment will be ready.
Sub-folder_2 will have git repo. In the develop branch there will be functions with empty body. There will be branches for every microcontroller. When a developer wants to develop for a new microcontroller he/she will open a branch for it based on develop and fill the functions.
Sub-folder_1 will have git repo and have Sub-folder_2 repo as submodule. There will be develop branch and point develop branch of Sub-folder_2 git repo. There will be branches which will have same Type-3 files for every microcontroller, only submodules will point its own submodule. When a developer wants to add new feature and needs something from hardware he/she will first add empty functions to develop branch of Sub-folder_2 git repo. Then cherry-pick that commit to microcontrollers branch. In this way develop branch of both repos will never have compiling error.
Do you have any suggestions to make folder structure and git repos simpler or safer for developers?
