Commit 8bdb1181 authored by Javier Díaz's avatar Javier Díaz

including old doc

parent d9a84bf1
% Git mini-tutorial
% Benoit RAT
% 28 May. 2012
In git you should always work on your own branch.
* The first time you need to create it.
* Or if someone create you the branch you can only use it.
First time (create your own branch)
===================================
Download the repository.
git clone git@ohwr.org:white-rabbit/wr-nic.git
Create our own branch:
git branch sevensols
Switch to our own branch:
git checkout sevensols
Create an empty test file:
touch TEST
See the status of the repository:
git status
Add a file that you have created:
git add TEST
then commit it to your local branch:
git commit -m "blablabla"
Finally commit your local branch to the remote repository (**FOR THE FIRST TIME**), and if you have the permission to do it.
git push origin sevensols
First time (change to a created branch)
===================================
Download the repository
git clone git@ohwr.org:white-rabbit/wr-nic.git
Switch to your created branch
git checkout sevensols
Switch to your created branch
git checkout sevensols
Check that you are on the good branch
git branch
You should see something like this:
master
* sevensols
Which means that sevensols is the actual branch.
Committing
===================================
In git your commit when you have done one action, e.g, correct a bug, add a feature, add a module. In other words, each commit should represent an independant and usable stage in your project.
Check the status
--------------------
You should always check the status of your branch before and after committing
git status
Adding your files
--------------------
for example we have created in the folder *"./modules/wr_dio/"* the two following files:
* wr_dio.wb
* wr_dio.vhd
you can add them doing:
git add modules/wr_dio/wr_dio.wb
git add modules/wr_dio/wr_dio.wb
Or by doing (This will add all the files the directory "./modules/wr_dio/")
git add modules/wr_dio/.
Or by doing: (This will add all the files in a recursive way from the current directory)
git add .
Comitting the changes
--------------------
You should describe the changes done to ease the understanding of waht you have done in the code for other people
git commit -m "Adding the dio module in the repository"
And then you can send your change to remote repository
git push
Updating the master branch
===================================
you should first switch back to the master branch
git checkout master
Maybe you can verify on which branch you actually are
git branch
And then download the change by doing a pulling
git pull
Undoing
===================================
A good tutorial can be found here <http://learn.github.com/p/undoing.html>
Unstage
-----------------------------------
If you want to remove a file from a commit (unstage it) you can use
git reset HEAD <file>
You can also run a good tools to do this called `git-cola`
Unmodifying
-----------------------------------
*WARNING:* If you do this you will lost the *changes*:
git checkout -- <file>
Or if you have a lot of files:
git reset --hard HEAD
Git ignore files
===================================
To avoid commiting file that you don't want to track you should add them to the *.gitignore*
file.
You can use the wildcard to ignore some files, here is an example of root *.gitignore*
~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
# .gitignore file
# OS generated files #
######################
*.bak
*.*\#
\#*
.\#*
*.*~
*.swp
# Compiled source #
###################
*.bit
*.exe
*.o
*.so
*.wlf
*.vstf
*.vcd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Then each subfolder may also have its own .gitignore
for example we have for:
* ip_cores/.gitignore:
~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
# .gitignore file (for ip_cores/)
# We do not want to track anything in this directory because
# it is where modules are fetch from other repository
*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* syn/spec/.gitignore: Here we only want the manifest and maybe some config files but not all the generated file for ISE synthesis
~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
# .gitignore file (for syn/*/)
# Folder where the synthesis is done
# We want to ignore all the file generated by ISE for synthesis
# except the Manifest.py and the xise project
*
!Manifest.py
!wr_nic.xise
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Syncronization Master & Branches
=================================
Master => branch
---------------------------------
Making sure changes on master appear in your branch
git rebase master
branch => master
--------------------------------
This one is more delicate
First, switch back to the master branch:
git co master
Check to see what changes you’re about to merge together, compare the two branches:
git diff master xyz
If you’re in a branch that’s not the xyz branch and want to merge the xyz branch into it:
git merge xyz
### Reverting changes to before said merge
git reset --hard ORIGHEAD
Using Patch
=================
You can create a list of patch by doing:
git format-patch <revision>
Then you can apply them using
git am <0001-nombre-del-patch>
git am <0002-nombre-del-patch>
If you obtain a conflict for the second patch you can solved it by searching the files that are in conflict:
git status
And resolving it by hand using meld (or similar)
meld <conflict files>
Once you have
git add <the fixed files>
git am --resolved
Rebasing (Ordering and removing errors)
==========================================
If you want to keep as clean as possible a list of patch, you can use the rebase command (see [rebase]):
First you obtain the log of your patches:
git log --oneline
~~~~~~~~~~~~~~~~~~~~
f1500fc bopyt: bad commit msg
60fa4ab ddr: patch final
bf44f22 test: Stupid test that can be removed from history
536741f ddr: Step in between (not usufull)
b611a95 cpu: Something we want to keep
c7d4d29 ddr: first intent to use ddr
be6e661 boot: something about boot which is correct
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Then you might save the state using a tag in case something went wrong
git tag "v3.1-notrebased"
Then you need to rebase: for this you need to select the step before the thing you want to change:
git rebase -i be6e661
And you will have to modify the file like:
~~~~~~~~~~~~~~~~~~~~{.bash}
## Original file
pick c7d4d29 ddr: first intent to use ddr
pick b611a95 cpu: Something we want to keep
pick 536741f ddr: Step in between (not usufull)
pick bf44f22 test: Stupid test that can be removed from history
pick 60fa4ab ddr: patch final
pick f1500fc bopyt: bad commit msg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~{.bash}
## Saved file
pick b611a95 cpu: Something we want to keep
pick c7d4d29 ddr: first intent to use ddr
fixup 536741f ddr: Step in between (not usufull)
squash 60fa4ab ddr: patch final
reword f1500fc bopyt: bad commit msg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
And you will obtain something like
~~~~~~~~~~~~~~~~~~~~
8ac18d8 boot: bad commit msg corrected
ac85ae5 ddr: patch final
c554a3e cpu: Something we want to keep
be6e661 boot: something about boot which is correct
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In case you have done something bad you can go back to your tag[^1] (by doing an hard reset)
git reset --hard v3.1-notrebased
[^1]: In the case you don't have a tag, you can find the hash previous the rebase using: `git reflog --all`
Misc
==============
Dropbox
-------------------
If you want to use git and dropbox at the same time you can mount your dropbox directory somewhere in your git path
sudo mount --bind SOURCEDIRECTORY TARGETDIRECTORY
References
===================================
* Git cheat-sheet: <http://help.github.com/git-cheat-sheets/>
* Learn Git: <http://learn.github.com/>
* Git SVN crash course: <http://git.or.cz/course/svn.html>
* Ignore files: <http://help.github.com/ignore-files/>
* Rebasing: <http://codeutopia.net/blog/2009/12/10/git-interactive-rebase-tips/>
****************************************************************
*This document is written in markdown syntax and can be generated using pandoc*
SRC=$(wildcard *.mkd)
PDF=$(addprefix pdfs/, $(SRC:.mkd=.pdf))
TEX=$(SRC:.mkd=.tex)
OPTIONS=-f markdown --toc --number-sections --smart
TEMPLATE=pandoc.latex
ifneq "$(TEMPLATE)" ""
TEMPLATEARG=--template=$(TEMPLATE)
endif
all: $(PDF)
tex: $(TEX)
#--highlight-style=pygments (the default), kate, monochrome, espresso, haddock, and tango
#-V highlight-bg=true
pdfs/%.pdf: %.mkd Makefile $(TEMPLATE)
@echo "$(dir $@) $< $^ $(PDF)"
pandoc $(OPTIONS) --latex-engine=xelatex --highlight-style=haddock $(TEMPLATEARG) \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -o $@ $<
%.tex: %.mkd Makefile $(TEMPLATE)
pandoc $(OPTIONS) --highlight-style=haddock $(TEMPLATEARG) \
-V lang=english -V fontsize=11pt -V documentclass=article -o $@ $(@:.tex=.mkd)
test: test.mkd Makefile $(TEMPLATE)
pandoc $(OPTIONS) --latex-engine=xelatex --highlight-style=haddock $(TEMPLATEARG) \
-V lang=english -V fontsize=11pt -V documentclass=article -o $@.pdf $@.mkd
.PHONY: clean
clean:
rm -f pdfs/*.pdf *~ *.tex *.log
% NOTES: Bash Scripting
% Benoit RAT
% 02 May. 2012
Special keywords
=======================
* `!$` Last arguments in shell
* `!*` All last arguments
* `!!` Last command in shell
Parsing arguments
=======================
Below one of the best way to parse args in bash script
~~~~~~~~~~~~~{.bash}
#!/bin/bash
echo "OPTIND starts at $OPTIND"
while getopts ":pq:" optname
do
case "$optname" in
"p")
echo "Option $optname is specified"
;;
"q")
echo "Option $optname has value $OPTARG"
;;
"?")
echo "Unknown option $OPTARG"
;;
":")
echo "No argument value for option $OPTARG"
;;
*)
# Should not occur
echo "Unknown error while processing options"
;;
esac
echo "OPTIND is now $OPTIND"
done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Otherwise you can try an easyway to parse it withou getopts
~~~~~~~~~~~~~{.bash}
while [ $# -gt 0 ]; do # Until you run out of parameters . . .
case "$1" in
-h|--help) showhelp;;
-c|--clean) rm -f $WRS_DONE_DIR/00*;;
-f|--fetch) echo "To be done";;
-l|--list) cd $WRS_DONE_DIR; ls 0*; exit 0;;
--step=0[0-9]) num=$(echo $1 | sed -e 's/--step=//');;
*) showhelp;;
esac
shift # Check next set of parameters.
done
~~~~~~~~~~~~~~~~~~~~~~~~~~
Path
=====================
Obtain full root dir of the script
----------------------------------------------
root="$(dirname $(/bin/pwd)/$0)"
You should use `dirname` or `basename` commands which are easier than sed
Obtain filename
---------------------------------------------
You can use `basename` function
Or you can find what is before the first dot by doing
~~~~~~~~~~~~~{.bash}
for f in `ls *.eps`; do
echo -n "Converting ${f%.*} ... "
convert -density 100 $f -flatten ${f%.*}.png;
echo " OK"
done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Checking
======================
return agurment
-------------------
which pandoc > /dev/null
if [ $? -ne 0 ]; ## If there is an error in previous command
fi
Bash special checking
------------------------
if [[ -z $var ]]; then ...; fi
Where we can use BASH conditional:
* `-z` = empty;
* `-n` = notempty;
* `-f` = file exist;
* `-d` = directory exist
OR
-------------------
if [[ $1 == "cviugr-v2" || $1 == "RECOMP" ]]; then
## Backup WORK folder
echo "OK"
else
echo "ERR"
fi
Redirection
===================
* stdout 2 file: `ls -l > ls-l.txt`
* stderr 2 file: `grep da * 2> grep-errors.txt`
* stdout & stderr 2 file: `rm -f $(find / -name core) &> /dev/null`
* stdout 2 stderr: `grep da * 1>&2`
* stderr 2 stdout: `grep da * 2>&1`
-- Memory map:
-- 0x00000000: WRPC
-- 0x00040000: WRSW NIC
-- 0x00060000: VIC
-- 0x00061000: TxTSU
-- 0x00062000: DIO
------------------------------------------------------------------------------
-- Constants declaration
------------------------------------------------------------------------------
constant c_BAR0_APERTURE : integer := 20;
constant c_CSR_WB_SLAVES_NB : integer := 1;
constant c_DMA_WB_SLAVES_NB : integer := 1;
constant c_DMA_WB_ADDR_WIDTH : integer := 26;
-------------------
-- WB Crossbar
-------------------
constant c_cfg_base_addr : t_wishbone_address_array(4 downto 0) :=
(0 => x"00000000", -- WRPC
1 => x"00040000", -- NIC
2 => x"00060000", -- VIC (IRQ gen)
3 => x"00061000", -- TxTSU
4 => x"00062000"); -- DIO
constant c_cfg_base_mask : t_wishbone_address_array(4 downto 0) :=
(0 => x"00040000",
1 => x"00060000",
2 => x"0007f000",
3 => x"0007f000",
4 => x"0007f000");
x"00000000" - x"0003FFFF" -- WRPC
x"00040000" - x"0005FFFF" -- NIC
x"00060000" - x"00060FFF" -- VIC (IRQ gen)
x"00061000" - x"00061FFF" -- TxTSU
x"00062000" - x"00062FFF" -- DIO
BASE_REGS = 0x300
BASE_GPIO = 0x200
BASE_I2C = 0x100
BASE_ONEWIRE = 0x0
I2C_ADDR_DAC = 0x48
I2C_ADDR_EEPROM = 0x50
I2C_PRESCALER = 400
PIN_PRSNT = 30
GPIO_LED_TOP = 27
GPIO_LED_BOTTOM = 28
DAC_CHANNEL_CORRESP=[0,1,2,7,4,5]
cbar_slave_i.adr <= cbar_slave_adr_words(29 downto 0) & "00";
-- WB Crossbar
constant c_cfg_base_addr : t_wishbone_address_array(3 downto 0) :=
(0 => x"00000000", -- ONEWIRE
1 => x"00000100", -- I2C
2 => x"00000200", -- GPIO
3 => x"00000300"); -- PULSE GEN & STAMPER
constant c_cfg_base_mask : t_wishbone_address_array(3 downto 0) :=
(0 => x"00000f00",
1 => x"00000f00",
2 => x"00000f00",
3 => x"00000f00");
NOT OFFICIAL, PLEASE REMOVE THIS FILE
El hdlmake no funciona sin permisos por tanto, el repositorio no puede estar en windows.
Po eso o por algo más, Thomasz me paso su hdlmake y este si funciona. No obstante parece que:
-Cuando hay "bajadas de repositorios anidadas", puede ser necesarios varios hdlmake -f
- Hay que ir paso a paso, generando el make para el ise y todo eso.
- Acoardarse de actualizar el proyecto de ise
- despues de eso, parece que finalmente va todo con hdlmake -l.
* Error en el paquete package wrcore_pkg, redefine el tipo: t_txtsu_timestamp
Solución: eliminar la definición del tipo y añadir use work.wrsw_txtsu_pkg.all;
a la entity xwr_core.
* PROBLEMA: NO GENERA .BIN
Tras compilar una vez, cambiar de:
<property xil_pn:name="Create Binary Configuration File" xil_pn:value="false" xil_pn:valueState="non-default"/>
A
<property xil_pn:name="Create Binary Configuration File" xil_pn:value="true" xil_pn:valueState="non-default"/>
Y volver a compilar.
<div id="testing-procedure-for-the-switch-draft"
><h1
><a href="#TOC"
>Testing procedure for the switch (Draft)</a
></h1
><ol start="0" style="list-style-type: decimal;"
><li
>Visual inspection, electrical inspection, powerup.<ul
><li
>Check if R5 is on, R3 is off (DMS=1)</li
></ul
></li
><li
>The PPTS</li
><li
>The PTS (Production test suite like SPEC)<ul
><li
>at the moment it is called alpha because we have only some script (no python).</li
></ul
></li
><li
>Benchmark test</li
><li
>Compliance test</li
></ol
><div id="the-apts-alpha-production-test-suite"
><h2
><a href="#TOC"
>The APTS (Alpha-Production Test Suite)</a
></h2
><div id="expected-testing-flow"
><h3
><a href="#TOC"
>Expected testing flow</a
></h3
><ol style="list-style-type: decimal;"
><li
>does ARM respond</li
><li
>internal RAM</li
><li
>DDR memory (EBI0)</li
><li
>Ethernet port</li
><li
>Dataflash memory</li
><li
>NAND memory (EBI1)</li
><li
>USB port</li
><li
>CPU-FPGA flashing:<ul
><li
>TK0, TD0</li
><li
>FPGA_INIT_B+FPGA_INIT_A</li
></ul
></li
><li
>CPU-FPGA channel (EBI1)</li
><li
>FPGA peripheral (PTS test)</li
></ol
><p
>The testing procedure for ARM was done with the following material:</p
><ul
><li
>Switch MCH Mini-backplane (rev 3.0pre)</li
><li
>3x mini-USB cable</li
><li
>1x USB-to-TTL converter (To connect easily to DBGU)</li
><li
>1x JTAG emulator (Jlink SAM-ICE from segger)</li
></ul
><p
>You also need to the package:</p
><ul
><li
>alpha-pts.tar.gz</li
></ul
></div
><div id="considerations"
><h3
><a href="#TOC"
>Considerations</a
></h3
><ul
><li
>The different step for the test should not be perform in bootstrap but in a linear way.</li
><li
>A first step is need to check: CPU &amp; DDR</li
><li
>The second step must executed respecting the following properties:<ul
><li
>Load all the following files at once: at91bootstrap.bin, barebox.bin, kernel, filesystem</li
><li
>Two way of loading files in case one failed: JTAG and USB</li
><li
>No use of TFTP for loading (in case ethernet is failing we want to check the other components)</li
></ul
></li
></ul
></div
><div id="actual-testing-flow-to-be-improved"
><h3
><a href="#TOC"
>Actual testing flow (to be improved)</a
></h3
><ol style="list-style-type: decimal;"
><li
><p
>Basic: testing the component that are need to load linux</p
><ol style="list-style-type: decimal;"
><li
>loading from CPU</li
><li
>Testing SRAM (if g45memtest is loading?)</li
><li
>Testing DDR (run g45memtest)</li
></ol
></li
><li
><p
>Advanced: testing all other components once the linux is loaded</p
><ol style="list-style-type: decimal;"
><li
>Ethernet (Loading files from TFTP*)</li
><li
>FPGA (flashing)</li
><li
>CPU-FPGA bus</li
><li
>USB bus</li
><li
>DF memory test</li
><li
>NAND memory test</li
><li
>Flashing test (Reading back after reboot*)</li
><li
>PTS (like SPEC) ...</li
></ol
></li
></ol
><p
>* To improve</p
><div id="basic-testing"
><h4
><a href="#TOC"
>Basic testing</a
></h4
><p
>First you should setup your tftp server and extract alpha-pts.tar.gz in the /tftpboot folder.</p
><p
>Connecting with JTAG and doing the following you should have:</p
><pre
><code
>speed 2
r
wreg &quot;R15 (PC)&quot; 300000
loadbin /tftpboot/g45memtest 0x300000
</code
></pre
></div
><div id="advanced-testing"
><h4
><a href="#TOC"
>Advanced testing</a
></h4
><p
>See http://www.segger.com/cms/jlink.html</p
><pre
><code
>./start
</code
></pre
><p
>Init the JTAG, and write register to go at RAM direction:</p
><pre
><code
>speed 2
r
wreg &quot;R15 (PC)&quot; 300000
</code
></pre
><p
>Set the bootstrap: loadbin at91bootstrap.bin 0x300000</p
><pre
><code
>loadbin /tftpboot/at91bootstrap.bin 0x300000
SetBP 0x300088 H
g
</code
></pre
><p
>Set the second boot:</p
><pre
><code
>speed a
loadbin /tftpboot/barebox.bin 0x73f00000
ClrBP 1
g
</code
></pre
><p
>Once you reach barebox terminal you may run:</p
><p
>Load the linux distrib:</p
><pre
><code
>tftp boot-fs-ben
sh boot-fs-ben
</code
></pre
><p
>Load the testing files:</p
><pre
><code
>tftp -g -r testing.sh 192.168.7.1
chmod +x ./testing.sh
./testing.sh
</code
></pre
></div
></div
></div
></div
>
% OHWR Generic setup tutorial
% Benoit RAT
% 20 Jun. 2012
Introduction
=============
This guide has been written to obtain a quick development environment for
an ohwr.org user.
We have used ***Ubuntu 12.04 (LTS) 32bits*** to perform the installation of the different components.
Hardware Tools
================
The common tools for all the hardware project in ohwr.org are:
* Xilinx ISE
* Hdlmake (Python)
* Git
* Subversion
To install git and subversion just look at [Global apt-get](#global-apt-get)
Xilinx ISE[^1]
------------------
[^1]: We have installed Xilinx ISE 13.2 on a 32bit linux platform in this tutorial, you might changes some parameters to fit your instalation
You can follow this <http://www.george-smart.co.uk/wiki/Xilinx_JTAG_Linux> to install Xilinx ISE on Linux.
The following steps try to briefly resume the steps after the Xilinx ISE instalation for a 32 bits platform
### Xilinx USB JTAG cable
First we download the required libraries
sudo apt-get install gitk git-gui libusb-dev build-essential libc6-dev fxload
Then we download the driver source
cd /opt/Xilinx
sudo git clone git://git.zerfleddert.de/usb-driver
Then we compile the driver:
cd usb-driver/
sudo make
And finally we set it up
./setup_pcusb /opt/Xilinx/13.2/ISE_DS/ISE/
### Xilinx Environment
Then we add Xilinx ISE to the **PATH** and create a **XILINX** variable by editing `${HOME}/.bashrc` and adding:
~~~~~~ {.bash}
export XILINX=/opt/Xilinx/13.2/ISE_DS/
PATH=$PATH:$XILINX/ISE/bin/lin
~~~~~~~~~~~~~~~~~~~~
HDLMake
------------
Download from git by executing the following command.
git clone git://ohwr.org/misc/hdl-make.git
And then install by putting hdlmake executable somewhere in the PATH
* If you have root access we suggest you do copy or link hdlmake to the `/usr/local/bin`, this way hdlmake will be installed for all users:
<!-- -->
sudo ln -s /opt/hdlmake/hdlmake /usr/local/bin/hdlmake
* If you don't have root access the best way is to modify the path variable by editing `${HOME}/.bashrc` and adding:
<!-- -->
PATH=$PATH:~/hdlmake/
Finally you should check that it work `hdlmake --help`
Fake modelsim error
---------------------
This operation might be not usefull on all computer
You need to perform the following steps
sudo mkdir /opt/modelsim
cd /opt/modelsim
touch modelsim.ini
mkdir linux
touch linux/vsim
chmod +x linux
Setting the environment (editing `${HOME}/.bashrc`) you must also add modelsim
(vsim executable to the path), because it needs to find modelsim.ini
~~~~~~ {.bash}
export MODELTECH=/opt/modelsim
PATH=$PATH:${MODELTECH}/linux
~~~~~~~~~~~~~
Software Tools
=================
The common tools used for the sofware project in ohwr are
* Git
* Subversion
* build-essentials: *Contains various binaries to build source code*
* Kernel sources: *Might be usefull to compile drivers & kernel modules*
* minicom: *Hyperterminal for linux*
* LM32 cross compiler
Global apt-get
--------------------
Just enter the following command
sudo apt-get install git subversion build-essential build-dep linux minicom
* javi -- > error la linea anterior falla porque cree que build-dep es un paquete, habría que ponerlos en dos líneas, una de instal y la otra de build-dep
LM32 Cross-compiler:
-------------------------
You can install soc-lm32 cross compiler by downloading & extracting it to /opt/
wget http://www.das-labor.org/files/madex/lm32_linux_i386.tar.bz2
sudo tar -xvjf lm32_linux_i386.tar.bz2 -C /opt/
export PATH=/opt/lm32/bin/:$PATH
To use it you just need to export the **CROSS_COMPILER** variable:
export CROSS_COMPILER="/opt/lm32/bin/lm32-elf-"
* error --> javi: ahora es CROSS_COMPILE y por ello hay que añadirlo sin R
Texinfo & Markdown (Pandoc)
--------------------------
### Texinfo
Some documentation are written in texinfo format `.texi`
To compile them you just need to install it
sudo apt-get install texinfo
And then you should run `make` in the documentation folder. You can also try
texi2pdf --batch <filename>.texi
### Markdown
Markdown is the syntax used to easily generate pretty-formated documentation using plane text.
This document is written using the markdown syntax (And all `.mkd` documents)
The syntax is described <http://daringfireball.net/projects/markdown/>
However we use a special markdown syntax and we generate the tools using pandoc:
* Setup[^pandoc] : `sudo apt-get install pandoc`
* Syntax: <http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown>
* Simple call: `pandoc --toc -o output.pdf input.mkd`
[^pandoc]: If you use pandoc version older than `1.9`, you might have problem to generate pdf directly from markdown.
Installing gnurabbit PCIe driver
===================================
This driver (rawrabbit kernel module) must be installed in all the projects that use **SPEC** card (FMC DIO, FMC ADC, PTS, Starting Kit, ...)
As this tutorial is created for ubuntu distribution we propose the "cleanest" way to install it.
1. First, compile the module
#. Add the module file `rawrabbit.ko` in `/lib/modules/$(uname -r)/kernel/drivers/pci.`
#. Edit `/etc/modules` file and add a new line containing `rawrabbit`
#. Run `sudo update-initramfs -u`
#. and finally (after rebooting) the new module must be loaded as expected
* javi -- > error ahora va distinto, al menos el inicio que es donde he llegado.
COMPILACIÓN
Bajas spec-sw del repositorio, make y make install. Está documentado!
Importante (y lioso para ignorantes como yo) debes:
Añadir como variable de entorno al .bashrc
export LINUX=/usr/src/linux-headers-2.6.35-32-generic
La distribución viene depende de lo que tengamos y podemos verla con uname -r y viendo lo que hay en /usr/src
Ah, no olvidar reiniciar la máquina para que se cambien las variables
INSTALACIÓN
En el directorio, kernel, hacer make install
OHW Repositories Structure
=====================
As one can be easily lost inside the OHWR, we have tried to quickly resume the structure of the repositories
* HDLCore lib: *Sharing generic core for all OHWR projects*
* White Rabbit Core Collection: *Module specific to WR boards (WRS, SPEC, ...)*
* wr_softpll
* wr_lm32
* wr_endpoint
* ...
* DDR3 & QDRII
* LM32
* Whishbone Crossbar
* Whishbone serializer
* Whishbone Slave Generator: *Should be use when we want to create a new WB slave*
* ...
* White Rabbit: *Contains specific project for WR protocols and WR boards*
* WR Switch hardware
* WR Switch Software
* WR Switch HDL
* WR NIC
* PPSi
* ...
* FMC Projects: *Contains all FMC mezzanines & the carriers*
* SPEC, SVEC, SPEXI, ...
* DIO, ADC, TDC, ...
* ...
* Miscellaneous Projets
* Production Test Suite: *Test of specific boards, such as SPEC, DIO, ...*
* HDLMake: *Software to compile hdl core for OHWR project (modules from various repository)*
* ...
\documentclass[a4paper,oneside,$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}
\usepackage{amssymb,amsmath}
\usepackage[left=2.2cm,right=2.2cm,top=3cm,bottom=3cm]{geometry}
\usepackage{ifxetex,ifluatex}
\ifxetex
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else
\ifluatex
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else
\usepackage[utf8]{inputenc}
\fi
\fi
$if(natbib)$
\usepackage{natbib}
\bibliographystyle{plainnat}
$endif$
$if(biblatex)$
\usepackage{biblatex}
$if(biblio-files)$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(bg-color)$
%%%%%%%%%% Background color %%%%%%%%%%%%%%%%%%%%
% redefine environment 'verbatim" which is used to hold the code of any language.
\usepackage{framed}
\let\oldverbatim=\verbatim
\renewenvironment{verbatim}
{
\begin{snugshade}
\begin{oldverbatim}
}
{
\end{oldverbatim}
\end{snugshade}
}
% Redefined \textttt to add it background color
\usepackage{soul, color, url}
\sethlcolor{shadecolor}
\let\OldTexttt\texttt
\renewcommand{\texttt}[1]{\OldTexttt{\hl{#1}}}
% Add highlighting environment (when background color)
$if(highlighting-macros)$
$highlighting-macros$
\renewenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
$endif$
%% Define the background (shade) color
\usepackage{color}
\definecolor{shadecolor}{RGB}{$bg-color$}
$else$
$if(highlighting-macros)$
% Add highlighting environment (without background color)
$highlighting-macros$
$endif$
$endif$
$if(verbatim-in-note)$
%\usepackage{fancyvrb}
$endif$
\usepackage{float}
\usepackage{ctable}
$if(fancy-enums)$
% Redefine labelwidth for lists; otherwise, the enumerate package will cause
% markers to extend beyond the left margin.
\makeatletter\AtBeginDocument{%
\renewcommand{\@listi}
{\setlength{\labelwidth}{4em}}
}\makeatother
\usepackage{enumerate}
$endif$
$if(tables)$
\usepackage{ctable}
\usepackage{float} % provides the H option for float placement
$endif$
$if(url)$
\usepackage{url}
$endif$
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
\else\Gin@nat@width\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
$if(subscript)$
\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
$endif$
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
$if(numbersections)$
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
$if(lang)$
\ifxetex
\usepackage{polyglossia}
\newcommand{\euro}{}
\setmainlanguage{$lang$}
\else
\usepackage{babel}
\usepackage{eurosym}
\fi
$endif$
\usepackage{calc}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[R]{\nouppercase{\leftmark}}
%%\fancyfoot[L]{ www.sevensols.com/whiterabbitsolution}% empty left
\fancyfoot[L]{\raisebox{-25pt}{\includegraphics{logo.png}}}
\fancyfoot[R]{\raisebox{-15pt}{\thepage}}
\pagestyle{fancy} % Sets fancy header and footer
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex
xetex,
colorlinks=true,
urlcolor=blue,
anchorcolor=blue,
linkcolor=blue]{hyperref}
\else
\usepackage[unicode=true,
colorlinks=true,
linkcolor=blue]{hyperref}
\fi
\hypersetup{breaklinks=true, pdfborder={0 0 0}}
$for(header-includes)$
$header-includes$
$endfor$
$if(title)$
\title{$title$}
$endif$
$if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$}
$endif$
$if(date)$
\date{$date$}
$endif$
% chapters
\usepackage{titlesec}
\titleformat{\chapter}[block]
{\normalfont\LARGE\bfseries}{\LARGE\thechapter.}{1ex}{}
\titlespacing*{\chapter}{0pt}{-19pt}{0pt}
\usepackage{pbox}
% Less vertical space between list items
\setlength{\itemsep}{0cm}
% Less vertical space before a list
\setlength{\topsep}{0cm}
\setcounter{secnumdepth}{4}
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1pt\hfill \kern \z@}
\renewcommand{\maketitle}{\begin{titlepage}%
\let\footnotesize\small
\let\footnoterule\relax
\parindent \z@
\reset@font
\null\vfil
\begin{flushleft}
\Huge \textbf{\@title}
\end{flushleft}
\par
\hrule height 4pt
\par
\begin{flushright}
\large \@date \par
\end{flushright}
\vskip 550\p@
\vfil\null
\begin{flushleft}
\Large \textbf{\@author}
\end{flushleft}
\hrule height 2pt
\end{titlepage}%
\setcounter{footnote}{0}%
}
\makeatother
\begin{document}
$if(title)$
\maketitle
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
\tableofcontents
\clearpage
$endif$
$body$
$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$
\end{document}
TEST
==========
inline verbatim
-----------------------
Here is a test inline verbatim (using *\\texttt{}* in latex): `echo "hello word"`
indented verbatim block
--------------------------
Here is a test using indented verbatim block (*\\begin{verbatim}...\\end{verbatim}* in latex)
sudo apt-get install dnsmasq
sudo service dnsmasq restart
quote block
--------------------------
Then a tets using quote block[^1] command
> Thanks for your reply.
> John
>
> > Hello John,
> > I am Steve from ....
> > ...
> > Sincerely,
> > Steve
[^1]: quote block doesn't work with different line as it should do. Is it normal?
highlight code
-------------------------------
And then using the highlight code
~~~~~~{.bash}
# specified interfaces
interface=eth0
# Dhcp range
dhcp-range=192.168.7.2,192.168.7.15,12h
# Enable dnsmasq's built-in TFTP server
enable-tftp
# Set the root directory for files availble via FTP.
tftp-root=/var/tftpboot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% NOTES: WR Starting Kits
% Benoit RAT
% 20 May. 2012
Components
===========
The starting kit is composed of various elements that you should find in the box:
* 2x SPECs boards compatible with *PCIe x16*
* 2x FMC DIOs 5CH TTL A
* 2x SFPs LC[^1]
* AXGE-1254-0531 (blue)
* AXGE-3454-0531 (violet)
* 1x LC-LC cable 5m
* 1x LEMO cable
[^1]: Included in standard version of starting kit.
Setup
===========
User
------------
In order to use the starting kit you need:
* The HDL bitstream of SPEC+DIO
* The Slave firmware
* The Master firmware
* The PCIe driver (Kernel module)
Development
-------------
### Tools
You must have installed the following tools:
* Xilinx ISE
* Git
* Build-essantials
* Kernel source
* Lm32 cross compiler
* Hdl make
For all these steps you can follow our guide [ohwr_development.pdf](ohwr_development.pdf)
### Setup
You can start by reading <http://www.ohwr.org/projects/wr-cores/wiki/Wrpc_core> but by resuming you can do:
First you need to synthetize HDL cores (Require hdlmake)
Install the
git clone git@ohwr.org:fmc-projects/spec/spec-sw.git
to compile the LM32 firmware for either slave or master. It turns out that both wrc.bin/ram sets of files are identical, no matter if I call
'make WRMODE=master' or 'make WRMODE=slave'
References
============
* SFPs information <http://www.ohwr.org/projects/white-rabbit/wiki/SFP>
* SPEC demos manual <http://www.ohwr.org/projects/spec-sw/documents>
% NOTES: WR switch
% Benoit RAT
% 22 May. 2012
WR Switch HDL
===========
Setup
----------------
You need to setup the following tools:
* git
* hdlmake
* xilinx ise
* lm32 cross compiler
You should look at the guide [ohwr_development.pdf](ohwr_development.pdf) to install all these tools
### wr-switch-hdl
Get the latest version from git:
$ git clone git://ohwr.org/white-rabbit/wr-switch-hdl.git
Compile RT
----------------
Setup the *CROSS_COMPILE* variable
$ export CROSS_COMPILE="/opt/cc/lm32/bin/lm32-elf-";
Then execute `make` in *wr-switch-hdl/rt*.
Make and EDK bitstream loadable from ARM:
--------------------------------------
If you need to use Xilinx EDK to create a bitstream, you need to set it loadable from ARM.
In order to do this you need to go in EDK to `Project Files > Bitgen files (etc/bitgen.ut)`
And then add the following:
~~~~~~
-g TdoPin:PULLNONE
-g StartUpClk:CClk
#add other options here.
-d
-g Binary:yes
-g CRC:Enable
-g ConfigRate:50
-g UnusedPin:PullDown
-g DONE_cycle:4
-g GTS_cycle:5
-g GWE_cycle:6
~~~~~~~~~~~
WR Switch SW
=============
Setup development enviroment
-------------------------------
In order to run the switch in development environment[^1] you need to setup
* dhcp server
* tftp server
* nfs server
here a small tutorial[^2] that show you a simple way to install of these package.
[^1]:The development environment use Ubuntu LTS 12.04
[^2]:In this tutorial we have used the LAN 192.168.7.0/24, you can change it to the desired value.
### DHCP + TFTP: dnsmask package
An easy way to setup DHCP & TFTP server is given by the package dnsmasq[^3] :
$ sudo apt-get install dnsmasq
[^3]: Dnsmasq only permit to install a tftp server in read mode (write is not allowed)
then, you must open the file `/etc/dnsmasq.conf` and edit the following lines:
~~~~~~{.bash}
# specified interfaces
interface=eth0
# Dhcp range
dhcp-range=192.168.7.2,192.168.7.15,12h
# Enable dnsmasq's built-in TFTP server
enable-tftp
# Set the root directory for files availble via FTP.
tftp-root=/tftpboot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Once you have saved the file, you just need to restart the service
$ sudo service dnsmasq restart
### NFS Server
First install the packages
$ sudo apt-get install nfs-kernel-server nfs-common
Then edit the file `/etc/exports` and add:
/tftpboot 192.168.7.0/24(rw,no_root_squash,subtree_check)
Barebox
--------------------------
Here an example how partition should work.
* Mark the first partition with the partition ID “53” and copy the bootlets into this partition (currently not part of @b barebox!).
* Copy the default @b barebox environment into the second partition (no filesystem required).
* Copy the kernel into the third partition (no filesystem required).
* Create the root filesystem in the 4th partition. You may copy an image into this partition or you can do it in the classic way: mkfs on it, mount it and copy all required data and programs into it.
Flashing NAND
----------------------------
# Convert RootFS to JFFS2
To convert your rootfs to a jffs2 image you need to install `mtd-utils`
$ sudo apt-get install mtd-utils
And then you need to run:
$ mkfs.jffs2 --little-endian --eraseblock=0x20000 -n --pad -d ./rootfs -o jffs2-root.img
# Flashing from the switch
You need to erase both flash partition, and then write (with padding) the image.
flash_eraseall /dev/mtd0
nandwrite --pad /dev/mtd0 /zImage-usb
flash_eraseall /dev/mtd1
nandwrite --pad /dev/mtd1 /jffs2-root.img
FAQ
----------
### Problems with CP2102x USB to TTL:
In case you have problems to TX to the UART with the USB cp2102 chip you should not use minicom but tinyserial: http://brokestream.com/tinyserial.html
You can also disable hardware flow control.
Ctrl+A, O > Serial Port Setup > F
# Testing procedure for the switch (Draft)
0. Visual inspection, electrical inspection, powerup.
* Check if R5 is on, R3 is off (DMS=1)
* The PPTS
* The PTS (Production test suite like SPEC)
* at the moment it is called alpha because we have only some script (no python).
* Benchmark test
* Compliance test
## The APTS (Alpha-Production Test Suite)
### Expected testing flow
1. does ARM respond
* internal RAM
* DDR memory (EBI0)
* Ethernet port
* Dataflash memory
* NAND memory (EBI1)
* USB port
* CPU-FPGA flashing:
* TK0, TD0
* FPGA_INIT_B+FPGA_INIT_A
* CPU-FPGA channel (EBI1)
* FPGA peripheral (PTS test)
The testing procedure for ARM was done with the following material:
* Switch MCH Mini-backplane (rev 3.0pre)
* 3x mini-USB cable
* 1x USB-to-TTL converter (To connect easily to DBGU)
* 1x JTAG emulator (Jlink SAM-ICE from segger)
You also need to the package:
* alpha-pts.tar.gz
### Considerations
* The different step for the test should not be perform in bootstrap but in a linear way.
* A first step is need to check: CPU & DDR
* The second step must executed respecting the following properties:
* Load all the following files at once: at91bootstrap.bin, barebox.bin, kernel, filesystem
* Two way of loading files in case one failed: JTAG and USB
* No use of TFTP for loading (in case ethernet is failing we want to check the other components)
### Actual testing flow (to be improved)
1. Basic: testing the component that are need to load linux
1. loading from CPU
* Testing SRAM (if g45memtest is loading?)
* Testing DDR (run g45memtest)
* Advanced: testing all other components once the linux is loaded
1. Ethernet (Loading files from TFTP*)
* FPGA (flashing)
* CPU-FPGA bus
* USB bus
* DF memory test
* NAND memory test
* Flashing test (Reading back after reboot*)
* PTS (like SPEC) ...
\* To improve
#### Basic testing
First you should setup your tftp server and extract alpha-pts.tar.gz in the /tftpboot folder.
Connecting with JTAG and doing the following you should have:
speed 2
r
wreg "R15 (PC)" 300000
loadbin /tftpboot/g45memtest 0x300000
#### Advanced testing
See http://www.segger.com/cms/jlink.html
./start
Init the JTAG, and write register to go at RAM direction:
speed 2
r
wreg "R15 (PC)" 300000
Set the bootstrap: loadbin at91bootstrap.bin 0x300000
loadbin /tftpboot/at91bootstrap.bin 0x300000
SetBP 0x300088 H
g
Set the second boot:
speed a
loadbin /tftpboot/barebox.bin 0x73f00000
ClrBP 1
g
Once you reach barebox terminal you may run:
Load the linux distrib:
tftp boot-fs-ben
sh boot-fs-ben
Load the testing files:
tftp -g -r testing.sh 192.168.7.1
chmod +x ./testing.sh
./testing.sh
\ No newline at end of file
% Visual & Electrical Inspection
% Benoit RAT, Gabriel Ramirez
% 18 Jun. 2012
Visual Inspection:
===================
The first inspection to perform is to check that the PCB fulfil the IPC-610 Class-2 regulation.
This verification is complementary to the one realized by the PCB's assembler.
If the person in charge of realizing the inspection, is not qualified in IPC regulations,
we strongly recommended the use of the official IPC manual.
The following is a resume of the different points recommended to check:
1. General Clean Status
* Flux Residues
* Particulate Matter
* White Residues
* Surface Appearance
#. Soldering Anomalies:
* Free solder balls
* Excess Solder
* Fractured Solder
#. Component Mounting
* Orientation
* THT Connectors
#. Supported Holes
* THT pins length (<2.5mm)
#. Rectangular or Square Passive Components
* Side Overhang
* End Overhang
* Fillet Height
* End Overlap
* Billboarding
* Tombstoning
* Mounting Upside Down
#. Rectangular or Square SMD Chips
* Side Overhang
* End Joint Width
* Side Joint Length
* Hell Fillet Height
#. PCB
* Gold Surface Contact Area
* Laminate Conditions
#. QSS Samtec connector pins
Functional Tests:
====================
Short-circuit on main power supplies:
--------------------------------------
Before to plug the board to an external source, it is recommended to check the presence of short-circuit in the internal power
supplies, especially the ones connected to the BGA chips.
The test consist of a simple short-circuit check on the following decoupling capacitors:
1. +2V5 (C259)
#. +1V8 (C289)
#. +1V0 (C428)
#. +1V5 (C290)
#. +1V2_GTX (C247)
#. +1V0_GTX (C311)
#. +3V3 (C283)
Too quickly find these capacitors, a schema of the board has been included with the respective numbering.
![Voltage to check on various capacitors](SCB-electrical_test.png)
Supply Current at 12V:
------------------------------------
Once the short-circuit check has been executed, the board can be connected to the external power supply.
The first thing to compare is the supply current which is normally of good indicator of initial problems.
The supply current measured should be around `0.4A ±20%` including the miniBackplane consumption.
Power Supply Voltages:
------------------------------------
Finally, it is necessary to check the internal power supply and to make sure that they are in their functional limits (±10%).
The voltages that must be checked can be measured on the capacitors numbered in the previous figure and correspond to:
1. +2V5 (C259) => `2.5V±10%`
#. +1V8 (C289) => `1.8V±10%`
#. +1V0 (C428) => `1.0V±10%`
#. +1V5 (C290) => `1.5V±10%`
#. +1V2_GTX (C247) => `1.2V±10%`
#. +1V0_GTX C311) => `1.0V±10%`
#. +3V3 (C283) => `3.3V±10%`
#. +3V3_PLL (C266) => `3.3V±10%`
#. +2V5_PLL (C263) => `2.5V±10%`
#. QDRII_VTT (C414) => `0.9V±10%`
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment