Saturday, May 28, 2016

How to download nuttx for a Feature Branched Workflow

This is a series of blogs (my self documentation) on using Nuttx in a branched workflow.
Hopefully its of use to others.
This assumes you already have a viable build environment on your local machine.
This assumes you have already forked the nuttx repo's on bitbucket
Ideally your fork is sycned to a release tag - but that is advanced code management for another discussion.
Now you need to download the repos to a local machine  before they can be build.
There are many workpractises that can accomplish this - so I'm sharing the one I've evolved.
The target is to be eventually do a "polished" Pull Request back into the  main nuttx. There is a fierce guardian of the repo - so while a users main effort might be creating the code, possibly if like me quite messily, the activity of submitting back to the nuttx repos of working code can be a process in itself.
So as per the Feature Branched Workflow guidelines I consider creating one local instance of nuttx for working on - with a branch usually starting with "work..."  and then when submitting it creating another local nuttx instance got staging and polishing the code ... with a branch possibly beginning "pr.."
Nuttx can be built for a number of processors or starting configurations, I find it useful to create my local nuttx instance with a defined naming scheme

I use a postfix nxZZ for each directory,  as I found a need for different instances of Nuttx as the development progress
nxtipXXX - direct bitbucket/nuttx with target build
nxoh4wk - nuttx Olimex-STM32-h407 Work tree 
nxoh4sg - ditto stage tree
nxnkl25<xx> - nuttx  NXP FRDM-KL25 work/stage
nxnk64<xx>  - nuttx NXP FRDM-K64 work/stage

So assuming the target environment is Olimx-STM32-h407 I create two directories 
$ cd git
mkdir nxtipoh4   #my top level directory for pure nuttx code from tip built for Olimex-STM32-h407
mkdir nxoh4wk

cd nxoh4wk
#I've forked to the specific repos below
git clone git@bitbucket.org:<user>/anuttx.git nuttx
git clone git@bitbucket.org:<user>/nuttapps.git apps
#if first time on machine using make menuconfig - need to set up Kconfigs)
git clone https://bitbucket.org/nuttx/tools.git tools

#end first time Kconfigs

cd nuttx
  
$ tools/version.sh -b 160405_1103 -v 7.15 .version
make distclean

cd  tools
#use a starting config
./configure.sh olimex-stm32-h407/nsh

cd ..

source setenv_xx.sh (if first time)

make menuconfig #ensure host is correct, save and then exit to use latest format

make #test build, should work and be tested before continuing
(cable to serial port, teraTerm 19200 to serial port)

#next create the working feature branched workflow environment of your choice
git checkout -b work_featurebranchAA
cd ../apps
git checkout -b work_featurebranchAA

# now can edit in either nuttx or apps and it will be tracked.

#Optionally an instance can be created for the tip - and differences between the forked branch can be seen using meld or something similar.

cd ../nxtipoh4
git clone git@bitbucket.org:nuttx/nuttx.git nuttx
git clone git@bitbucket.org:nuttx/apps.git apps

# then build - see above

No comments:

Post a Comment