I had to set up my environment for Spark development and debugging at home (already had it set up at work), so I figured I would keep a log here and end up with a step by step guide.
(optional): Install SourceTree
I use SourceTree for version control. It’s a git GUI. In this guide, we’ll use it to check out the spark-firmware for custom development.
You can download it here. It’s free, it’s awsome.
Fork the spark firmware repository
If you are going to develop your own app and possibly contribute to the spark firmware, you probably want to fork the spark repository. You can easily do this on Github. You can then commit your code to your own fork, and send a pull request if you have coded something that is worth pushing upstream.
Clone your fork to your computer
In SourceTree, click the ‘Clone/New’ button.
Click the globe on the right. It will probably ask you for your GitHub credentials.
When you click OK, it will show you a list of all your repositories on GitHub. Pick the Spark firmware of which you are the owner and click OK.
Under advanced settings, set the branch to check out to feature/hal
This branch is easiest to work with for now and will later replace the master branch.
Optionally you can set the clone depth to prevent cloning a lot of old commits. Set it to 100 to only get the last 100 for example.
Set the destination path, check ‘Bookmark this repository’ and click ‘Clone’.
You now have a local copy of the Spark firmware, with your own GitHub account set up as remote.
Add the official spark repo as a remote
In the top right in SourceTree, click the settings button. It will open this window:
Add the official firmware repo as a remote with the name ‘spark’.
Get the latest updates from Spark
You can now click the ‘Fetch’ button to get the latest commits from the official repository. The fetch button does not change your code, it only updates your view of the remotes. If you click the ‘Pull’ button it will also try to merge all changes upstream. I often prefer to use the fetch button and right click any commit I would like pull into my local branch.
After the fetch, I can see that a lot happened in the official repo. I can see different branches and new commits on the ‘Log/History’ tab (ctrl-2).
I can also click any 2 commits to see the code changes between them.
So I am behind the official repo and now I would like to merge the latest code changes.
I am on branch feature/hal, my own remote (origin) is at the same commit (see screenshot above) and the official repo is a bit further (spark/feature/hal).
I can now right-click that commit and choose ‘merge’.
If you start developing your own code, it is better to create a branch for that. Just click the branch button and choose a new name. You can still pull in all the changes from the feature/hal branch to stay up to date.
Allright, so now that we have version control ready to go, we can continue with the development environment. I will do that in my next post.