Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
desp_howtools_erko.txt 12.19 KiB
* RadioHDL with GIT (LOFAR2.0)
* RadioHDL with SVN (APERTIF/ARTS)
* GIT workflow
* Confluence
* Polarion
* Latex
* Markdown

*******************************************************************************
* RadioHDL with GIT
*******************************************************************************

# Setup vendor specific environment variables in .bashrc

  * bashrc defines root directories that contain one or more versions of tool installations
    - define MENTOR_DIR : modelsim installations
    - define ALTERA_DIR : altera installations
    - define MODELSIM_ALTERA_LIBS_DIR  : compiled modelsim simulation libraries for altera components

    - LM_LICENSE_FILE=<our_license@our_compagny>

# Setup RadioHDL development environment for hdl/. The hdl/libraries, hdl/boards and hdl/applications are
# developed simultaneously and therefor in one git hdl/ repository

> cd ~/git/hdl

> . ./init_hdl.sh    

  * init_hdl.sh defines:
    - RADIOHDL_WORK directory for where the source code resides
    - RADIOHDL_BUILD_DIR directory for where the targets will be build
    - HDL_IOFILE_SIM_DIR=${RADIOHDL_BUILD_DIR}/sim for simulating with Modelsim using file IO
  
  * init_hdl.sh copies git user_components.ipx into Altera dir's
    - cp ${RADIOHDL_WORK}/hdl_user_components.ipx $altera_dir/ip/altera/user_components.ipx
  
  * init_hdl.sh automatically also sources ../radiohdl/init_radiohdl.sh if necessary


source also radiohdl tools
. ../radiohdl/init_radiohdl.sh

  * init_radiohdl.sh defines:
    - RADIOHDL_GEAR directory of where the init_radiohdl.sh is located
    - RADIOHDL_BUILD_DIR = ${RADIOHDL_BUILD_DIR}/build if not already defined
    - RADIOHDL_CONFIG = ${RADIOHDL_GEAR}/config if not already defined
                                
  * init_radiohdl.sh extends:
    - PATH with ${RADIOHDL_GEAR}/core
                ${RADIOHDL_GEAR}/quartus
                ${RADIOHDL_GEAR}/modelsim
    - PYTHONPATH with ${RADIOHDL_GEAR}/core
                      ${RADIOHDL_GEAR}/components
    
                                    
> compile_altera_simlibs unb1   # creates build/unb1/hdl_libraries_ip_stratixiv.txt
                                # creates build/quartus/<tool version> simulation models that need to be moved
                                # manually to $MODELSIM_ALTERA_LIBS_DIR/<tool version>
                                
> generate_ip_libs unb1         # creates build/unb1/qmegawiz/
                                # creates build/unb1/quartus_sh --> empty dir, why is it there?
                                
> quartus_config unb1           # creates build/unb1/quartus/<hdllib libraries> for synthesis
                                # creates build/unb1/quartus/technology_select_pkg.vhd
                                
> modelsim_config unb1          # creates build/unb1/modelsim/<hdllib libraries> for simulation
                                # creates build/unb1/modelsim/modelsim_project_files.txt for Modelsim commands.do
                                # creates build/unb1/modelsim/technology_select_pkg.vhd
                                
> run_qsys unb1 unb1_minimal_qsys   # creates QSYS block in build/unb1/quartus/unb1_minimal_qsys
> run_qcomp unb1 unb1_minimal_qsys  # creates 

> run_modelsim unb1 &


*******************************************************************************
* RadioHDL with SVN
*******************************************************************************

echo "Uniboard trunk is selected"
export SVN=${HOME}/svnroot/UniBoard_FP7
#Setup RadioHDL environment for UniBoard2 and and new Uniboard1 applications
. ${SVN}/RadioHDL/trunk/tools/setup_radiohdl.sh
# Support old UniBoard environment (including Aarfaac and Paasar)
. ${SVN}/RadioHDL/trunk/tools/setup_unb.sh



*******************************************************************************
* GIT workflow
*******************************************************************************

difftool ?
mergetool ?

* Pro Git book by Scott Chacon: https://git-scm.com/book/en/v2
* YouTube : David Mahler part 1,2,3

Part 1:

# After GIT install
git version
git config --global http://user.name "EricKooistra"
git config --global http://user.email "erkooi@gmail.com"
git config --list
touch .gitignore       # create .gitignore if it does not already exist
.gitignore # file with working tree dirs and files to ignore, must also be commited

# To start a repo
cd ~/git
git init  # start new repo at this dir, creates .git/
git clone # get and start with existing repo
git clone git@git.astron.nl:desp/args.git
git clone git@git.astron.nl:desp/sampy.git

git status # what is in stage area and what is modified
git status -uno  # skip unversioned files

Three areas:
* working tree # local directory tree
| git add
v
* staging area (index)
|
v git commit
* history # .git repository with entire commit graph

# To use a repo
git add <dir>/<file>       # add to stage area, set for commit. Cannot add empty dir, need empty file in it
git add .                  # add all new and modified to stageing area
git diff                   # diff between file in working tree and staging area
git diff --staged          # diff between file in staging area and history
git rm <filename>          # remove file from working tree and stage the delete
git checkout -- <filename> # revert a working tree change
git reset                  # clear stage area
git reset HEAD <filename>  # revert staged change
git log -- <filename>      # show history of file
git checkout <version hash> -- s2 # retrieve file from history into staged area and working tree

Part 2:

git commit -m ""           # commit what is in stage area
git commit -a -m ""        # add to stage area and commit what is in stage area
alias graph="git log --all --decorate --oneline --graph"
git branch <branch name>   # creat branch
git branch # show branches
git checkout <branch name> # change working tree and stage area to branch
git checkout master
git merge <branch name> # Fast forward merge of branch name to master if there is a direct path
                        # by moving master to branch name, this is when there have been no updates
                        # on the master branch since the branch was created.
                        # Three way merge combine the differences of the branch and the master
                        # compared to their common version, this can lead to merge conflicts if
                        # changes on both branches occur at same parts of a file.
git branch --merged # show branches that have been merged to master
git branch -r
git branch -a # show all local and remote branches

git branch -d <branch name> # remove branch
git checkout <commit hash> # detached HEAD because it points to a version not a branch
git branch <branch name> # start a branch from the commit hash, HEAD is attached again

# Stash area to store working tree
git stash save "comment" # store working tree and stage area to get a clean
git stash list # show all stashes
git stash apply <label> # restore stash
git stash apply # restore last stash


Part 3: Remote repositories (Github, Gitlab, Bitbucket, ...)

create repo on Github
http://README.md # md = mark down
git clone <url:.../<repo name>.git> # get copy from url
cd <repo name>
git config --local http://user.name "EricKooistra"
git config --local http://user.email "erkooi@gmail.com"
git remote # origin
git remote -v # full url

# To align with remote repo
# update from remote
git status # shows also origin/master, but not live
git fetch origin
git status # shows also origin/master, now with latest remote
git merge origin/master
git pull # get latest from remote repo, combines fetch and merge

# upload to remote
git push
git push origin master  # put local repo to remote repo

# On Github fork is a copy of the a repo in Github to get a repo on your account
git clone <url of fork> # get copy of fork repo, will be origin
git remote add upstream <url of original repo on Github> # will be upstream
git fetch upstream
git status
# commit local change on branch
# git push origin <branch name> # push to my fork repo on Github
# pull request on Github
# delete branch and fetch npstream if the pull request was accepted
git remote remove <remote name> # remove a remote repo

Review process using Gitlab and Git

* Jira ticket defines the work to be done
* coder works on branch with Jira ticket number
* manually run regression test to test the changes (for Casacore SW the merge
  request makes github automatically issue a regression test in the cloud)
* coder does merge request to reviewer
* gitlab will warn if the branch will lead to a merge conflict, the coder then
  first has to fix the merge conflict by merging the master to the branch:
  The merge can use merging or rebasing, Ger typically uses merging. On local
  machine the coder resolves the merge conflict:

    git checkout master
    git pull
    git checkout stat-313
    git merge master
    git status   # to see merge conflicts, edit file to solve merge conflict
    git add file
    git commit
    git push
  
* reviewer reviews the code per line and in general comments in gitlab GUI,
  so no need to pull the branch locally
* Use 'Open in Web IDE' button to see max about 10 changes, Use 'Changes' menu
  to see all changes. Green is new file, orange is change file, + is new lines
  - is removed lines.
* coder does updates on branch until both coder and reviewer are ok, they are
  notified by gitlab
* when review is done then the reviewer does the merge.
* the merge automatically deletes the branch (if selected to do so in gitlab)
  locally the coder manually needs to delete the branch:
  
    git branch
    git checkout master
    git status
    git branch -d stat-313
    git status
    
* Use Jira tag in commit message to have link between GIT and Jira. The link
  was made via Settings/Intergations/Jira

Note:
* In github a merge request is called a pull request
* Default a pull pulls the master. Typically it is not necessary to pull a 
  branch because the reviewer does not need to compile and run the code and
  because typically only one coder works on a branch.


*******************************************************************************
* Confluence:
*******************************************************************************
- space tools menu links onder om secties the ordenen.
- space tools menu, content tools, custom export to PDF --> to export multiple
  pages to PDF and to preserve th ASTRON logo in the export


*******************************************************************************
* Polarion:
*******************************************************************************


*******************************************************************************
* LaTeX
*******************************************************************************
- \sigma \sqrt{}
- 4.15 \cdot 10^{15}
- M =
    \left[ {begin{array}{cc}
    1 & 2 & 3 & 4\\
    5 & 6 & 7 & 8\\
    \end{array} } \right]



*******************************************************************************
* Markdown
*******************************************************************************

Text will wrap.

Backslash is escape chararcter.

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

Horizontal rules three or more of ***, ___, ---

*italic*
_italic_
**bold**
__bold__
**bold and _bolditalic_**    combined
`boxed`
~~strike through~~

Block quotes (alinea with an indent bar):
> Block text will wrap

Unordered list using *, -, +, indent >= 1 space
* Main item 1
* Main item 2          
 * sub item 2a  use 2 trailing spaces for return inside paragraph
 * sub item 2b
 
Ordered list 
1. Main item 1
2. Main item 2          
 2.1 sub item 2a
 2.2 sub item 2b
           
Images  
![Logo](path to image file)
![Logo](web link to image file)
![Logo][image1]

[image1]:web link to image file

Links:
[ASTRON]:https://www.astron.nl

Table:
|col1 | col2| Col3 |    column titles
|---|:---:|--:|    >= 3 dashes, colon for left, center, right align
| row text | row text | row text|
| row text | row text | row text|