Содержание
Настройка Keil uVision для работы с Git
Страница в РАЗРАБОТКЕ! Если вы видите, что можно добавить или изменить, добавляйте без сомнения!
Эта заметка написана на основе Application Note 279: "Using Git for Project Management with uVision". (Можно считать ее вольным переводом «близко к тексту»)
Все, о чем пойдет речь, проверялось на Keil RealView Microcontroller Development Kit v4.72a
Предисловие
В настоящее время, командная работа стала основной в области разработок для микроконтроллеров. Часто команды, работающие над проектом, являются распределенными географически и в разных часовых поясах. Синхронизация процесса разработки является основной задачей руководителей проектов. Т.к. эта задача не может эффективно решаться с использованием, например, пересылки рабочих файлов по электронной почте, в таких случаях используются Системы Контроля Версий - Software Version Control Systems (SVCS). Раньше были популярны централизованные системы Concurrent Versions System (CVS) and Subversion (SVN) использующие инфраструктуру с центральным выделенным сервером. В настоящее время, все большую популярность набирают распределенные системы контроля версий. Одна из них называется Git.
В этой заметке описано как интегрировать Git в µVision и как организовать процесс разработки ПО с помощью этой VCS.
Введение
Revision control is being used for a couple of years now in software development.
In the past, centralized server infrastructures have been used to track the changes in the source code of a microcontroller development project. With the release of Git, decentralized VCS have become more and more popular.
Git, which is free software distributed under the terms of the GNU General Public License, was developed for maintaining the Linux kernel. It became more and more popular and is now the de-facto standard in source control management (SCM), another term for VCS.
This application note assumes that you have installed Git on your PC (refer to Appendix A: Software) and do know how to use the Windows command shell (cmd.exe).
Workflows
Using Git, you can make use of various workflows when maintaining a software project:
- Centralized workflow as known to users of CVS and SVN
- Feature Branch workflow that adds a branch for every feature that is to be developed to the master branch
- Gitflow workflow using specific roles to different branches such as develop, feature, and release branch
- Forking workflow that is a truly distributed workflow in the sense that every developer has his own fork of the master branch and only one project maintainer is accepting commits to the master branch
This application note explains how to use µVision in a centralized workflow environment. Other workflows can be realized as well using a mix of Git commands from within µVision and using the command line/GUI. For more information on workflows, see Appendix B: Links.
Centralized Workflow
In a centralized work environment, there is usually a single collaboration model: the centralized workflow. A central repository accepts code changes, and every developer synchronizes his work to it. This is just like using SVN for example. However, using Git has a few advantages over the traditional SVN workflow.
First, it gives every developer an own local copy of the entire project. In this local environment, each developer can work independently of all other colleagues. The local repository is used for commits and they can completely forget about the original one until it's convenient for them.
Second, all developers can use Git’s robust branching and merging model. Git branches are designed to be failsafe when adding code and sharing changes between repositories.
The centralized workflow uses a central repository serving as the entry point for all project changes. The default development branch is called ‘master’ and all changes are committed into this branch. No other branches are required by this workflow:
Using Git with µVision
Project Files under Version Control
Before setting up the workflow, the project manager should be absolutely clear about the files that need to be version controlled. Of course all source code files need to be versioned, but there are a couple of files that are special to µVision that need to be monitored as well.
- All user generated source files (*.c, *.cpp, *.h, *.inc, *.s)
- Project file: Project.uvprojx (is used to build the project from scratch)
- Project options file: Project.uvoptx (contains information about the debugger and trace configuration)
- Project file for multi-project workspaces: Project.uvmpw
- Configuration files for the run-time environment that are copied to the project (all files below .\RTE)
- List of #includes created by software components: RTE\RTE_Components.h file
- Device configuration file: for example RTE\Device\LPC1857\RTE_Device.h
- Linker control file (Project.sct) if created manually
- All relevant Pack files (for example ARM::CMSIS, Keil::Middleware, Device Family Packs, etc.)
Files that do not need to be monitored
- Project screen layout file: Project.uvguix.username
- All files that are part of a Pack (the complete Pack will be revision controlled and is available to every user as soon as he is installing it using Pack Installer)
- Generated output files in the sub-directories .\Listings and .\Objects
- INI files for debug adapters
Configure µVision’s SVCS
Before using Git for SCM, you need to configure µVision’s software version control menu. µVision 5.15 is providing a SVCS template file for Git. It resides in the installation directory (for example C:\Keil_v5\UV4) and is called GIT.SVCS. For versions previous to 5.15, please use the file as it is provided in this application note’s ZIP file and copy it to the µVision installation directory. Или скачать его у нас: git.svcs.rar
- Open µVision and go to SVCS → Configure Software Version Control…
- When done, press OK. Now, µVision is ready to use Git as the version control system.
Accessing µVision Project Files
When working with the SVCS menu, you can usually access files that are highlighted in the Project window of
µVision. For example, if you are clicking on the File Blinky.c in the Project window and you then go to the
SVCS menu, you will see the SVCS options for the Blinky.c file:
To catch µVision’s project related files (uvmpw, uvprojx, uvoptx), click on the following (or equivalent):
- WorkSpace → uvmpw
- Project → uvprojx
- Target 1 → uvoptx
Version Control of Software Packs
Centralized Workflow Example
Initialize the Central Repository
Clone a Repository from a Server
Feature Work
Manage Conflicts
Conclusion
Appendix A: Software
To be able to use Git on a Windows PC and from within µVision, you need to install the following software:
- Git for Windows: https://msysgit.github.io/
- For MDK versions below 5.15, you need to add the µVision SVCS template file for Git which is part of this application note’s ZIP file: www.keil.com/appnotes/docs/apnt_279.asp
Please copy the file to the µVision installation directory, for example C:\Keil_v5\UV4
Appendix B: Links
- Git: http://git-scm.com
- Git Book: http://git-scm.com/book/en/v2
- Possible Workflows: www.atlassian.com/git/tutorials/comparing-workflows
- Migrate from SVN to Git: www.atlassian.com/git/tutorials/migrating-overview
- More information on Git replacing LF with CRLF: http://tinyurl.com/q3y7ohx
Обсуждение