LDS7000 FIRMWARE VERSION CONTROL
lds7kFwVc.doc
Updated: 2011-11-14
Synopsis: describes the LDS7000 version control design, implementation, and use.
This document contains hyperlinks, which target both local and remote sites and documents. By default, Word requires Ctrl+click to follow a link. You can change to simple click (like browser) by Office button > Word Options > Advanced > Editing Options: uncheck "Use CTRL + click to follow hyperlink". You will also find hyperlink movement easier if you add buttons to Word's toolbar by Office button > Word Options > Customize > Choose Commands From All Commands : Back, Forward, and Document Location.
References:
- [
\\Corpgroup\AUI$\Touch Apps Internal]
- Svn7kFw is our LDS7000 firmware Subversion repository. Don't try to understand anything in this folder directly but only through Tortoise Repo-browser or MIPS-Eclipse. To access it through Tortoise you must open a brute force Windows Explorer window, i.e. through your Computer icon. The Repo-browser does not work if you open a window using a shortcut or link (such as the one here).
- [
content] File: brief description of folders and files in this folder.
[\SwDevDocs\] Folder: software/firmware development documents. Mix of downloaded public domain and internal documents.
- [
Svn7kFwRepo.pdf] Repository schema diagram.
[\SwDevTools\] Folder: Software development programs. Public domain and internally developed programs.
TortoiseSvn User Guide
- [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevDocs\tortoiseSvnGuide.pdf] local
[http://rpg-framework.googlecode.com/files/Tortoise%20SVN%20-%20User%20Guide.pdf]
"Version Control With Subversion" Free online book from O'Reilly
- [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevDocs\subversionOreilly.pdf] local
[http://rpg-framework.googlecode.com/files/Tortoise%20SVN%20-%20User%20Guide.pdf]
Subclipse plugin for Eclipse
- \\Corpgroup\AUI$\Touch Apps Internal\PubDevPgm\subclipse1_6_18 Local "download" source.
- [
http://www.eclipse.org/subversive/] Eclipse plugin for Subversion project home
Tortoise
- [
http://tortoisesvn.net/downloads.html] TortoiseSvn download page.
[http://tortoisesvn.tigris.org/] TortoiseSvn homepage
Subversion
- [
collab.net] Download Subversion command line client and management tools. Requires registration (easy).
[http://subversion.apache.org/] Subversion project home. Transferred from tigris.org (Collabnet).
[http://www.tigris.org/] > [http://tortoisesvn.tigris.org/] [http://subclipse.tigris.org/]
[http://winmerge.org/downloads/] WinMerge download page.
Topics:
- [
Network URL]
[Really Quick Start]
[Subversion, Tortoise, Eclipse]
[Repository Design]
[Tortoise Use] > [Installing Tortoise] [Installing WinMerge] [Tortoise Tutorial] [Tortoise Notes] [Tortoise And Eclipse]
[Subversion In Eclipse] > [Installing Subclipse] [Project Configuration] [Subclipse Tutorial]
[Code Base Preparation] > [Project Sources] [Code Preparation] [Post Build]
[Appendix One: Creating the Repository With Tortoise]
[Appendix Two: Creating the Repository With Subversion Commands]
[Appendix Three: Eclipse Configuration]
NETWORK URL
Many of the open source programs are configured to point to a repository URL. Our shared repository is located under "\\Corpgroup\AUI$" (aka "(AUI$)\\Corpgroup") which is not a legal URL. In Windows this must be mapped to a drive letter and this letter used instead. However, there is no agreement on what this letter should be. DJ maps it to S, YB to K, David McCracken to M. Throughout this document, M is used. You should substitute your own mapping.
To determine or set the mapping on your computer, right click "My Computer" and select Map Network Drive.
REALLY QUICK START
This assumes that you have already installed the MIPS Navigator ICS.
Drive M is used here for \\Corpgroup\AUI$. You should use the correct drive letter for your computer.
- Prepare access to internal tools either by copying or adding shared source to path.
- Copy bin2hex.exe, LDS7kCodeSafeEncrypter.exe, and BTTSafe.exe from [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevTools] to your MIPS bin directory (normally c:\mips\NavigatorConsole\bin).
Alternatively, add M:\Touch Apps Internal\SwDevTools to your path.
Install TortoiseSVN.
- Download TortoiseSvn from [
http://tortoisesvn.net/downloads.html].
Install the program from the downloaded msi file.
Install WinMerge.
- Download WinMerge from [
http://winmerge.org/downloads/].
Run the installation program.
Install Subclipse.
- Start MIPS Navigator.
- Help > Install New Software > click Add button.
- Name = Subclipse
- URL = file:///M:\Touch Apps Internal\SwDevTools\\subclipse1_6_18
- Check the Subclipse checkbox but then uncheck the Revision Graph checkbox under Subclipse.
- Click Next and then Finish.
- Restart Eclipse. From Window > Open Perspective > Other, select SVN Repository Exploring to make this perspective a tab along with Debug and C/C++.
Link Eclipse to repository. In MIPS-Eclipse:
- Click SVN Repository Exploring perspective tab.
- Right click in SVN Repository window.
- Select New > Repository Location
- Enter URL = file:///M:/Touch%20Apps%20Internal/Svn7kFw
Check out Unified HEAD.
- Open (expand) file:///M:/Touch%20Apps%20Internal/Svn7kFw in SVN Repository window.
- Right-click (top level) Src.
- Select checkout.
- Replace Project Name EVK0910Rel with Unified (this make project folder Unified in Eclipse workspace).
- Click Finish.
Make Unified debug configuration.
- Click C/C++ perspective tab.
- Select (click) Unified in the Project Explorer window.
- Click the arrow to the right of the bug icon in Eclipse top toolbar.
- Select Debug Configurations.
- Right click MIPS ICS Application
- Select New.
- In Main tab:
- Change Name from Unified Debug to simply Unified.
- In C/C++ Application field type Debug/7kFw.out
- In Debugger tab, change:
- Launch Preset = Advanced
- Reset Action = No Reset
- Set PC to = custom PC/Symbol
- 0x40
- Configuration name = M4K
- Click Scan For Probes and then OK.
- Click Apply then Close.
Build and debug Unified.
- Start DT's GUI [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevTools] LDS7000_DGUI.exe. Type command 52<enter>. Type command 52 2<enter>.
In MIPS-Eclipse, select (click) Unified in Project Explorer window.
Click bug icon. Eclipse automatically builds the executable, loads it into the target, and begins debugging.
Some other good things to look at:
- [
Eclipse Settings]
[\\Corpgroup\AUI$\Touch Apps Internal\SwDevDocs\Svn7kFwRepo.pdf]
[Repository Design]
[Tortoise Tutorial]
[Subclipse Tutorial]
[Code Base Preparation]
SUBVERSION, TORTOISE, ECLIPSE
Subversion is one of the major version control systems in use today, being used on thousands of open source and commercial projects. It is essentially a specialized database manager with a well defined API enabling a variety of user interfaces to be developed by anyone. One UI is the command line client, which is often mistaken as "Subversion" when it is really just the lowest level means of accessing a Subversion database short of writing a program directly to the API. TortoiseSVN provides a GUI interface integrated into Windows Explorer, which makes it very convenient to use. Eclipse Subversive-SVN is a plug-in that serves the same purpose in the Eclipse environment that TortoiseSVN serves in the Windows Explorer environment. All of these UI alternatives are mutually compatible. A Subversion database can be created, maintained, and used by all of them simultaneously.
Many version control systems are designed around the notion of a main trunk of development with occasional temporary branches of development. Subversion is recursive. Any branch can serve as the parent of a new branch, obsoleting the notion of trunk and branch. An original "trunk" may be the focus of most work at first but be eventually superseded as the focus by some later branch. Subversion's recursion makes this infinitely possible without disturbing the existing database design.
Other version control systems capture a version as an operation applied to a code branch. Subversion sequentially numbers every state change of the entire repository, in effect assigning a version number to every change. This could be used to identify released (internally and/or externally) versions on every branch. However, this is potentially confusing because the version number in one branch changes due to code changes in other branches. Subversion supports a more traditional notion of versioning using recursion. To capture a version of a code set, a branch is created from that code set.
There is no difference between a branch created to capture a version and one created to begin a new line of development. Where the limitations of other version control systems implicitly impose order, order in Subversion must be explicitly stated and maintained by the users. Some literature suggests dividing the repository into Trunk, Branch, and Tag folders. Trunk is a folder that contains code under development. Branch contains folders that are semi-independent of the Trunk code. Tag contains version captures. These names are misleading. Everything in the repository is a branch and every branch is potentially a trunk and a branch. Every branch is inherently "tagged".
REPOSITORY DESIGN
SCHEMA
In our repository design, the root and Alt branches represent active alternative program designs. Under each are three folders, Src, Ver, and Alt. Src contains the HEAD revision of the code for that branch. Ver contains version capture branches. Alt contains alternative program designs. Src, Ver, and Alt correspond to the Trunk, Tag, and Branch folders suggested by some literature. Alt is recursive; the root is essentially the top level Alt branch.
Only Src folders contain code under active development. Programmers check out and commit to Src. Since every Alt branch has a Src folder, there can be many semi-independent coding venues. No branch is inherently the "main" one. Any folders under Src are part of the program and not elements of the repository. To capture the current version of the code in Src, the Src branch is duplicated in a new branch under Ver. Ver contains only these branches, which may be given any name but are normally named by sequential number. These version branches are archives; the code files in them should not be modified.
Released programs must be built only from code checked out of a version branch. Typically, a released version represents a static condition that does not change for the life of the project. However, sometimes customers go to considerable effort to qualify and accept a particular version only to find, sometimes after years of deployment, a bug that must be fixed. They don't want to even think about the other changes in later versions that may fix the bug. To address this, the version branch is rearranged. The version node is duplicated to a Src folder under the node (Subversion and Tortoise can do this without infinite recursion) and then all of the code in the version node is deleted. A Ver folder is created under the version node. The new Src folder is duplicated in a new "0" folder under Ver, freeing the code in Src for further development. This extended version folder is similar to an Alt but it does not contain an Alt because it may not be used as the root of alternative program designs. If a new independent line of development is based on an old version, it should be created as a copy of that version in a new Alt branch. This rule is not dictated by Subversion or our repository design but simply reflects standard practice.
Once a version node has been converted from a static archive to an active development venue, it may not revert to being static. Its Src folder is forever active. The conversion procedure is somewhat complicated. It could be simplified by initially capturing into a versionName/Src, e.g. 2.0/Src. However, this would complicate the routine procedure of version capture because Subversion and its clients don't do multi-level copying. The version folder would have to be created and then the HEAD Src copied to a Src folder under it. Tortoise and Eclipse-Subversion provide no means for doing such a multi-step capture procedure.
Alternative branches are derived from some pre-existing code set to support code differencing, sharing, and merging, but they are independent lines of development. The programmers can maintain complete independence if they chose. Each branch under an Alt folder is essentially a new repository, complete with Ver, Src, and Alt folders, except that the first version captured is actually the code of the source branch. The second capture marks the real beginning of the alternative code set.
INITIAL REPOSITORY STATE
The practical realization of this schema is relatively simple. Figure 1 [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevDocs\Svn7kFwRepo.pdf] shows the initial repository state after creation of existing code sets. The "Unified" code set is taken as the baseline. The "Polycom" code set (with two initial subversions) is taken as an alternative line of development. For illustration of the extensibility of the Alt folder, a "Rim" code set is theorized.
The repository begins life with the creation of real directory Svn7kFw at "\\Corpgroup\AUI$\Touch Apps Internal". This is transformed into a Subversion repository (using a command-line or Tortoise function). All of the folders under this are created in the Subversion database and can be seen only through tools like TortoiseSvn Repo-Browser.
The folders Ver, Src, and Alt are created under Svn7kFw. The Unified code set (u0) is copied and committed to the Src folder. Programmers working on the Unified code will check out and commit code only to this folder but first the base code is captured by copying Svn7kFw\Src to Svn7kFw\Ver\2.0. This is now version 2.0 of the Unified code set. The name "U2.0" is used for discussion. It is not part of the database, which identifies the code set as Svn7kFw/Ver/2.0. The program built from this may be released as any name. In the figure, the copy vector from Svn7kFw/Src to Svn7kFw/Ver/2.0 is labeled u0, identifying this particular code set as the initial version of the Unified code.
The folder Polycom is created under Alt. The folders Ver and Alt are created under Polycom. A Src folder is created under Polycom by duplicating either the Svn7kFw/Src or Svn7kFw/Ver/2.0 branch. At this point the two possible sources contain the same u0 code set. Polycom/Src is copied to Polycom/Ver/2.0. This captures the Polycom base code 2.0, which is still the u0 code set.
All of the u0 code files in Polycom/Src are now replaced by the existing PolycomUnified code set (pu0). Polycom/Src is copied to Polycom/Ver/2.1. The figure labels this copy vector pu0, indicating that it is the real initial PolycomUnified code base. For discussion, Polycom/Ver/2.1 is called version P2.1, but this is not recorded in the database.
This process is repeated to capture the Polycom (not Unified) code base. All of the pu0 code files in Polycom/Src are replaced by the existing Polycom code set (p0). Polycom/Src is then copied to Polycom/Ver/2.2. The figure labels this copy vector p0, indicating that it is the real initial Polycom code base. This is called P2.2 for discussion.
The initial release of the Unified program is U2.0. The initial release of the Polycom program is P2.2. Unified programmers may begin changing the code in Svn7kFw/Src and Polycom programmers the code in Svn7kFw/Alt/Polycom/Src without impinging on the released versions or each others' working code. The Polycom code is "derived" from the PolycomUnified code, which is derived from the Unified code only for the purpose of file comparison and merging. Whether, and to what extent, this is actually done is entirely up to the programmers themselves.
The Svn7kFw/Alt/Polycom/Ver/2.0 code is never released. It is the u0 code base, which could have been copied from Svn7kFw/Src or Svn7kFw/Ver/2.0 as well as from Svn7kFw/Alt/Polycom/Src. In fact, it may not be necessary because of the fact that Polycom/Src is created by duplicating Svn7kFw/Src, establishing a file relationship that is probably permanent. However, capturing this as the first version is cheap and ensures a record of the relationship.
REPOSITORY STATE AFTER CODE CHANGES
Figure 2 shows the repository state after code changes (in Svn7kFw/Src and Svn7kFw/Ver/2.0) and subsequent version captures. In the illustrated scenario, a U2.1 version is captured by copying some new code set in Svn7kFw/Src to Svn7kFw/Ver/2.1. Additionally, the released U2.0 has required a correction that could not be accommodated by the U2.1 version. This situation is relatively rare and its occurrence so soon would be unlikely in reality. However, it may happen occasionally. Until this situation arises, Svn7kFw/Ver/2.0 is an inactive archive. To active it, Svn7kFw/Ver/2.0 is first copied to Svn7kFw/Ver/2.0/Src and then all of the code files in it are deleted. Svn7kFw/Ver/2.0/Ver folder is created. Svn7kFw/Ver/2.0/Src is copied to Svn7kFw/Ver/2.0/Ver/0, capturing version U2.0.0, which is identical to U2.0. The code in Svn7kFw/Ver/2.0/Src is then modified and copied to Svn7kFw/Ver/2.0/Ver/1, capturing version U2.0.1.
Figure 2 shows a simpler, and more common, scenario for the Polycom version. After some changes, the code in Svn7kFw/Alt/Polycom/Src is copied to Svn7kFw/Alt/Polycom/Ver/2.3, capturing version P2.3, which is really the first change to the original Polycom (p0) code.
TORTOISE USE
This is a description of using the version control system through the Tortoise interface. Only rudimentary functions are described here. For more information on Tortoise itself see [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevDocs\tortoiseSvnGuide.pdf]
INSTALLING TORTOISE
Download TortoiseSvn from [
http://tortoisesvn.net/downloads.html]. Be sure to get the right file for your OS and computer (32/64). The web site (especially the home page) has some prominent download buttons that are for other things, although this isn't immediately obvious. Install the program from the downloaded msi file. You don't need to install anything else. Tortoise includes the Subversion utilities that it needs.
INSTALLING WINMERGE
The merge and diff facilities built into Tortoise are not as good as the open source program WinMerge. Download WinMerge from [
http://winmerge.org/downloads/]. Run the installation program. Note that the setup program's "Select Additional Tasks" contains an "Integrate With TortoiseSVN" checkbox, which is checked by default. Installing Tortoise before WinMerge simplifies their integration. Unfortunately, Tortoise invokes WinMerge only to compare single files. Tortoise is much weaker than WinMerge in comparing directories but insists on using its own inferior TortoiseMerge program for that.
TORTOISE TUTORIAL
- Copy the shared repository M:\Touch Apps Internal\Svn7kFw to C:\Svn7kFw. This local copy will act just like the shared repository except that you can experiment in it with impunity.
- Create an empty work directory, C:\Work7kFw.
- In Windows Explorer, right-click on C:\Work7kFw. Note that Tortoise has added two items, SVN checkout and TortoiseSVN to the normal popup menu. Move your cursor to TortoiseSVN to open its sub-menu. This contains 7 items, which exist for any folder.
- In Windows Explorer, right-click on C:\Svn7kFw. The popup menu and TortoiseSVN sub-menu are the same as for C:\Work7kFw. The sub-menu contains the item "Create repository here". This would be a legitimate command for the working folder but not for the repository. Select this. Tortoise tells that there is an error. This is misleading. The command is not appropriate for something that already is a repository.
- Right-click on C:\Svn7kFw again and select Repo-browser from the TortoiseSVN submenu. Note the URL file:///C:/Svn7kFw, which Tortoise automatically takes from the folder you clicked on.
- Click on the top level Src branch to see its URL, file:///C:/Svn7kFw/Src.
- Right-click on the top level Src and select Checkout from the popup menu. Type C:\Work7kfw in the Checkout directory field. Click OK. This checks out the HEAD revision of the Unified code set (which is repository revision 13).
- Close the repo-browser. C:\Work7kFw now has a green checkmark. If it doesn't, press F5 to update the display. Tortoise does this to indicate that the checked out files have not been changed.
- Right-click on C:\Work7kfw. The SVN checkout item is gone but two new items, SVN Update and SVN Commit appear. Move your cursor to TortoiseSVN. Note that the sub-menu contains many more items than it did before this folder was transformed into a working directory by checkout. The first item in the sub-menu is "show log".
- While holding down the SHIFT key, right-click on C:\7kfw and move your cursor to TortoiseSVN. Note that the first item in the sub-menu is now "Diff with URL". This lets you compare the files in the working folder to any branch in the repository.
- Select "Diff with URL" from the menu. In the dialog, the default URL is file:///C:/Svn7kFw/Src, which is the same branch that was checked out. Click OK. Tortoise says "No differences found".
- Open the diff dialog (shift + right click) again on C:\Work7kfw. This time, click the browse (ellipsis) button. Repo-browser opens on the default URL and doesn't show the rest of the repository. Click the top item file:///C:/Svn7kFw to show the repository from the top. Select Alt > Polycom > Src and click OK, taking you back to the diff dialog with the selected URL in the edit field. You also could have typed or copied this into the field. Click OK. This opens TortoiseMerge to show the differences between the two branches, which are the HEADs of Unified and Polycom.
- The floating "file patches" window in TortoiseMerge lists the files that differ between the two branches. Double-clicking a file causes the two versions to display side-by-side with differences highlighted. TortoiseMerge is not good for actually merging or editing but it is useful for scanning the differences between multiple files. WinMerge is much better for these operations, especially between folders, but Tortoise refuses to invoke it for folder comparison. Close WinMerge.
- Right-click on C:\Svn7kFw and select TortoiseSvn > Repo-browser. Right-click Svn7kFw/Src and select "Mark for comparison" from the popup menu. Expand Svn7kFw/Alt/Polycom and right click its Src. Select Compare URLs (near the end of the menu). This effects the same branch comparison as in step 12, where the checked out Svn7kFw/Src was compared against the Polycom/Src still in the repository. As in that case, Tortoise lists the mismatched files in a window rather than invoking WinMerge for this but the window is not part of TortoiseMerge. Double-click any file to open WinMerge to compare the two versions. Close WinMerge, the "Changed files" window, and Repo-browser.
- In Windows Explorer, right-click C:\Work7kFw and select SVN Commit. In the "Changes made" window Tortoise tells us that no changes were made. Click OK. Tortoise tells that it is finished. It actually didn't do anything.
- In Windows Explorer browse into C:\Work7kFw. All of the files have green checkmarks, indicating that they are unchanged from what was checked out (Svn7kFw/Src) in step 7. You won't normally see it, but Subversion added a hidden .svn folder for version control information when you checked out the branch.
- Open AFECont.c (any source file would do) with a plain text editor. Type "first change<enter>". Move down a few lines and type "second change<enter>". Save the file. Note that the file's green check mark in Windows Explorer changes to a red exclamation mark, indicating that the file has changed. If it doesn't, press F5 to update the display.
- If your editor creates a backup copy of AFECont.c in the working folder, Tortoise will show it with a blue question mark. If you see this, right click on the file and select TortoiseSvn > Add to ignore list. Select "*.bak" (or whatever the extension is) to exclude all such files from version control. The blue question mark changes to a gray minus mark.
- Right-click on AFECont.c and select TortoiseSvn > Diff. Tortoise invokes WinMerge (if installed) to compare the new version against the version that was checked out. WinMerge identifies the two versions as Working Base and Working Copy. WinMerge highlights all (two) changes. The up and down arrows in the WinMerge menu bar move the focus to next and previous differences. With the focus on the first difference, click the right arrow to replace your change with the base version. Leave your second change. Close WinMerge, saving the file. You don't have to worry about accidentally changing the base version because it is a temporary copy. Tortoise won't let you change the repository.
- Right-click on AFECont.c and select SVN Commit. The dialog now tells that the file has changed. Note that "Commit to" is "file:///C:/Svn7kFw/Src/AFECont.c". In the Message field type "test change". Click OK. This repository change is recorded as revision 14. In Windows Explorer, the file's red exclamation mark changes to a green check mark, indicating that the working version of the file matches the latest commit.
- Open Commands.c in your editor, make any change, and save.
- In Windows Explorer browse up one level (to C:\). C:\Work7kFw now has a red exclamation mark, indicating that the entire branch has changed (it would also have this mark if you had excluded bak files). Right-click on C:\Work7kFw and select SVN Commit. The commit dialog now lists the modified file, Commands.c. Double-click on Command.c to open WinMerge, which compares the new version, "working copy" to the old, "working base". Close WinMerge. If only this file is listed in the changes list then click OK to commit it. However, if you have added "*.bak" to the exclusion list, Tortoise will also list the working folder. If this is the case, you need to update the working folder and then commit it. This can be done before or after committing the file. Right-click on the working folder (or inside it) and select SVN Update (this will not change any files that you have modified). Then right-click the folder again and commit it.
- C:\Work7kFw now has a green checkmark, indicating that it is the same as the checked out folder, C:/Svn7kFw/Src, which is the Unified code HEAD. You can't simply ask the repository "What I have done?" without telling the starting point. We happen to know that the repository revision was 13 when we did the checkout (step 7). Shift+right-click on C:\Work7kFw and select TortoiseSvn > Diff with URL. The dialog automatically shows the checkout source, which we want, but also HEAD revision, which is what we are. Change this to revision 13. TortoiseMerge tells us that the two files have changed. Double-click each file to see the specific differences. Close TortoiseMerge.
- It is a good idea to make a note of the repository revision when you check out the HEAD of a branch, but usually we compare the current code to the last captured version, in this case Svn7kFw/Ver/2.0. Again, open the Diff with URL but, this time, change the URL from C:/Svn7kFw/Src to Svn7kFw/Ver/2.0. TortoiseMerge shows the same differences as when you compared to revision 13 because revision 13 of the Unified HEAD is identical to version 2.0.
- To capture the current code set as Unified version 2.1, right-click C:\Work7kFw and select TortoiseSVN > Branch/Tag. The Copy (Branch/Tag) dialog tells that the source is file:///C:/Svn7kFw/Src, i.e. the Unified code source. This cannot be edited but you can select HEAD or an earlier revision. "To URL" is the same. Change this to "file:///C:/Svn7kFw/Ver/2.1" and click OK.
- Right-click on C:\Work7kFw and select TortoiseSVN > Repo-browser. Expand Svn7kFw/Ver to see the new 2.1 folder. Right-click on this and select Mark for comparison. Right-click the 2.0 folder and select Compare URLs.
- Figure 2 in [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevDocs\Svn7kFwRepo.pdf] describes a scenario in which you find that you have to return to a previous release to correct a bug. In your repository now Svn7kFw/Ver/2.0 is an inactive archive. You need to activate it before changing its code. Right-click C:\Svn7kFw (this could also be done through your working folder C:\Work7kFw) and select TortoiseSvn > Repo-browser.
- Expand Svn7kFw/Ver to expose 2.0. Right-click on 2.0 and select "Copy to". Change the "Copy to" from "file:///C:/Svn7kFw/Ver/2.0" to "file:///C:/Svn7kFw/Ver/2.0/Src". Type Message "Activating 2.0 for correcting a bug for important customer".
- Delete all of the code files (not Src folder) in Svn7kFw/Ver/2.0. This is just like a group delete in Windows Explorer; click on the first file, ".cproject"; press and hold shift while clicking the last file, "type.h"; press Delete. You don't need to provide a message for this.
- Right-click Svn7kFw/Ver/2.0 and select Create Folder. Name this Ver. A message isn't needed.
- Right-click Svn7kFw/Ver/2.0/Src and select "Copy to". Change the destination from file:///C:/Svn7kFw/Ver/2.0/Src to file:///C:/Svn7kFw/Ver/2.0/Ver/0. Message is "Unified code version 2.0.0". Close Repo-browser.
- Delete C:\Work7kFw and make the folder again. This is the easiest way to delete the hidden .svn file. Right-click C:\Work7kFw and select SVN Checkout. Type or browse to make URL source file:///C:/Svn7kFw/Ver/2.0/Src. Make the destination C:/Work7kFw. You are now ready to begin correcting the 2.0 code base. Only the Svn7kFw/Ver/2.0 branch will be affected by any commits from this working folder. When you are ready to capture a version, make it Svn7kFw/Ver/2.0/Ver/1, which is version U2.0.1, as shown in figure 2.
When multiple programmers are working on the same branch of code, they may commit changes that affect each other. To simulate this situation, make two new folders C:\Work1 and C:\Work2. Right-click on each of these in turn, select SVN Checkout, and check out file:///C:/Svn7kFw/Alt/Polycom/Src. This simulates two users working simultaneously working on the Polycom HEAD code.
In Windows Explorer, browse into C:\Work1. Open AFECont.c with your editor, type work1 change<enter>, and close-save the file. Right-click on the file and select SVN commit. Message is "work1 change". Note change from red exclamation to green check on the file.
The AFECont.c in C:\Work1 now matches the HEAD of Polycom. However, the copy in C:\Work2 is still the original. In fact, nothing happens in C:\Work2 to even suggest that a change has occurred. The programmer in C:\Work2 should occasionally check for changes in the shared branch.
In Windows Explorer, browse into C:\Work2. Right-click on nothing and select TortoiseSVN > Check for modifications. This initially shows the files that have been modified in C:\Work2. Click the Check Repository button to compare the files in C:\Work2 against the repository HEAD of this branch. Only AFECont.c is listed. Double-click this to open WinMerge to show the detailed differences. The working copy, i.e. from Work2, is shown on the left, and the "Remote File" on the right. You can merge from right to left and you can edit left but anything that you to the right file will be discarded. Close WinMerge.
In C:\Work2 open Commands.c with your editor and type "work2 change<enter>". Close/save the file. Again, right-click on nothing and select TortoiseSVN > Check for modifications. This time, Commands.c is listed. Click "Check Repository". Both Commands.c and AFECont.c are listed. Note that Text status is "normal" for AFECont.c but "modified" for Commands.c. That is, AFECont.c has not been modified in Work2 but Commands.c has been. Similarly, the remote text status of AFECont.c is modified. Close the dialog.
Click on nothing in C:\Work2 and select SVN Commit. Again, right-click on nothing and select TortoiseSVN > Check for modifications. Now, only AFECont.c. Only the Commands.c file changed in Work2 has been committed. Work2 has not be updated.
Right-click in C:\Work2 and select SVN Update. Check again for modifications against the repository. This time none are listed. SVN Update replaced the AFECont.c file in Work2. Close the dialog.
In Windows Explorer, browse to C:\Work1. Check for modifications against the repository. Note that its Commands.c is now listed. Close the dialog. Right-click on nothing and select SVN Update.
In C:\Work1, open AFECont.c in your editor. Type "One<enter>". Close-save the file. Commit it.
In C:\Work2, open AFECont.c in your editor. Move to line 3 and type "Two<enter>". Try to commit it. The commit fails. The error message from Tortoise says that you must first update your working copy. Cancel/close the commit process. Right-click on nothing (in C:\Work2) and select SVN Update. Open the file again in your editor. It now contains the changes from both Work1 (already committed) and Work2 (not yet committed). Try again to commit from Work2.
In Work2 open AFECont.c again in your editor. Type "Three<enter>" on the first line. Close-save. Commit.
In Work1 open AFECont.c in your editor. Type "Four<enter>" on the first line. Close-save. Try to commit. Again, Tortoise tells you that you have to update. Right-click on nothing and select SVN Update. This time the update fails. Tortoise says that AFECont.c is in a conflicted state. This means that the two versions (one in repository and the other in Work1) have a conflict that cannot be automatically merged. Close the dialog. Tortoise has created three new files, AFECont.c.mine, AFECont.c.r27 and AFECont.c.r29 (your revisions numbers may be slightly different). Open AFECont.c in your editor to see:
<<<<<<< .mine
Four
=======
Three
>>>>>>> .r29
TortoiseMerge has converted your file to a conflict resolution form. AFECont.c.mine is a copy of the file that you had tried to commit. AFECont.c.r27 is the file originally checked out into Work1 and AFECont.c.r29 is the file that Work2 had committed.
- If the conflict is complex, it is most easily resolved using WinMerge. In Work1, right-click on AFECont.c.mine and select WinMerge. AFECont.c.mine is automatically the Left file. Type AFECont.c.r29 for the other. Pick one or the other to update to the merged version. Keep in mind that the programmer in Work2 expects the file to be AFECont.c.r29. To complete this process you would save the merged-to file and rename it AFECont.c after first deleting the file of this name created by Tortoise. Don't do any of this now. Just close WinMerge.
- A simple conflict like this is more easily resolved by editing the merge file. Open AFECont.c in your editor and replace the conflict with "Three Four". Close-save the file. Note that Tortoise automatically deletes the other files that it made when you follow this procedure to resolve the conflict. Retry your commit.
Imagine that you have committed a file one or more times only to realize that you are pursuing a dead-end and want to revert to a previous version. Tortoise seems to support this but it really doesn't. In C:\Work1 (in Windows Explorer) right-click on AFECont.c and select TortoiseSVN > Update to a Revision and select revision 20. If you examine the file with your editor you will see that it is an earlier version. Right-click on the file and select SVN Commit. Tortoise tells you that no file has changed and it does not complete the commit. You can't trick Tortoise into committing this version. Open the file in your editor and insert an empty line at the end. Try again to commit. Now Tortoise tells you that you have to update before you can commit, completing the circle back to where you don't want to be. This is not entirely the fault of Tortoise. A major complaint with Subversion is that it cannot undo commits. The only solution is to check out the branch HEAD version of the file and replace all of its text with your editor or WinMerge. To revert AFECont.c to Polycom version 2.2, for example, do:
- In C:\Work1, right-click AFECont.c and select TortoiseSVN > Update to Revision and select HEAD.
- Shift+right-click AFECont.c and select TortoiseSVN > Diff with URL and type file:///C:/Svn7kFw/Alt/Polycom/Ver/2.2/AFECont.c (just replace Src with Ver/2.2).
- Tortoise opens WinMerge with the working file on the left and a copy of the reference file on the right. Click WinMerge's All Left tool bar button to replace all of the working file text.
- Select File > Save Left > Save. WinMerge asks whether you want to override the read-only status of the temporary copy of AFECont.c. Say NO. Then WinMerge will ask you for a save name. Type AFECont.c. WinMerge automatically selects the C:\Work1 folder. When WinMerge asks whether you want to overwrite the file, click yes.
- Right-click AFECont.c and select SVN Commit. In the Message box type "Reverting to version 2.2 because ...".
TORTOISE NOTES
- A new working folder requires no special preparation. Just make a folder and right-click either on the folder or inside it (there seems to be no difference) and select SVN Checkout. Be sure that the URL source is the correct repository and branch and that Tortoise hasn't added a level to your destination (which it seems to do randomly).
- Working folders can be deleted any time you like. There is no centralized record of your checkout.
- Tortoise seems to have no explicit command to tell the version that has been checked out to a working folder, but you can find out by right-clicking the folder and selecting TortoisSvn > Repo-browser, which opens on the source node in the repository.
TORTOISE AND ECLIPSE
This describes how to maintain a working folder that contains some files other than your source code. Eclipse is just one possibility. In this case it is assumed that the Eclipse Subversion plugin is not installed and you are using Tortoise to access the repository. The Unified code HEAD is used for example. It is assumed that you have copied the shared repository M:\Touch Apps Internal\Svn7kFw to C:\Svn7kFw.
- If checking out the code to an existing project directory, delete all source files (h, c, ld, s).
- In Windows Explorer right-click on the project directory and select SVN Checkout. Select URL source file:///C:/Svn7kFw/Src. Make sure that the Checkout directory field shows your project directory without additional depth.
- In Windows Explorer, browse into the project/working directory. Note that all of the checked out source files have a green checkmark but other files have a gray question mark. For Eclipse alone these are .csettings, .settings, Debug and Release. Additional support files may also be here.
- Select all of the non source files (left-click plus shift for range or ctrl to add individual files). Right click on one of them. Select TortoiseSvn > Add to Ignore List. Add the items by name. You can also add files by extension if that is appropriate. In Windows Explorer, the excluded items are shown with a gray - icon.
- The directory now serves as both a Tortoise working folder and as an Eclipse project folder without interference. Eclipse ignores the hidden .svn subdirectory created by Tortoise. You can work on your code in Eclipse as you would in any project directory. You can commit it at any time from Windows Explorer (right-click > SVN Commit).
- Any new files that you put in the folder will automatically be included in your subsequent SVN commit. This makes it easy to add source files but you have to be careful to exclude new files that you don't want to commit to the repository.
- After each addition to the excluded files list, you need to update the working folder. Right-click on or in it and select SVN update.
SUBVERSION IN ECLIPSE
For routine use, Eclipse affords a more convenient interface to a Subversion repository than does Tortoise because there is no need to coordinate different tools and venues. The MIPs Navigator is a specific configuration of the open source Eclipse IDE. Eclipse natively supports CVS but requires a plugin for any other version control system. The most common plugin for SVN appears to be subclipse from CollabNet and/or tigris. Most documentation for Subclipse is in Eclipse help. Help > Contents > Subclipse. There is little documentation on the Internet.
INSTALLING SUBCLIPSE
The plugin must be the matched to the Eclipse version, which can be found in MIPs Navigator: Help >
About MIPS Navigator > first Eclipse logo > Eclipse Platform. The version that we are using as of 2011-07 is 3.5.0. [
http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA] says to use Subversion 1.6.18 for Eclipse 3.2 through 3.5+.
http://subclipse.tigris.org/update_1.6.x
is the direct update source which should work through Eclipse > Help > Install New Software but it fails due to IDT's proxy restrictions. The same files are purportedly available in [http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240] which describes site-1.6.18.zip as a zipped update site. This has been download and unzipped to
M:\Touch Apps Internal\SwDevTools\subclipse1_6_18.
In Eclipse (MIPS Navigator) Help > Install New Software, Add update site
file:///M:\Touch Apps Internal\SwDevTools\\subclipse1_6_18
After this, Eclipse shows several plugins, including subclipse. Select all except Revision Graph, which needs something that we don't have.
Restart Eclipse. It isn't obvious that subclipse has been installed but it is now in online help and is available as a perspective. From Window > Open Perspective > Other, select SVN Repository Exploring to make this perspective a tab along with Debug, C/C++ and any other perspectives that you have selected.
PROJECT CONFIGURATION
Subclipse lets you name the working/project folder when you check out a branch from the repository. It automatically makes this folder or cleans it if it already exists. The name of this folder is not related to anything in the repository design or source code. You could call it anything except for one problem. Debugging a MIPS-Eclipse project requires a debug configuration, which includes the project folder name. Debug configurations are saved somewhere in the .metadata directory of the Eclipse workspace. They are not under version control. This affords you freedom to name the working/project folder anything you like but, to reuse your existing debug configurations, you need to maintain consistent naming.
If no one ever worked on more than one project at a time, all branches could share a single project name. However, a programmer might want to check out for debugging two branches, for example Polycom and Unified, at the same time in order to compare actual functioning. This would be difficult if they had the same project folder name. Consequently, it is recommended that each Alt project be given a unique working/project folder name. It is also possible, and potentially useful, to create a unique project for versions within an Alt branch. For example, in the initial repository, although the Polycom Unified branch is a version under Polycom, it could be useful to check out and debug both it and Polycom HEAD simultaneously.
Each Eclipse project represents a distinct repository branch, but only a few Eclipse configuration items need to be defined for each. They are:
- The project folder name, e.g. Unified, PolyUni, Polycom.
- When checking out a branch from the repository, Subclipse asks for the project folder name. You should use consistent names to avoid having to create or modify your debug configurations.
- Debug configuration, Main > Project = project folder name.
- Executable name, e.g. Evk0910.out, 7kFw.out, LDS7000.out, etc. This appears in three places:
- Project-Properties > C/C++ Build > Settings > Build Artifact > Artifact name = name without extension, e.g. Evk0910, 7kFw, LDS7000, etc. Artifact extension is always
out.
Project-Properties > C/C++ Build > Settings > Build Steps > post-build steps > command = ..\endstep name where name is executable name without extension.
Debug configuration Main > C/C++ Application = Debug/name.out, e.g. Evk0910.out, 7kFw.out, LDS7000.out, etc.
Note that the Project-Properties items are used for building and are, therefore, recorded in .cproject, which is under version control. You should not change these items in any project that you intend to commit except as a new Alt branch.
The initial project-specific items are:
- Unified (Svn7kFw/Src): project folder = Unified; executable name = 7kFw
- PolyUni (Svn7kFw/Alt/Polycom/Ver/2.1): project folder = PolyUni; executable name = LDS7000
- Polycom (Svn7kFw/Alt/Polycom/Src): project folder = Polycom; executable name = LDS7000
See [
Eclipse Debug Configuration]
SUBCLIPSE TUTORIAL
Install both TortoiseSVN and Subclipse before doing this tutorial.
- Copy the shared repository M:\Touch Apps Internal\Svn7kFw to C:\Svn7kFw.
- Start MIPS Navigator ICS (Eclipse).
- Select Help > Help Contents > Subclipse - Subversion Eclipse Plugin. If you don't see this in the menu then you haven't installed Subclipse. Close the help menu.
- If you haven't already done so, open Window > Open Perspective > Other and select SVN Repository Exploring. Your perspectives tab should already have C/C++ and Debug items. If you don't see these and SVN Repository, pull out the tab to expose all three. Click the SVN Repository item.
- The SVN Repositories tab in the SVN window is initially blank. Right-click in it and select New > Repository location. Type file:///C:/Svn7kFw in the Location field. Note that the entire repository tree is immediately displayed and can be browsed (like TortoiseSvn > Repo-browser).
- Right-click Svn7kFw/Src and select Checkout. Subclipse provides a default project name that depends on your Eclipse history and it is probably not what you want, although you can use any name you like. Replace this with Unified because this is the repository's Unified code HEAD. Press OK.
- Subclipse automatically makes a new project directory in the current workspace and fills it with the checkout code. The default workspace created by MIPS is C:\mips\NavigatorICS\NAVIGATOR-ICS-WORKSPACE but you may have another. With Windows Explorer, browse to this now and see the new Unified folder. Tortoise applies a green checkmark to this folder. Right-click on the folder. Note that the menu includes SVN Update and SVN Commit in addition to TortoiseSVN. As far as Tortoise is concerned, this is a standard working folder with checked out files. Select TortoiseSVN > Repo-browser, which opens on file:///C:/Svn7kFw/Src, the checkout source for this folder. Close Repo-browser.
- In Windows Explorer, browse into the project/working directory. Tortoise applies a green check mark to all files. Eclipse creates two files, ".project" and ".cproject", which are not standard source files, but since these are under version control, Tortoise recognizes them. If they were not under control, Tortoise would apply a blue question mark to them. Return now to Eclipse.
- Click the C/C++ item in the view tab. If Project Explorer is not visible, select it by Window > Show View > Project Explorer. The Project Explorer window includes the new Unified project. Subclipse attaches an orange storage icon to the project to indicate that its files are the same as when checked out. This is the same thing as the green check mark in Tortoise.
- Expand the Unified project. All of its files have an orange storage icon, indicating unchanged files. Subclipse tells for each file, the revision number (1 for all in this case), the date and time of the commit, and the name of the committer.
- If your MIPS-Eclipse is correctly configured, you can immediately build the Unified project. Highlight it and select Project > Clean or Project > Build Project.
- In Windows Explorer, browse into your Unified project folder. A new folder called Debug has been created as a result of building the project. Tortoise doesn't know what you want to do with this so it attaches a blue question mark to it. Click on nothing and select TortoiseSVN > Check for modifications. Tortoise lists the Debug folder and everything in it.
- In Eclipse, expand the Unified project and double-click AFECont.c. Insert "// testing" at the beginning and save the file. The orange icon attached to the file changes to a red and white star as does the icon attached to the project. This is the same thing as the red exclamation mark in Tortoise.
- Right-click (in Eclipse) on the Unified project and select Team > Commit. The Commit dialog tells that the destination is file:///C:/Svn7kFw/Src, as expected. The Changes list shows Unified and under it AFECont.c. After committing the change, the icons associated with the Unified project and AFECont.c file return to orange stores.
- With Windows Explorer open in your project folder, right-click on nothing and select SVN Commit. The Tortoise commit dialog doesn't show any source files as having changed but it does list the Debug folder and its contents. All of these are unchecked so they won't be added to the repository but they are a distraction. Abort the commit. Right-click on the Debug folder and select TortoiseSVN > Add to ignore list. Repeat the Tortoise commit. Now Debug and its files are not mentioned.
- To capture the current Unified version in Eclipse, right-click Unified in the Project Explorer and select Team > Branch/Tag. The Create Branch/Tag dialog shows the Copy to URL as "file:///C:/Svn7kFw". Append to this "/Ver/2.1". It then shows that it is the HEAD of this branch that will be copied (by default) and not whatever is in your working folder. Note that this is essentially identical to the process in Tortoise. Add a comment and finish the tagging.
- Select the SVN Repository item in the Eclipse view tab. Expand file:///C:/Svn7kFw/Ver to see the new 2.1. Tortoise will also see this. With Windows Explorer open on your project folder, right-click and select TortoiseSVN > Repo-browser. Browse and expand to see the same new branch, which is the captured 2.1 version of the Unified code.
- Return to Eclipse. Change to C/C++ view. In the Project Explorer window, right-click on AFECont.c and move the cursor to Compare With, opening a sub-menu with a number of available options. If this file were not under version control, the sub-menu would have no enabled options. Select Base Revision. Eclipse reports no differences because you haven't modified the file since the last commit. Similarly, "Latest From Repository" reports no differences.
- Right-click on AFECont.c in Project Explorer and select Compare With > Branch/Tag. The dialog provides the default reference "file:///C:/Svn7kFw/Src/AFECont.c" but this is the same as "Base Revision" and "Latest". To compare this to version 2.0, you could click the browse button (ellipses) but it is quicker to edit the URL to read "file:///C:/Svn7kFw/Ver/2.0/AFECont.c". Do this and click OK. Eclipse opens a window with side-by-side comparison of the two files. For merging, this is not quite as good as WinMerge but it is much better than TortoiseMerge. Hover over the two right-left arrows in compare window toolbar. Note that one copies all non-conflicting text while the other copies the currently selected text. Eclipse knows that you can't change the repository and doesn't even provide a button for this, unlike TortoiseMerge and WinMerge. Often, it is helpful to get a larger view when comparing and merging but this window is constrained to the edit panel. To expand the compare window, maximize the edit panel by right-clicking its tab area (at the top of the panel) and selecting maximize. If you accidently select minimize instead of maximize or restore, the panel shrinks to side-bar icon, which you can click to restore the edit panel. Click the close mark on the compare window's tab.
- To compare repository versions, switch Eclipse to SVN Repository view. Right-click on Svn7kFw/Ver/2.1 and select Compare. The dialog provides the same "file:///C:/Svn7kFw/Ver/2.1" URL as reference. Change 2.1 to 2.0 and click OK. The compare window shows that the two differ only in AFECont.c. Double click on this to open the side-by-side compare/merge. Try clicking the various right/left arrows. They are all disabled because you can't edit files that are not checked out.
- In the repository view, right-click on Svn7kFw/Alt/Polycom/Src. Select Compare and browse to or edit the reference URL to read "file:///C:/Svn7kFw/Src". Click OK to compare the HEAD of Unified and Polycom. Eclipse provides a quick way to compare multiple files and to perform simple merges involving a few but WinMerge is better for big merge efforts. The file compare in Eclipse simply tells you where lines differ without pointing out the detailed differences, forcing you to carefully examine each line. TortoiseMerge provides these details but in a way that is so arcane that it is essentially a new language. WinMerge presents these details when you need and to whatever depth you ask for, providing the detail of TortoiseMerge with the convenience of Eclipse.
- WinMerge can't be properly integrated into Eclipse or Tortoise. To merge two code sets that differ by as much as Unified and Polycom, it is best to check each out to separate folders (using Tortoise or Eclipse) and invoke WinMerge as a stand-alone program. If you have installed WinMerge you can try this now.
- In Eclipse SVN repository view, right click Svn7kFw/Alt/Polycom/Src and select Checkout. Name this project Polycom.
- In Windows Explorer, browse to your Eclipse workspace folder, where you should see the Unified and Polycom project folders.
- Right-click on the Polycom folder and select WinMerge (it is in the context menu because WinMerge, like Tortoise, is an Explorer extension). The left folder is your Polycom project. Put the path to your Unified project in the right folder field. Uncheck "Include Subfolders".
- Finish this tutorial by deleting your experiments. This should be done in a certain order to avoid dangling references.
- In Eclipse Project Explorer window, right-click Unified and select Delete. Check "Permanently delete folder contents" (this includes the folder itself) and click OK. Repeat this with Polycom.
- Switch to SVN Repository view. Right-click on file:///C:/Svn7kFw and select Discard Location.
CODE BASE PREPARATION
PROJECT SOURCES
The Unified code base (u0) has been published at:
"M:\Touch Apps Internal\exchange\firmware\Internal Firmware Releases\2011 0701 Unified Base Version". This was later moved to:
"M:\Touch Apps Internal\exchange\firmware\Internal Firmware Releases\Unified Base Versions\2011 0701 Unified Base Version"
This will be captured as U2.0, freeing Svn7kFw/Src for further code development. It will also be captured as the first Polycom version P2.0 for the purpose of comparison and merging.
The Polycom code base of the version sent to Polycom (p0) has been published at:
"M:\Touch Apps Internal\Firmware Released to field\Polycom\2011-0701 Polycom v15 Faster FrontEndFilter\2011-0701 Polycom v15"
This will be captured as P2.2.
A subsequent Polycom code base that has been merged with the Unified version has been published at:
"M:\Touch Apps Internal\exchange\firmware\DJ\Gestures\preliminary\48pin_Polycom_Unified"
This will be captured as P2.1.
Although the PolycomUnified code base (pu0) was developed after the Polycom code base (p0) their order in the repository is reversed. There are two reasons for this. One is that pu0 has more in common with u0 than does p0. 18 of 27sources files are different between p0 and u0 but only 9 are different between pu0 and u0. Thus, in terms of version evolution, pu0 represents a transition between u0 and p0. Secondly, current development plans call for continuing development of the p0 code. This is the code that has been released to the customer, with a promise that the next release will contain a limited set of modifications.
The mismatched files between u0 and pu0 are:
.cproject, .project, communication.h, Gestures.c, Gestures.h, NVRAM_DefaultData.c, singlTch.h, system.h, TouchFind.c
The mismatched files between u0 and p0 are:
.cproject, .project, AFECont.c, Commands.c, communication.c, communication.h, Gestures.c, Gestures.h, globals.c, globals.h, multiTch.c, NVRAM_DefaultData.c, NVRAM_Definition.h, singlTch.c, singlTch.h, system.c, system.h. TouchFind.c
The mismatched files between pu0 and p0 are:
.cproject, AFECont.c, Commands.c, communication.c, communication.h, Gestures.c, globals.c, globals.h, multiTch.c, NVRAM_DefaultData.c, NVRAM_Definition.h, singlTch.c, singlTch.h, system.c, system.h, TouchFind.c
CODE PREPARATION
The existing project design separates local H files into their own directory under the one that contains the C files. This serves no purpose and complicates some operations. Subversion allows source directories to be created and deleted but file comparison and merging operations are complicated by directory changes. Therefore, the local include directory will be merged into the main directory in all three code sets before creating the initial repository.
The code sets are prepared for the initial repository creation by moving their H files from the include subdirectory into the main code directory. While it would be possible to change the project settings so that local "." is in the include path, standard practice would indicate changing #include <name.h> statements to #include "name.h". This is done for all files with an awk script and XP command.
The original C files are placed in the subdirectory source. Then instead of modifying them, which is hard, they are just copied into CWD with the changes made on the fly.
The awk script, locinc.awk, is:
{
if ($1 ~ /#include/ && $2 ~ /<([^>])+>/)
{
sub( /</, "\"" )
sub( />/, "\"" )
}
print
}
The XP command is:
for %f in (source\*.c) do awk -f locinc.awk %f > %~nf.c
All of the H files in Include are copied to the main code directory. The file mips_regdef.h in the include directory is not referenced in any of the C files but is referenced by starthere.s. The Include directory is removed from the Eclipse project definition by deleting it from both Project > Properties > C/C++ General > Paths and Symbols > Include tab Project Properties > C/C++ Build > Settings > Sourcery G++ Assembler > General > Include Paths.
system.h and NVRAM_Definitions.h contain #include <singlTch.h>. Including headers in headers is generally discouraged. The program builds without errors or warnings if this is removed from system.h but there are many warnings (but no errors) if it is removed from NVRAM_Definitions.h. The implications of these warnings is not obvious. Therefore, these will not be removed from either file but just changed to use quotes instead of brackets. The #include <mips_regdef.h> in starthere.s is changed to use quotes by hand editing.
POST-BUILD
The standard build (MIPS project) ends after generating name.out, which is an executable under the debugger but is not useful for anything else. For other purposes several other files need to be generated. This has been done by our endstep.bat. This file has resided in Debug, which is the output folder for generated files and should not be used for any kind of source. It should be located in either a tool directory or in the project folder and put under version control. Further, it invokes tools, which themselves reside in Debug. They should be located in a tool folder. Additionally, the batch file unnecessarily embeds the project name, preventing its reuse for different projects without editing.
The original endstep.bat for Polycom is:
mips-sde-elf-objdump -Drtx LDS7000.out > disassembly.txt
mips-sde-elf-objcopy -O binary LDS7000.out LDS7000.bin
bin2hex LDS7000.bin LDS7000.hex
LDS7kCodeSafeEncrypter LDS7000.hex
BTTSafe lds7000SafeEncrypted.hex
rem that's all
The original endstep.bat for Unified is:
mips-sde-elf-objdump -Drtx evk0910.out > disassembly.txt
mips-sde-elf-objcopy -O binary evk0910.out evk0910.bin
bin2hex evk0910.bin evk0910.hex
LDS7kCodeSafeEncrypter evk0910.hex evk0910SafeEncrypted.hex
BTTSafe evk0910SafeEncrypted.hex
The two are identical except for the second argument to LDS7kCodeSafeEncrypter in Unified that isn't in the Polycom version and the generated file name root.
mips-sde-elf-objdump.exe and mips-sde-elf-objcopy.exe are located in the mips installed bin directory, which is normally c:\mips\NavigatorConsole\bin. bin2hex.exe is a common program but has incompatible variants. A variant that does work for us is located in M:\Touch Apps Internal\exchange\firmware. There seems to be no central location for LDS7kCodeSafeEncrypter.exe or BTTSafe.exe but each project's Debug directory contains copies.
SOLUTION
The bin2hex.exe, LDS7kCodeSafeEncrypter.exe, and BTTSafe.exe files in the Polycom source project ("M:\Touch Apps Internal\Firmware Released to field\Polycom\2011-0701 Polycom v15 Faster FrontEndFilter\2011-0701 Polycom v15\Debug") are copied to [
\\Corpgroup\AUI$\Touch Apps Internal\SwDevTools]. Individual developers may add this to their path but it is a long name. Alternatively, they can copy these three files to the mips bin directory (normally c:\mips\NavigatorConsole\bin).
The endstep.bat from Unified\Debug is moved into the source directory and edited to take a command argument for the base file name. It is invoked automatically at the end of normal build by the Eclipse project Properties > C/C++ Build > Settings > Build Steps > post-build steps > command = "..\endstep name". name must match the out name defined in project > Properties > C/C++ Build > Settings > Build Artifact > Artifact name. This requirement is due to endstep.bat operating on %1.out. The endstep.bat for any code set may be changed to accept and produce files with independent names. CWD when this executes is Debug, which is why the command includes "..\" path. Even though the batch file itself is in the source directory, it operates in Debug and only on files in Debug. Although it performs its main task only if given a valid file name (for which name.out exists) argument, it unconditionally deletes all of the expected generated files. This is to prevent old files from being inadvertently used by downstream processes.
The Eclipse project Properties > C/C++ Build > Settings > Build Steps > post-build steps > command is "..\endstep 7kFw" for the Unified branch and "..\endstep LDS7000" for the Polycom and Polycom-Unified branches.
endstep.bat
@rem endstep.bat
@echo off
rem This resides in the source directory but is invoked from
rem Debug and operates on files in Debug. All of the expected
rem output file types are deleted unconditionally to avoid
rem potentially catastrophic mismatches (such as blowing up
rem parts with the wrong code).
del disassembly.txt
del *.bin
del *.hex
del *.iap
del TargetFirmw.c
if "%1" == "" (
echo endstep needs file name argument > error
goto exit
)
if not exist %1.out (
echo %1.out does not exist > error
goto exit
)
mips-sde-elf-objdump -Drtx %1.out > disassembly.txt
mips-sde-elf-objcopy -O binary %1.out %1.bin
bin2hex %1.bin %1.hex
LDS7kCodeSafeEncrypter %1.hex %1SafeEncrypted.hex
BTTSafe %1SafeEncrypted.hex
:exit
APPENDIX ONE: CREATING THE REPOSITORY WITH TORTOISE
- Make real (OS) directory Svn7kFw in "M:\Touch Apps Internal".
- Convert Svn7kFw to Subversion repository by:
- In Windows Explorer, right-click on Svn7kFw.
- From popup menu: TortoiseSvn > Create repository here.
- Create Svn7kFw/Src by adding the Unified source.
- Prepare the Unified source by making a temporary real directory called Src and copying *.c, *.h, 7000scrpt.ld, .project, and .cproject files. The latter two files are not program source but they are XML text, which can be fully managed (unlike binary files).
- Right-click on Svn7kFw.
- Select TortoiseSvn > Repo-browser.
- Right-click on file:///M:/Touch Apps Internal/Svn7kFw in Repo-browser.
- From popup menu select Add folder. Browse to the prepared Src; select it and press ok. For message use "Unified coding venue". This is repository Revision 1 (Subversion increments Revision on every change).
- Right-click Svn7kFw again (in Repo-browser). Select Create Folder called Ver with message "Unified versions", and Alt with message "Unified alternatives". At this point, the repository Revision is 3.
- Capture version U2.0 by copying the u0 code from Svn7kFw/Src by duplicating the directory.
- In Repo-browser right-click on Svn7kFw/Src.
- From popup menu select Copy to. Type in the destination field file:///M:/Touch Apps Internal/Svn7kFw/Ver/2.0. Message is "Unified code 2.0".
- Press F5 to update the browser. Otherwise, the new folder doesn't appear, which makes it look like the operation failed.
- At this point, the repository Revision number is 4. The Unified code version 2.0 can be retrieved from its version branch Svn7kFw/Ver/2.0 or by Svn7kFw/Src revision 4.
- Create Polycom folder.
- In Repo-browser, right-click on Alt (file:///M:/Touch Apps Internal/Svn7kFw/Alt).
- From popup menu select Create Folder. Folder is Polycom with message "Polycom alternate program design".
- Capture unified code u0 as the first Polycom version.
- Repeat step 6 used to capture U2.0 but destination is Svn7kFw/Alt/Polycom/Src. The source may be either Svn7kFw/Src or Svn7kFw/Ver/2.0. Message is "Unified 2.0 baseline for Polycom". [rev 6]
- Create Ver and Alt folders under Polycom (see step 5). Messages are "Polycom versions" and "Polycom alternatives".
- Copy Polycom/Src to Polycom/Ver/2.0 (procedure similar to step 6). Message is "Polycom 2.0 is Unified 2.0". [rev 9]
- Prepare Polycom version P2.1. The current version, which is really the u0 (version U2.0) code set, is first checked out just to prepare the Subversion client venue. Then all of the checked out code is discarded and replaced by the Polycom-Unified code set. This is then checked in (committed). Then it is captured into version 2.1.
- Delete all files (including hidden and folders, e.g. .svn) in a temporary local Src directory. Any directory could be used-- the name is irrelevant-- but it must be completely clean.
- With TortoiseSVN you don't go to the repository to check out files but to your working (destination) folder.
- With Windows Explorer in the temporary Src directory, right click. In the popup menu, select SVN checkout.
- The URL of repository is "file:///M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Src". This can be typed by hand, copy/pasted from a document, or located through Repo-browser.
- The Repo-browser affords two ways to copy a URL. In the SVN checkout dialog, pressing the elipsis button to the right of the URL field opens Repo-browser on the most recently browsed location. This doesn't work on the first use of a new repository and can be dangerous if you access multiple repositories because it may lead you to browse the wrong one. The other, less convenient but more reliable method is to open Repro-browser on the correct repository (Svn7kFw in this case) right-click on the desired branch (Polycom/Src) and select Copy URL to clipboard.
- All of the firmware source files should appear in the temporary Src with a green checkmark, Tortoise's indicator that the files are unchanged the same as the source, i.e. Polycom/Src. If any files don't have a green checkmark, press F5 to refresh the (Windows Explorer) display. A new hidden directory, ".svn" has also been created in your working Src. The creation of this directory and its contents is the only purpose of this first checkout. Delete all (27) of the files in Src. Don't change ".svn".
- Copy *.c, *.h, 7000scrpt.ld, ".project", ".cproject", and endstep.bat files of the PolycomUnified code set. These are the files from "M:\Touch Apps Internal\exchange\firmware\DJ\Gestures\preliminary\48pin_Polycom_Unified" after eliminating the separate include directory. In Windows Explorer, Tortoise now shows 9 files with a red exclamation mark, indicating that these are different from the baseline. The files that still have a green checkmark are the same in both Unified 2.0 (aka Polycom 2.0) and Polycom 2.1.
- With Windows Explorer in Src, right click. Select SVN commit. In the commit dialog, note that Tortoise identifies the commit destination as "file://M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Src" (M is your mapped letter). This cannot be modified. Tortoise also shows the 9 files that have changed, each with a checkmark. Unchecking a file would deselect it from the commit. Leave all checked. Message is "Touch Apps Internal\exchange\firmware\DJ\Gestures\preliminary\48pin_Polycom_Unified with merged includes". Tortoise now shows all of the files in temporary Src with green checkmarks because they now match the repository HEAD. [rev 10]
- In Repo-browser, right-click Svn7kFw/Alt/Polycom/Src and select Copy to. Destination is file:///M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Ver/2.1. Message is "Polycom version 2.1 is Touch Apps Internal\exchange\firmware\DJ\Gestures\preliminary\48pin_Polycom_Unified with merged includes". Press F5 to refresh display and confirm creation. [rev 11]
- Prepare, commit, and capture Polycom 2.2. This procedure is the same as use for version 2.1 except that the initial checkout to the temporary Src is not needed, as the directory is already in the required state and the code set is derived from "Touch Apps Internal\Firmware Released to field\Polycom\2011-0701 Polycom v15 Faster FrontEndFilter\2011-0701 Polycom v15" with the same modifications to eliminate the separate include directory.
- Delete all of the files in Src. Note that these all have green checkmarks, indicating that they match the HEAD of Polycom/Src.
- Copy *.c, *.h, 7000scrpt.ld, ".project", and ".cproject" files of the Polycom p0 (not unified) set to Src. Now Tortoise's green checkmarks and red exclamation marks show 16 unmatched files (compared to Polycom 2.1, aka pu0).
- Right-click in Src and select SVN commit. Message is "Touch Apps Internal\Firmware Released to field\Polycom\2011-0701 Polycom v15 Faster FrontEndFilter\2011-0701 Polycom v15" with merged includes. [rev 12]
- In Repo-browser, right-click Svn7kFw/Alt/Polycom/Src and select Copy to. Destination is file:///M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Ver/2.2. Message is "Polycom version 2.2 Touch Apps Internal\Firmware Released to field\Polycom\2011-0701 Polycom v15 Faster FrontEndFilter\2011-0701 Polycom v15 with merged includes". [rev 13]
- Verify repository creation. This is done for the two HEADs and each of the captured versions by checking out into a clean directory and comparing to the original directories. The temporary Src directory is reused with complete cleansing (including .svn) before each test.
- At DOS prompt in the Src directory do del . and rd /s .svn. Alternatively, in the GUI delete the entire Src directory and then create it again.
- In Windows Explorer on Src, right-click and select SVN Checkout.
- Click the ellipses to the right of the URL field to browse for Svn7kFw/Src. In the repo-browser, with this folder highlighted click OK. The full URL "file:///M:/Touch Apps Internal/Svn7kFw/Src" (with your mapped drive instead of M) appears in the checkout URL.
- Compare the checked out files to the Unified code set.
- Repeat steps 11.1 through 11.4 on all of the branches.
- Compare version U2.0 file:///M:/Touch Apps Internal/Svn7kFw/Ver/2.0 to Unified.
- Compare P2.0 file:///M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Ver/2.0 to Unified.
- Compare P2.1 file:///M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Ver/2.1 to PolycomUnified code set pu0.
- Compare P2.2 file:///M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Ver/2.2 to Polycom code set p0.
- Compare Polycom/Src file:///M:/Touch Apps Internal/Svn7kFw/Alt/Polycom/Src to Polycom code set p0.
APPENDIX TWO: CREATING THE REPOSITORY WITH SUBVERSION COMMANDS
[
\\Corpgroup\AUI$\Touch Apps Internal\SwDevTools\coding] makeSvnRepo.bat
This is a batch file that creates the initial repository as a local file from a set of three original source folders. The three source folders, Unified, PolyUni, and Polycom contain fully prepared sources, including endstep.bat, .cproject, and .project Eclipse files. The include files have been moved into the source folder.
The repository is created at the same level as the three source files. The batch file is invoked with the URL of this working directory as a parameter to avoid the complexity of DOS path conversion to URL.
@ echo off
rem makeSvnRepo.bat
rem Updated: 2011-07-19
rem Make Svn7kFw Subversion repository from Unified, Polycom-Unified, and
rem Polycom sources. This requires a command argument, which is the URL version
rem of the CWD (%CD% in XP batch). i.e. file:///C:/path... The Svn7kFw
rem Subversion repository will be created under CWD. This requires the source
rem folders, Unified, PolyUni, and Polycom, to exist in CWD and to contain only the
rem files that will be under version control, *.c, *.h, 7000scrpt.ld,
rem ".project", ".cproject", and endstep.bat.
echo on
if exist log del log
echo Create Subversion repository Svn7kFw >> log
md Svn7kFw >> log
svnadmin create Svn7kFw >> log
echo Create Svn7kFw/Src from the Unified code set >> log
svn import Unified %1/Svn7kFw/Src -m "Unified coding venue" >> log
echo Create Ver and Alt folders >> log
svn mkdir %1/Svn7kFw/Ver -m "Unified versions" >> log
svn mkdir %1/Svn7kFw/Alt -m "Unified alternatives" >> log
echo Copy the Unified code from Src to Ver/2.0 to capture version U2.0 >> log
svn copy %1/Svn7kFw/Src %1/Svn7kFw/Ver/2.0 -m "Unified code 2.0" >> log
echo Create Polycom alternative >> log
svn mkdir %1/Svn7kFw/Alt/Polycom -m "Polycom alternate program design" >> log
echo Copy unified code u0 as the first Polycom version >> log
svn copy %1/Svn7kFw/Src %1/Svn7kFw/Alt/Polycom/Src -m "Unified 2.0 baseline for Polycom" >> log
echo Create Polycom Ver and Alt folders >> log
svn mkdir %1/Svn7kFw/Alt/Polycom/Ver -m "Polycom versions" >> log
svn mkdir %1/Svn7kFw/Alt/Polycom/Alt -m "Polycom alternatives" >> log
echo Capture Polycom version 2.0 = u0 >> log
svn copy %1/Svn7kFw/Alt/Polycom/Src %1/Svn7kFw/Alt/Polycom/Ver/2.0 -m "Polycom 2.0 is Unified 2.0" >> log
@ rem Prepare Polycom version P2.1. The current version, which is really the u0
@ rem (version U2.0) code set, is first checked out just to prepare the
@ rem Subversion client venue. Then all of the checked out code is discarded and
@ rem replaced by the Polycom-Unified code set. This is then checked in
@ rem (committed). Then it is captured into version 2.1
@ if exist src/nul RD /S /Q src
@ rem md src -- not needed. svn checkout creates Src (like it or not)
svn checkout %1/Svn7kFw/Alt/Polycom/Src >> log
del /Q Src
copy PolyUni Src >> log
svn commit Src -m "Touch Apps Internal\exchange\firmware\DJ\Gestures\preliminary\48pin_Polycom_Unified with merged includes" >> log
svn copy %1/Svn7kFw/Alt/Polycom/Src %1/Svn7kFw/Alt/Polycom/Ver/2.1 -m "Polycom version 2.1 is Touch Apps Internal\exchange\firmware\DJ\Gestures\preliminary\48pin_Polycom_Unified with merged includes" >> log
@ rem Prepare, commit and capture Polycom 2.2. This procedure is the same as use
@ rem for version 2.1 except that the initial checkout to the temporary Src is
@ rem not needed, as the directory is already in the required state.
del /Q Src
copy Polycom Src >> log
svn commit Src -m "Touch Apps Internal\Firmware Released to field\Polycom\2011-0701 Polycom v15 Faster FrontEndFilter\2011-0701 Polycom v15" >> log
svn copy %1/Svn7kFw/Alt/Polycom/Src %1/Svn7kFw/Alt/Polycom/Ver/2.2 -m "Polycom version 2.2 Touch Apps Internal\Firmware Released to field\Polycom\2011-0701 Polycom v15 Faster FrontEndFilter\2011-0701 Polycom v15 with merged includes" >> log
APPENDIX THREE: ECLIPSE CONFIGURATION
DEBUG CONFIGURATIONS
To debug the program under Eclipse, a matching debug configuration must be defined. If you work on only one project at a time, you only need to define one debug configuration. Debug configurations are not under version control but recorded in the .metadata database in the Eclipse workspace. Consequently, you can't easily import a debug configuration but must create at least one.
The first (or only) configuration is made from the MIPS ICS Application template, which provides both appropriate and inappropriate information. Some information is unique to our hardware and must be added. Additionally, the project folder and executable name are required. To create a debug configuration for a project, highlight that project in the Project Explorer window. Then click on the down arrow next to the bug icon in the toolbar. Select Debug Configurations. It is important to select the project before opening the Debug Configurations even if this is for an entirely new configuration. If a project for which a debug configuration already exists is accidentally highlighted, "new" debug configuration creates another instance of a configuration for the highlighted project.
If you don't have any debug configuration defined then you need to create one based on the MIPS ICS Application template. If you have a functioning debug configuration for a different project, you can clone it. To create from the template, right-click on MIPS ICS Application and select New, but to clone from an existing debug configuration, right-click on that and select Duplicate. Duplicate provides an obviously wrong project name and folder but these would be changed in any case. When cloning a debug configuration it is very important that the source not be in the debug "favorites" list. An error in MIPS-Eclipse causes both the original clone and the modified version to appear in the list forever joined. You can remove them both or include them both but there is no way to put just the one you want in the list. Another manifestation of this error is that modifying a debug configuration causes it to appear in the favorites menu even when it is not originally in the list. When this occurs, the menu item can be removed only by deleting the configuration.
The easiest way to make several debug configurations is to make one original from the MIPS template and then clone it. Be sure that neither box in Debug Configuration > Common > Add to favorites is checked in the original clone source. If you aren't sure, open Debug-Organize favorites and uncheck everything. You can avoid the duplicate favorites problem entirely by not having anything in this list. You can debug any project that has a debug configuration by first selecting it in the Project Explorer window and then clicking the bug icon. Another MIPS-Eclipse error causes the debug favorites list to continue to display items that have been removed. The best policy is to never add anything to this list.
See [
Project Configuration] to review project naming.
- To create the Unified debug configuration from the MIPS template.
- Click on the down arrow next to the bug icon in Eclipse toolbar.
- Select Debug Configurations.
- Right-click on MIPS ICS Application.
- Select New.
- Main
- Name := Unified
- Project := Unified
- Build Configuration := Use Active
- C/C++ Application := Debug/7kFw.out
- Arguments = blank
- Debugger
- Target Interface = MIPS Probe(EJTAG/DeepTrace/IFlow)
- GDB Executable = mips-sde-elf-gdb
- Launch Preset = Advanced
- Download Code = checked
- Reset Action = No Reset
- Attach After = 7 Seconds
- Set PC to custom PC/Symbol 0x40
- Stop at = Main
- Set endian = Auto
- Scan For Probes = 42812 <<< Don't type this. Press the "scan for probes" and accept whatever it says. If scan fails then disconnect everything, reconnect and run GUI with 52, 52 2 commands.
- Configuration name = M4K
- Device name = mips_m4k
Assuming that you have created the original Unified debug configuration, create PolyUni debug configuration by:
- Click on the down arrow next to the bug icon in Eclipse toolbar.
- Select Debug Configurations.
- Right-click on Unified.
- Select Duplicate.
- Main
- Name := PolyUni
- Project := PolyUni
- C/C++ Application := Debug/LDS7000.out
Clone Polycom from PolyUni, replacing the name PolyUni with Polycom.
ECLIPSE SETTINGS
There are a number of Eclipse configuration settings which, although not strictly related to version control, are useful when code is being shared.
- Build Configurations. We use only one configuration, Debug, but Eclipse may automatically assume that there is also a Release and make a Release folder and include Release in menus and dialogs. This can be confusing, especially to programmers familiar with the more common situation in which there are two configurations. Remove superfluous Release from each project by:
- Right-click on the project name in Project Explorer.
- Select Build Configurations > Manage.
- Select Release and click Delete.
- Special compiler switches
-finline-limit=8 and -mno-check-zero-division. These reduce the generated code size. They must be added to each project unless the project is derived from a project that already has them. These are stored in the ".cproject" file. In the initial repository, Polycom has neither of these switches because that is how the code shipped to Polycom was built. The original Unified project included -finline-limit=8 but not -mno-check-zero-division, although there is no reason for leaving this out. In the repository both Unified and PolyUni have both switches.
- Right-click on the project in Project Explorer.
- Select Properties > C/C++Build > Settings.
- In the Tool Settings tab, select Sourcery G++ C Compiler > Optimization and in the "Other optimization flags" field enter
-finline-limit=8 -mno-check-zero-division.
No tabs. When discussing specific code, it can be helpful to copy and paste portions into emails or documents. If the code contains tabs, indenting gets scrambled. There is no valid reason for retaining actual tab characters in the source. Turn them off by Window > Preferences > General > Editors > Text Editors: check "Insert spaces for tabs". Related to this, don't change the default tab width of 4.
Coding style. It is easier to share code when one style is established as the default. There are many varied opinions about what is the "best" style but BSD enjoys wide support and has been developed by programmers with a great deal of teaching and documentation experience. Much of our existing code style already resembles BSD.
- Window > Preferences > C/C++ > Code Style: select BSD from "Select a profile" dropdown list. Click Apply then OK.
- To reformat an entire file, enter Ctrl+A followed by Ctrl+Shift+F.
- A standard rule is to not perform wholesale reformatting and any code change in the same commit. If you want to reformat a large section of code and also change the code, you should reformat and commit the file and then make the code changes. This avoids having the code change obscured by reformatting.
MIPS-Eclipse doesn't automatically save files before building. This often leads to accidentally building with an old source. To save modified files before building: Window > Preferences > General > Workspace: check "Save automatically before build". Also, uncheck "Build automatically", as this builds whenever a file is saved.
If you find Eclipse editor's automatic typing of closing characters annoying, turn it off by Window > Preferences > Editor > Typing > Automatically Close: uncheck everything or just the ones you don't like.