Monday, March 28, 2016

branched development merge for Nuttx 15.7

With a recent update of Nuttx 15.7
https://groups.yahoo.com/neo/groups/nuttx/conversations/messages/11496
https://sourceforge.net/projects/nuttx/files/nuttx/nuttx-7.15/

I needed to merge the udpates into my bitbucket.org fork.
https://bitbucket.org/nuttx/ - previously I had forked from here, and now need to merge those updates into it.
Nuttx has 4 repositories - that all need to be individually updated.
There may be a script to do this - but right now bitbucket offers a button to sync the fork with the upstream. Its positioned on the far right and only exists if this fork is behind.



For _nuttx fork


Press the sync now - then repeat with  forks  _configs (upstream is called nuttx/boards)


_arch

 and apps.


Now on the build machine - in this case an Ubuntu I step into my development  git directory "git/nwwk2"
and then step through apps  nuttx   nuttx/configs & nuttix/arch to update all the modules.
My development branch is "work-modbus".

A little trick I learn't, that as branching is easy/quick, and to be able to easily manage (not commit if necessary) the master merge,  I create a temporary branch "work-modbus-merge" and do all the work/conflict resolution on that first.
When complete its an easy step to merge "work-modbus-merge" into "work-modbus"
git checkout master
git update   # this brings in the udpate
git checkout work-modbus
git checkout -b work-modbus-merge
git merge master   #this does the actual merging from the master
… review new code - in this case no conflicts
git checkout work-modbus
git merge work-modbus-merge
git branch -d work-modbus-merge  #deletes the -merge branch
git merge master  #should be no items
git status  #should say uptodate
git commit -m "merged with Nuttx 7.15 "
git push origin work-modbus    # final upstream update to my 

Then this step is repeated for nuttx, _configs, _arch

Enjoy the merge - when it works its very easy.!!!



Sunday, March 27, 2016

tutorial: Branched workflow setup

This is a series of blogs (my self documentation) on using Nuttx in a branched workflow.
Hopefully its of some use to others.
This starts from the beginning and works through the commands to a built image

Nuttx.org  has a git submodule configuration that adds a layer of complexity to manage the submodules in  a branched workflow environment.
My development environment is Ubuntu 15.10, with Meld to do differencing. 
Meld required Ubunutu 15.10
The editing is done in Eclipse Mars on Windows8 over the network to Ubuntu. I login in remotely to the Ubuntu machine to compile.

Some references

To start sign into bitbucket.org , then clone the following into your <userSpace> on bitbucket
I use a prefix ZZ as you might want to experiment with different instances of Nuttx as the development progress
bitbucket.org/patacongo/nuttx  to ZZ_NuttX   Description: <your plans for the fork>
bitbucket.org/nuttx/apps             ZZ_nuttapps Description: <your plans for an apps>
bitbucket.org/nuttx/arch              ZZ_nuttx-arch Description: Required as part of nuttx
bitbucket.org/nuttx/boards         ZZ_nuttx-config “Nuttx boards definitions”


Then on local machine (mine Ubuntu15.10)
(either setup SSH or use the https form instead of git@bitbucket.org:.... )

cd git
mkdir nxYY    #my top level dir - YY userdefined eg nxwkA
cd nxYY

git clone git@bitbucket.org:<user>/ZZ_nuttapps.git  apps
git clone git@bitbucket.org:<user>/ZZ_nuttx.git nuttx
cd  nuttx
git remote –v (origin should be above)

#
#first time through 
echo "/configs/*" >> .gitignore
echo "/arch/*" >> .gitignore

git add  .gitignore
git commit -m "changed submodule arch configs to directory"
git push origin master   OR if fails or first time on branch   $git push origin <branch-name>

rm -rf arch
rm -rf configs

git clone git@bitbucket.org:<user>/ZZ_nuttx-configs.git  configs
git clone git@bitbucket.org:<user>/ZZ_nuttx-arch.git  arch
git status #shows arch and configs but git ignores any action on them 

#
#optionally should be able to do the following for submodules Documentation 
#- but doesn't work, some hidden submodule meta data still lying around
git submodule init 
#(has error "no submodule mapping found in .gitmodules for path 'arch'"??)
git submodule update  #populates

make distclean
cd  tools
#one of following
$ ./configure.sh stm32f429i-disco/nsh
$ ./configure.sh olimex-stm32-h407/nsh


cd ..
make menuconfig #Step into "Build Setup: ensure host is correct, save, exit to use latest format
#optionally, specify version info
tools/version.sh -v <major.minor> 

make #test build, should work and be tested before continuing

# Do the following for changes to any one of four "projects"
# nuttx   nuttx/arch nuttx/config apps
#eg for nuttx/arch (repeat for other projects as needed)

cd apps
git branch develop  #baseline for future: only first time through

git checkout -b work-<descriptive name>  #new branch eg work-modbusm
git status
<<make changes, build and test>>
git status eg
git add .
git commit -m "sensible comment"
git push origin work-<descriptive name> 

# On Bitbucket.org/<user> check commit is as expected.