Wednesday, July 6, 2016

Nuttx Traceable Builds

With a Nuttx.org / https://github.com/nuttx   derived software build I find myself on a steep learning curve, a new OS that is evolving, and finding software issue(s) - mostly mine :).

The very nature of software development.

Nuttx covers a lot of different processor families and processors within those families  ~ all with a uniquely created .config to define a specific build.

A lot of options, and not [many|any]  test setups. Very easy to delete that .config while building features.

While there is a lot of functionality and leading edge stuff-  when hitting  an issue it very much  feels like the bleeding edge.

Of course if its my application software that has the issue - I can solve it and update the build:). If it appears a  nuttx software its a challenge learning it, and all those layers and configuration parms. How is it supposed to work ?

So how to provide a definitive reference build, that I can come back to, or anybody else on the net can easily access when an issue comes up.?  Or if a minor issue, I can capture the description in a bug description, and move on. Standard stability testing philosophy.


git on bitbucket is powerful, and if the following files are changed and a pre-processor  mknx.sh run then a definitive snapshsot is captured and displayable with "nsh> uname -a"  .

This is a work in progress. So from "nsh> uname -a" it expands as follows:

NuttX 17.6 nxd47wk_wkd47tst1_20160712_2203 arm stm32f4discovery

Hopefully mostly self explanatory

<work_directory>_<branch>_<date>   <arch> <board>

<work_directory> nxd47wk - which in my terminology is nx STM32F4(07)discovery boad
<branch> wk_nxd47_wk
<date>  YYYYMMDD_HHMM

So building for stm32f4discovery on my networked Ubuntu machine (I ssh from windows)
$cd ~/git
$mkdir nxd47wk
$cd  nxd47wk
$git clone git@bitbucket.org:neilh20/anuttx.git nuttx

$git clone git@bitbucket.org:neilh20/nuttapps.git apps
$cd nuttx
$cd tools
$ ./configure.sh stm32f4discovery/nsh
$ cd ..
git checkout -b wkd47tst1
~/git/nxd47wk/nuttx (wkd47tst1)]$

edit .gitignore -->   remove /.config  /.Make.defs

edit include/nuttx/.gitignore --> remove config.h & version.h

$make menuconfigs 
Build Setup--> Build Host Platform (Linux)
System TypeàSTM32 Periperal Support [ ] OTG FS - disable CONFIG_STM32_OTGFS

<Save>

and then build - I manually update the Nuttx build# in mknx.sh

$mknx.sh
download to the target
$stwr
then in the TTY window ( I use Tera Term )
nsh>
NuttShell (NSH) NuttX-17.6
nsh> uname -a
NuttX 17.6 nxd47wk_wkd47tst1_20160712_2203 arm stm32f4discovery

nsh>
So I have a build, lets provide a mechanism that can enable it to be duplicated somewhere else in the cyber world - like another directory.
Back on Ubuntu (an example)
~/git/nxd47wk/nuttx (wkd47tst1)]$ git commit -a -m "first nxtst17.6_nxd47wk_wkd47tst1_20160712_2203"

$git tag nxd47wk_wkd47tst1_20160712_2221 
$git push origin  wkd47tst1

now in another terminal window to my ubuntu machine I can duplicate that build (technically anywhere else in a nuttx linux environment with tools setup)
<New SSH term>
$mkdir nxd47tsta
$cd nxd47tsta
$git clone git@bitbucket.org:neilh20/anuttx.git nuttx

$git clone git@bitbucket.org:neilh20/nuttapps.git apps
$cd nuttx
$git checkout wkd47tst1  
$make
$stwr
and switching to the TTY connected with STM32F4(07)discovery 
- I get exactly the same build info

NuttShell (NSH) NuttX-17.6
nsh> uname -a
NuttX 17.6 nxd47wk_wkd47tst1_20160712_2221  arm stm32f4discovery
nsh>

            ~!~    It worked    ~!~:)

------------------------------------
where mknx.sh is in your ~/bin

#!/bin/bash
#  make with uptodate tag - uname -a
#chmod 755
function get_branch() {
      git branch --no-color | grep -E '^\*' | awk '{print $2}' \
        || echo "default_value"
      # or
      # git symbolic-ref --short -q HEAD || echo "default_value";
}
build_num=$(date +%Y%m%d_%H%M)
#echo $(__git_ps1)
branch_name=`get_branch`;
#repo_tree=${PWD##*/}
repo_tree=$(pwd | cut -d'/' -f5)
#echo "$repo_tree"
blabel="$repo_tree""_$branch_name""_$build_num"
echo "Building $blabel"
tools/version.sh -v 17.6 -b "$blabel" .version
make

------------------
similarly I have an alias stwr to ~/bin/st-flash-wr.sh

#!/bin/bash
#chmod 755
bin_file="nuttx.bin"
if [ "$1" != "" ]; then
    #echo "Using file $1"
    bin_file=$1
fi
echo "st-flash write $bin_file 0x8000000"
st-flash write $bin_file 0x8000000
------
160713: This blog updated for a changed format nxd47wk_wkd47tst1_20160712_2203 





No comments:

Post a Comment