<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rtime.felk.cvut.cz/hw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pecam1</id>
	<title>HW wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://rtime.felk.cvut.cz/hw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pecam1"/>
	<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php/Special:Contributions/Pecam1"/>
	<updated>2026-05-24T01:17:44Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=FPGA_simulace&amp;diff=3828</id>
		<title>FPGA simulace</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=FPGA_simulace&amp;diff=3828"/>
		<updated>2010-11-01T23:26:39Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: /* Zkouseny a zkusebni VHDL kod */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Zkouseny a zkusebni VHDL kod ====&lt;br /&gt;
&lt;br /&gt;
Chceme simulovat odezvu vlastnich bloku, napsanych ve [[VHDL]]. Prikladem budiz ctyrbitovy citac [[File:citac.vhdl]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library ieee;&lt;br /&gt;
use ieee.std_logic_1164.all;&lt;br /&gt;
use ieee.std_logic_arith.all;&lt;br /&gt;
use ieee.std_logic_unsigned.all;&lt;br /&gt;
use ieee.numeric_std.all;&lt;br /&gt;
&lt;br /&gt;
entity citac is&lt;br /&gt;
  port (&lt;br /&gt;
    clock: in std_logic;&lt;br /&gt;
    qcount: out std_logic_vector (3 downto 0)&lt;br /&gt;
  );&lt;br /&gt;
end citac;&lt;br /&gt;
&lt;br /&gt;
architecture behavioral of citac is&lt;br /&gt;
  signal counter: std_logic_vector (3 downto 0) := &amp;quot;0000&amp;quot;;&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
  qcount &amp;lt;= counter;&lt;br /&gt;
  &lt;br /&gt;
  seq: process&lt;br /&gt;
  begin&lt;br /&gt;
    wait until clock&#039;event and clock = &#039;1&#039;;&lt;br /&gt;
    counter &amp;lt;= counter + 1;&lt;br /&gt;
  end process;&lt;br /&gt;
&lt;br /&gt;
end behavioral;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Je treba vyplnit u registru pocatecni podminky (&amp;lt;code&amp;gt;signal counter: std_logic_vector (3 downto 0) := &amp;quot;0000&amp;quot;;&amp;lt;/code&amp;gt;). Uvedeny citac ma vyvedeny signaly &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt; (vstup hodin) a &amp;lt;code&amp;gt;qcount&amp;lt;/code&amp;gt; (4bit vystup). Nyni je treba vytvorit (opet ve VHDL) &#039;&#039;zkusebni nastroj&#039;&#039; (testbench), do nehoz bude citac (a pripadne i vice bloku) zapojen a ktery bude generovat zkusebni vstupni signaly. V tomto pripade je zkusebni signal jednoduchy, staci periodicke hodiny na signal &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Zde je kod zkusebniho nastroje [[File:citac_tb.vhdl]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library ieee;&lt;br /&gt;
use ieee.std_logic_1164.all;&lt;br /&gt;
use ieee.std_logic_arith.all;&lt;br /&gt;
use ieee.std_logic_unsigned.all;&lt;br /&gt;
use ieee.numeric_std.all;&lt;br /&gt;
&lt;br /&gt;
entity citac_tb is&lt;br /&gt;
end citac_tb;&lt;br /&gt;
&lt;br /&gt;
architecture behavioral of citac_tb is&lt;br /&gt;
  component citac&lt;br /&gt;
    port (&lt;br /&gt;
      clock: in std_logic;&lt;br /&gt;
      qcount: out std_logic_vector (3 downto 0)&lt;br /&gt;
    );&lt;br /&gt;
  end component;&lt;br /&gt;
  for citac_0: citac use entity work.citac;&lt;br /&gt;
  --&lt;br /&gt;
  signal clock: std_logic;&lt;br /&gt;
  signal qcount: std_logic_vector (3 downto 0);&lt;br /&gt;
begin&lt;br /&gt;
  citac_0: citac&lt;br /&gt;
    port map (&lt;br /&gt;
      clock =&amp;gt; clock,&lt;br /&gt;
      qcount =&amp;gt; qcount&lt;br /&gt;
    );&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  process&lt;br /&gt;
  begin&lt;br /&gt;
    clock &amp;lt;= &#039;0&#039;;&lt;br /&gt;
    wait for 1 us;&lt;br /&gt;
    clock &amp;lt;= &#039;1&#039;;&lt;br /&gt;
    wait for 1 us;&lt;br /&gt;
  end process;&lt;br /&gt;
&lt;br /&gt;
end behavioral;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entita nahore je prazdna, protoze zkusebni nastroj nema ven vyvedeny zadne signaly, neni to potreba. Nize je pak instanciovan citac a v tele nastroje je nekonecne dlouho bezici proces, ktery periodicky strida urovne na signalu &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt;. Je samozrejme mozne utvorit i konecne dlouho bezici zkusebni nastroje. Cas 1us jsem zvolil libovolne.&lt;br /&gt;
&lt;br /&gt;
==== Simulace v GHDL ====&lt;br /&gt;
&lt;br /&gt;
VHDL soubory je nyni mozne zkompilovat simulatorem GHDL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ghdl -a --ieee=synopsys citac.vhdl&lt;br /&gt;
ghdl -a --ieee=synopsys citac_tb.vhdl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a slinkovat do spustitelneho souboru:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ghdl -e --ieee=synopsys citac_tb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Volba &amp;lt;code&amp;gt;--ieee=synopsys&amp;lt;/code&amp;gt; je pouzita proto, ze jsem v prikladu pouzil nestandardni datove typy, obvykle ve svete FPGA, ale nestandardni vzhledem k IEEE VHDL. (Nerikam, ze je to dobre, chce to zjistit, zda se standardem budeme schopni vystacit.)&lt;br /&gt;
&lt;br /&gt;
Nasledne spustime simulaci&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ghdl -r citac_tb --vcd=citac.vcd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...ta bezi nekonecne, takze ji prerusime Ctrl-c. Byl zadan vystup do souboru ve formatu VCD, kde by se mely objevit prubehy vsech signalu.&lt;br /&gt;
&lt;br /&gt;
==== Prohlizeni prubehu ====&lt;br /&gt;
&lt;br /&gt;
===== GtkWave =====&lt;br /&gt;
&lt;br /&gt;
Soubor &amp;lt;code&amp;gt;citac.vcd&amp;lt;/code&amp;gt; prohledneme pomoci GtkWave:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gtkwave citac.vcd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pokud nas udivi, ze vidime jen casovou osu a zadne signaly, je treba v menu Search / Signal search hierarchy.. pridat signaly, ktere nas zajimaji, tedy &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt; a &amp;lt;code&amp;gt;qcount&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:citac_gtkwave.png|frame|Simulovane prubehy zobrazene v GtkWave]]&lt;br /&gt;
&lt;br /&gt;
===== Dinotrace =====&lt;br /&gt;
&lt;br /&gt;
Nekomu muze vice vyhovovat program [http://www.veripool.org/wiki/dinotrace Dinotrace]. Mj. nacita rovnez format &amp;lt;code&amp;gt;.vcd&amp;lt;/code&amp;gt;. Priklad zobrazeni signalu z mirne slozitejsiho obvodu je zde:&lt;br /&gt;
&lt;br /&gt;
[[Image:dinotrace.png|frame|Simulovane prubehy zobrazene v Dinotrace]]&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=File:Dinotrace.png&amp;diff=3827</id>
		<title>File:Dinotrace.png</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=File:Dinotrace.png&amp;diff=3827"/>
		<updated>2010-11-01T23:25:35Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=File:Citac_gtkwave.png&amp;diff=3826</id>
		<title>File:Citac gtkwave.png</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=File:Citac_gtkwave.png&amp;diff=3826"/>
		<updated>2010-11-01T23:25:04Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=UrJTAG&amp;diff=3825</id>
		<title>UrJTAG</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=UrJTAG&amp;diff=3825"/>
		<updated>2010-11-01T23:23:48Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: New page: ==== Program UrJTAG ====  Ke stazeni na [http://urjtag.org/] (nebo &amp;lt;code&amp;gt;apt-get install urjtag&amp;lt;/code&amp;gt;).   Verze 0.9 uspesne zkompilovana po konfiguraci &amp;lt;pre&amp;gt; ./configure --enable-cable --...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Program UrJTAG ====&lt;br /&gt;
&lt;br /&gt;
Ke stazeni na [http://urjtag.org/] (nebo &amp;lt;code&amp;gt;apt-get install urjtag&amp;lt;/code&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
Verze 0.9 uspesne zkompilovana po konfiguraci&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./configure --enable-cable --enable-bus --disable-nls --with-libftdi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verze 0.10 zkompilovana po&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./configure --without-ftd2xx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(tj. pro praci s FTDI brouky nebudeme pouzivat binarni knihovnu ftd2xx)&lt;br /&gt;
&lt;br /&gt;
==== Zavedeni nove soucastky do programu UrJTAG ====&lt;br /&gt;
&lt;br /&gt;
UrJTAG je mozne naucit pracovat s libovolnou soucastkou, k niz je k dispozici [[BSDL]] popis (vetsina vyrobcu tyto soubory poskytuje). Pokud mame novou soucastku, s kterou UrJTAG jeste neumi, musime popis vytvorit. Prikladem budiz FPGA Actel A3PE1500. Musime&lt;br /&gt;
&lt;br /&gt;
* sehnat BSDL popis, tj. stahnout u vyrobce [http://www.actel.com/documents/bsdl/A3PE1500_PQ208.bsd A3PE1500_PQ208.bsd]&lt;br /&gt;
* zjistit identifikacni cislo soucastky (&#039;&#039;id-code&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
Identifikacni cislo vycteme primo JTAGem. Pripojime desku se soucastkou k rozhrani JTAG a vypiseme cislo UrJTAGem:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
jtag&amp;gt; cable usbblaster&lt;br /&gt;
Connected to libftdi driver.&lt;br /&gt;
jtag&amp;gt; detect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(&amp;lt;code&amp;gt;usbblaster&amp;lt;/code&amp;gt; je jmeno pouziteho ovladace, v tomto pripade jsem pouzil zarizeni Altera USB Blaster). UrJTAG vypise, co nasel v JTAGovem retezci. V nejjednodussim pripade, kdy je v JTAG retezci pouze jedina soucastka, tj. ta, kterou hledame, bude vypis vypadat takto:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IR length: 8&lt;br /&gt;
Chain length: 1&lt;br /&gt;
Device Id: 00010010010100111010000111001111 (0x000000001253A1CF)&lt;br /&gt;
  Unknown manufacturer!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Z tohoto vycteme &#039;&#039;id-code&#039;&#039; v hodnote &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nyni jiz muzeme vytvorit soubory pro podporu soucastky. Tyto soubory UrJTAG skladuje v &amp;lt;code&amp;gt;/usr/share/urjtag&amp;lt;/code&amp;gt; (popr. &amp;lt;code&amp;gt;/usr/local/share/urjtag&amp;lt;/code&amp;gt;). Podadresare odpovidaji vyrobcum soucastek, jejichz seznam, trideny podle casti &#039;&#039;id-code&#039;&#039;, je v souboru &amp;lt;code&amp;gt;MANUFACTURERS&amp;lt;/code&amp;gt;. Vzhledem k tomu, ze Actel jeste v seznamu neni, pridame do &amp;lt;code&amp;gt;MANUFACTURERS&amp;lt;/code&amp;gt; radku:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00011100111     actel           Actel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cislo jsou bity 11..1 z &#039;&#039;id-code&#039;&#039; (pocitaji se zleva od nuly, jak je zvykem). Vytvorime podadresar &amp;lt;code&amp;gt;actel&amp;lt;/code&amp;gt; a v nem soubor &amp;lt;code&amp;gt;PARTS&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# bits 27-12 of the Device Identification Register&lt;br /&gt;
0010010100111010        A3PE1500_PQ208  A3PE1500_PQ208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Nasledne vytvorime dalsi podadresar &amp;lt;code&amp;gt;actel/A3PE1500_PQ208&amp;lt;/code&amp;gt; a v nem soubor &amp;lt;code&amp;gt;STEPPINGS&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# bits 31-28 of the Device Identification Register&lt;br /&gt;
0001    A3PE1500_PQ208  1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(tomuhle moc nerozumim, asi jde o nejakou podvariantu soucastky, zrejme nejake poradove cislo). Soubor &amp;lt;code&amp;gt;actel/A3PE1500_PQ208/A3PE1500_PQ208&amp;lt;/code&amp;gt; pak bude obsahovat samotny popis soucastky.&lt;br /&gt;
&lt;br /&gt;
Tento popis ziskame z BSDL souboru prikazem&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bsdl2jtag &amp;lt; A3PE1500_PQ208.bsd &amp;gt; actel/A3PE1500_PQ208/A3PE1500_PQ208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Od teto chvile by mel jiz UrJTAG poznat tuto soucastku:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
jtag&amp;gt; detect&lt;br /&gt;
IR length: 8&lt;br /&gt;
Chain length: 1&lt;br /&gt;
Device Id: 00010010010100111010000111001111 (0x000000001253A1CF)&lt;br /&gt;
  Manufacturer: Actel&lt;br /&gt;
  Part(0):         A3PE1500_PQ208&lt;br /&gt;
  Stepping:     1&lt;br /&gt;
  Filename:     /usr/local/share/urjtag/actel/A3PE1500_PQ208/A3PE1500_PQ208&lt;br /&gt;
jtag&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=FPGA_simulace&amp;diff=3824</id>
		<title>FPGA simulace</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=FPGA_simulace&amp;diff=3824"/>
		<updated>2010-11-01T23:22:16Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: New page: ==== Zkouseny a zkusebni VHDL kod ====  Chceme simulovat odezvu vlastnich bloku, napsanych ve VHDL. Prikladem budiz ctyrbitovy citac Soubor:citac.vhdl:  &amp;lt;pre&amp;gt; library ieee; use iee...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Zkouseny a zkusebni VHDL kod ====&lt;br /&gt;
&lt;br /&gt;
Chceme simulovat odezvu vlastnich bloku, napsanych ve [[VHDL]]. Prikladem budiz ctyrbitovy citac [[Soubor:citac.vhdl]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library ieee;&lt;br /&gt;
use ieee.std_logic_1164.all;&lt;br /&gt;
use ieee.std_logic_arith.all;&lt;br /&gt;
use ieee.std_logic_unsigned.all;&lt;br /&gt;
use ieee.numeric_std.all;&lt;br /&gt;
&lt;br /&gt;
entity citac is&lt;br /&gt;
  port (&lt;br /&gt;
    clock: in std_logic;&lt;br /&gt;
    qcount: out std_logic_vector (3 downto 0)&lt;br /&gt;
  );&lt;br /&gt;
end citac;&lt;br /&gt;
&lt;br /&gt;
architecture behavioral of citac is&lt;br /&gt;
  signal counter: std_logic_vector (3 downto 0) := &amp;quot;0000&amp;quot;;&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
  qcount &amp;lt;= counter;&lt;br /&gt;
  &lt;br /&gt;
  seq: process&lt;br /&gt;
  begin&lt;br /&gt;
    wait until clock&#039;event and clock = &#039;1&#039;;&lt;br /&gt;
    counter &amp;lt;= counter + 1;&lt;br /&gt;
  end process;&lt;br /&gt;
&lt;br /&gt;
end behavioral;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Je treba vyplnit u registru pocatecni podminky (&amp;lt;code&amp;gt;signal counter: std_logic_vector (3 downto 0) := &amp;quot;0000&amp;quot;;&amp;lt;/code&amp;gt;). Uvedeny citac ma vyvedeny signaly &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt; (vstup hodin) a &amp;lt;code&amp;gt;qcount&amp;lt;/code&amp;gt; (4bit vystup). Nyni je treba vytvorit (opet ve VHDL) &#039;&#039;zkusebni nastroj&#039;&#039; (testbench), do nehoz bude citac (a pripadne i vice bloku) zapojen a ktery bude generovat zkusebni vstupni signaly. V tomto pripade je zkusebni signal jednoduchy, staci periodicke hodiny na signal &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Zde je kod zkusebniho nastroje [[Soubor:citac_tb.vhdl]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
library ieee;&lt;br /&gt;
use ieee.std_logic_1164.all;&lt;br /&gt;
use ieee.std_logic_arith.all;&lt;br /&gt;
use ieee.std_logic_unsigned.all;&lt;br /&gt;
use ieee.numeric_std.all;&lt;br /&gt;
&lt;br /&gt;
entity citac_tb is&lt;br /&gt;
end citac_tb;&lt;br /&gt;
&lt;br /&gt;
architecture behavioral of citac_tb is&lt;br /&gt;
  component citac&lt;br /&gt;
    port (&lt;br /&gt;
      clock: in std_logic;&lt;br /&gt;
      qcount: out std_logic_vector (3 downto 0)&lt;br /&gt;
    );&lt;br /&gt;
  end component;&lt;br /&gt;
  for citac_0: citac use entity work.citac;&lt;br /&gt;
  --&lt;br /&gt;
  signal clock: std_logic;&lt;br /&gt;
  signal qcount: std_logic_vector (3 downto 0);&lt;br /&gt;
begin&lt;br /&gt;
  citac_0: citac&lt;br /&gt;
    port map (&lt;br /&gt;
      clock =&amp;gt; clock,&lt;br /&gt;
      qcount =&amp;gt; qcount&lt;br /&gt;
    );&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  process&lt;br /&gt;
  begin&lt;br /&gt;
    clock &amp;lt;= &#039;0&#039;;&lt;br /&gt;
    wait for 1 us;&lt;br /&gt;
    clock &amp;lt;= &#039;1&#039;;&lt;br /&gt;
    wait for 1 us;&lt;br /&gt;
  end process;&lt;br /&gt;
&lt;br /&gt;
end behavioral;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entita nahore je prazdna, protoze zkusebni nastroj nema ven vyvedeny zadne signaly, neni to potreba. Nize je pak instanciovan citac a v tele nastroje je nekonecne dlouho bezici proces, ktery periodicky strida urovne na signalu &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt;. Je samozrejme mozne utvorit i konecne dlouho bezici zkusebni nastroje. Cas 1us jsem zvolil libovolne.&lt;br /&gt;
&lt;br /&gt;
==== Simulace v GHDL ====&lt;br /&gt;
&lt;br /&gt;
VHDL soubory je nyni mozne zkompilovat simulatorem GHDL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ghdl -a --ieee=synopsys citac.vhdl&lt;br /&gt;
ghdl -a --ieee=synopsys citac_tb.vhdl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a slinkovat do spustitelneho souboru:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ghdl -e --ieee=synopsys citac_tb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Volba &amp;lt;code&amp;gt;--ieee=synopsys&amp;lt;/code&amp;gt; je pouzita proto, ze jsem v prikladu pouzil nestandardni datove typy, obvykle ve svete FPGA, ale nestandardni vzhledem k IEEE VHDL. (Nerikam, ze je to dobre, chce to zjistit, zda se standardem budeme schopni vystacit.)&lt;br /&gt;
&lt;br /&gt;
Nasledne spustime simulaci&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ghdl -r citac_tb --vcd=citac.vcd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...ta bezi nekonecne, takze ji prerusime Ctrl-c. Byl zadan vystup do souboru ve formatu VCD, kde by se mely objevit prubehy vsech signalu.&lt;br /&gt;
&lt;br /&gt;
==== Prohlizeni prubehu ====&lt;br /&gt;
&lt;br /&gt;
===== GtkWave =====&lt;br /&gt;
&lt;br /&gt;
Soubor &amp;lt;code&amp;gt;citac.vcd&amp;lt;/code&amp;gt; prohledneme pomoci GtkWave:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gtkwave citac.vcd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pokud nas udivi, ze vidime jen casovou osu a zadne signaly, je treba v menu Search / Signal search hierarchy.. pridat signaly, ktere nas zajimaji, tedy &amp;lt;code&amp;gt;clock&amp;lt;/code&amp;gt; a &amp;lt;code&amp;gt;qcount&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:citac_gtkwave.png|frame|Simulovane prubehy zobrazene v GtkWave]]&lt;br /&gt;
&lt;br /&gt;
===== Dinotrace =====&lt;br /&gt;
&lt;br /&gt;
Nekomu muze vice vyhovovat program [http://www.veripool.org/wiki/dinotrace Dinotrace]. Mj. nacita rovnez format &amp;lt;code&amp;gt;.vcd&amp;lt;/code&amp;gt;. Priklad zobrazeni signalu z mirne slozitejsiho obvodu je zde:&lt;br /&gt;
&lt;br /&gt;
[[Image:dinotrace.png|frame|Simulovane prubehy zobrazene v Dinotrace]]&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=FPGA&amp;diff=3823</id>
		<title>FPGA</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=FPGA&amp;diff=3823"/>
		<updated>2010-11-01T23:21:33Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: New page: * navod na simulaci FPGA bloku napsanych ve VHDL * prace s programem UrJTAG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* navod na [[FPGA simulace|simulaci FPGA]] bloku napsanych ve [[VHDL]]&lt;br /&gt;
* prace s programem [[UrJTAG]]&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Template:Main_Page/Hardware&amp;diff=3822</id>
		<title>Template:Main Page/Hardware</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Template:Main_Page/Hardware&amp;diff=3822"/>
		<updated>2010-11-01T23:20:45Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Boa5200]]&lt;br /&gt;
* [[ColdFire_DEMO52233 | ColdFire DEMO52233 (Board from Freescale)]] &lt;br /&gt;
* [[MIDAM MPC5200 DB1]] (Mikroklima)&lt;br /&gt;
* [[H8S/2638]]&lt;br /&gt;
* [[HC12 | Motorola HC12]]&lt;br /&gt;
* [[LPC21xx]]&lt;br /&gt;
* [[AT91SAM7X256]]&lt;br /&gt;
* [[PiMX1]] i.MX1 processor based board&lt;br /&gt;
* [[Wireless_Sensor_Networks | Wireless Sensor Networks (WSNs)]]&lt;br /&gt;
* [[ML403 | ML403 Xilinx Virtex-4]]&lt;br /&gt;
* [[FPGA]]&lt;br /&gt;
* [[Humusoft MF6xx]]&lt;br /&gt;
* [[OJ10 - welding robot]]&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Boa5200_HOWTO&amp;diff=3492</id>
		<title>Boa5200 HOWTO</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Boa5200_HOWTO&amp;diff=3492"/>
		<updated>2009-02-16T12:27:36Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: /* Updating root filesystem on BOA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This document describes how to install and setup Linux and development environment for BOA5200  board. &lt;br /&gt;
Assume that you have a development machine (your PC) that you use for development and building your applications which you consequently want to get running and test on BOA5200.&lt;br /&gt;
&lt;br /&gt;
==Serial line setting==&lt;br /&gt;
The easiest way to communicate with the board ,when there is no OS and remote shell running on it, is over serial line. Recommended serial communication program is minicom. Setup minicom as follows:&lt;br /&gt;
&lt;br /&gt;
Baud Rate – 38400&lt;br /&gt;
&lt;br /&gt;
Bits - 8&lt;br /&gt;
&lt;br /&gt;
Parity – N&lt;br /&gt;
&lt;br /&gt;
Stop Bits - 1&lt;br /&gt;
&lt;br /&gt;
Hardware Flow Control:- No&lt;br /&gt;
&lt;br /&gt;
Software Flow Control:- No&lt;br /&gt;
&lt;br /&gt;
After the setup you will see Redboot&amp;gt; command prompt. Here you can enter Redboot`s commands.&lt;br /&gt;
Redboot is a simple boot manager bulit upon eCos real-time OS. For more details , see http://ecos.sourceware.org/ecos/docs-latest/redboot/redboot-guide.html.&lt;br /&gt;
&lt;br /&gt;
==IP address setting in Redboot==&lt;br /&gt;
You can set ip address in Redboot using command &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/ip-address-command.html ip_address] instead of obtaing it &lt;br /&gt;
from DHCP server(see next section).&lt;br /&gt;
&lt;br /&gt;
 ip_address [-b] [-l] local_IP_address  [/netmask_length] ] [-h  server_IP_address] [-d DNS_server_IP_address]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 ip_address -l 192.168.100.1/24 -h 192.168.100.2&lt;br /&gt;
&lt;br /&gt;
==DHCP server setup==&lt;br /&gt;
Redboot supports BOOTP protocol which means that it is able to get network information (IP,netmask,gateway IP address,etc.) from DHCP server (provides BOOTP besides DHCP protocol).&lt;br /&gt;
&lt;br /&gt;
If you do not have a DHCP server on you network, you can install one on your development box: (on debian: apt-get install dhcpd) on your development machine. Example of my dhcp configuration file /etc/dhcpd.conf:&lt;br /&gt;
 # I have two ethernet interfaces: &lt;br /&gt;
 # eth0 - Internet&lt;br /&gt;
 # eth1 - connection to BOA5200 (IP= 192.168.10.1)&lt;br /&gt;
 # I do not want to progate infos to 147.32.0.0 subnetwork&lt;br /&gt;
 subnet 147.32.0.0 netmask 255.255.0.0 {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # private subnetwork&lt;br /&gt;
 subnet 192.168.10.0 netmask 255.255.255.0 {&lt;br /&gt;
  option broadcast-address 192.168.10.255;&lt;br /&gt;
  option routers 192.168.10.1;&lt;br /&gt;
  option subnet-mask 255.255.255.0;&lt;br /&gt;
  default-lease-time 600;&lt;br /&gt;
  max-lease-time 7200;&lt;br /&gt;
 &lt;br /&gt;
 # settings for BOA5200&lt;br /&gt;
  host BOA5200 {&lt;br /&gt;
   hardware ethernet 00:08:f1:11:22:33;&lt;br /&gt;
   fixed-address 192.168.10.2;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start dhcp server and reboot the board. After booting it has assigned IP, netmask and gateway address:&lt;br /&gt;
 +PHY0: AMD AM79C874&lt;br /&gt;
 FEC eth0: 100Mb/Full Duplex&lt;br /&gt;
 Ethernet eth0: MAC address 00:08:f1:11:22:33&lt;br /&gt;
 IP: 192.168.10.2/255.255.255.0, Gateway: 192.168.10.1&lt;br /&gt;
 Default server: 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
==TFTP server setup==&lt;br /&gt;
Redboot is able to load file from remote tftp server into memory. Tftp server is lanuched by inetd daemon when a new &lt;br /&gt;
connection comes. &lt;br /&gt;
Therefore add the following line into /etc/inetd.conf :&lt;br /&gt;
 tftp            dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd&lt;br /&gt;
&lt;br /&gt;
Default tftp root directory is /tftpboot. You can change it by calling in.tftpd with specified directory as a parameter.&lt;br /&gt;
&lt;br /&gt;
===Alternative way for Ubuntu based distro===&lt;br /&gt;
&lt;br /&gt;
1. Install tftpd and related packages.&lt;br /&gt;
 sudo apt-get install xinetd tftpd tftp&lt;br /&gt;
&lt;br /&gt;
2. Create /etc/xinetd.d/tftp and put this entry:&lt;br /&gt;
&lt;br /&gt;
 service tftp&lt;br /&gt;
 {&lt;br /&gt;
 protocol        = udp&lt;br /&gt;
 port            = 69&lt;br /&gt;
 socket_type     = dgram&lt;br /&gt;
 wait            = yes&lt;br /&gt;
 user            = nobody&lt;br /&gt;
 server          = /usr/sbin/in.tftpd&lt;br /&gt;
 server_args     = /tftpboot&lt;br /&gt;
 disable         = no&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
3. Make /tftpboot directory&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir /tftpboot&lt;br /&gt;
 sudo chmod -R 777 /tftpboot&lt;br /&gt;
 sudo chown -R nobody /tftpboot&lt;br /&gt;
&lt;br /&gt;
4. Start tftpd through xinetd&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/xinetd start&lt;br /&gt;
&lt;br /&gt;
see [[http://www.example.com Installing and setting TFTPD in Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
==Tool chain==&lt;br /&gt;
Toolchain(gcc, ld, ...) for MPC5200 can be downloaded from ftp://rtime.felk.cvut.cz/MPC5200/gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
Unpack the archive:&lt;br /&gt;
&lt;br /&gt;
 cd /&lt;br /&gt;
 tar xvzf gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
&lt;br /&gt;
You can also create a debian package from archive and then install the package:&lt;br /&gt;
 alien --to-deb gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
Note: If you are not root, use fakeroot to run the command.&lt;br /&gt;
&lt;br /&gt;
==Getting the kernel==&lt;br /&gt;
&lt;br /&gt;
Linux kernel sources patched for the board are maintained in a [http://rtime.felk.cvut.cz/gitweb/boa5200/linux.git separate git tree]. Use&lt;br /&gt;
  git clone git://rtime.felk.cvut.cz/boa5200/linux.git linux-boa5200&lt;br /&gt;
to download it.&lt;br /&gt;
&lt;br /&gt;
You can also download the [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/.config;hb=HEAD default kernel .config].&lt;br /&gt;
&lt;br /&gt;
==Building kernel==&lt;br /&gt;
&lt;br /&gt;
The simples way to build the kernel is putting the .config file (see the previous section) to the directory with sources and running:&lt;br /&gt;
 make ARCH=ppc CROSS_COMPILE=powerpc-603e-linux-gnu-&lt;br /&gt;
&lt;br /&gt;
After compilation a built image is placed into arch/ppc/boot/image directory.&lt;br /&gt;
&lt;br /&gt;
The following commnad will install modules into &#039;&#039;&amp;lt;directory&amp;gt;&#039;&#039;/lib/modules/...&lt;br /&gt;
 make INSTALL_MOD_PATH=&#039;&#039;&amp;lt;directory&amp;gt;&#039;&#039; modules_install   &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Recommendation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Instead of building the kernel in the sources directory, we recommend using of a separate build directory:&lt;br /&gt;
&lt;br /&gt;
1. Make the build directory under the linux sources&lt;br /&gt;
 mkdir _build&lt;br /&gt;
 cd _build&lt;br /&gt;
&lt;br /&gt;
2. Put the [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/.config;hb=HEAD default .config] and [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/GNUmakefile;hb=HEAD GNUmakefile] into this directory&lt;br /&gt;
&lt;br /&gt;
3. Optionally update the kernel configuration&lt;br /&gt;
 make menuconfig &lt;br /&gt;
kernel config file (.config) will be updated&lt;br /&gt;
&lt;br /&gt;
Next time, always run &amp;lt;tt&amp;gt;make menuconfig&amp;lt;/tt&amp;gt; from the _build directory&lt;br /&gt;
&lt;br /&gt;
4. Compile the kenrel and install modules&lt;br /&gt;
 make &amp;amp;&amp;amp; make modules_install&lt;br /&gt;
&lt;br /&gt;
If you often forget to switch to the build directory and run make in the source directory, put the following GNUmakefile into your source directory:&lt;br /&gt;
 ifeq ($(O),)&lt;br /&gt;
 $(error Please, run make in a different build directory (or use O= option))&lt;br /&gt;
 else&lt;br /&gt;
 include Makefile&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
==Updating RedBoot==&lt;br /&gt;
&lt;br /&gt;
You need to update RedBoot in order to boot Linux 2.6 kernel.&lt;br /&gt;
&lt;br /&gt;
Download ftp://rtime.felk.cvut.cz/MPC5200/MPC5200-2007.02.01-redbootROMRAM.srec &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;!!! Warning: File names are case-sensitive !!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 # load RedBoot image from tftp server into memory at the address 0x100000&lt;br /&gt;
 RedBoot&amp;gt;lo -b 0x100000 MPC5200-2007.02.01-redbootROMRAM.srec&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;!!! Warning: File names are case-sensitive !!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 # write image in flash memory&lt;br /&gt;
 RedBoot&amp;gt;fi cr RedBoot&lt;br /&gt;
 RedBoot&amp;gt;reset&lt;br /&gt;
&lt;br /&gt;
If upgrade fails you can fallback to ROM Redboot image by typing &#039;A&amp;amp;M:&#039;&lt;br /&gt;
&lt;br /&gt;
If image of [http://ecos.sourceware.org/ecos/docs-latest/redboot/startup-mode.html ROMRAM version] of RedBoot with name &amp;quot;RedBoot&amp;quot; (case sensitive!!) is not found in FLASH minimal version of ROM RedBoot is started. This version does not support many services like TFTP protocol and FLASH management. To download ROMRAM version of RedBoot to FLASH it is necessary to follow these steps:&lt;br /&gt;
&lt;br /&gt;
Load RAM version of RedBoot to BOA using xmodem (the image file MPC5200-2006.05.10-redbootRAM.srec is placed on BOA original CD):&lt;br /&gt;
 RedBoot&amp;gt; lo -m xmodem&lt;br /&gt;
&lt;br /&gt;
When finished RedBoot should answer with something like that:&lt;br /&gt;
&lt;br /&gt;
 CEntry point: 0x00080100, address range: 0x00080000-0x000bea04&lt;br /&gt;
 xyzModem - CRC mode, 5763(SOH)/0(STX)/0(CAN) packets, 1 retries&lt;br /&gt;
&lt;br /&gt;
Then start the RedBoot:&lt;br /&gt;
 RedBoot&amp;gt; go&lt;br /&gt;
&lt;br /&gt;
RAM RedBoot should start now. Download the new version of ROMRAM RedBoot to FLASH according to the steps above.&lt;br /&gt;
&lt;br /&gt;
== Loading kernel ==&lt;br /&gt;
&lt;br /&gt;
Place the compiled kernel to the tftpboot directory. Then you can test your new image on the board as follows:&lt;br /&gt;
 # load kernel image from tftp server into memory&lt;br /&gt;
   RedBoot&amp;gt; load zImage.elf&lt;br /&gt;
 &lt;br /&gt;
 # execute image; root directory (/) is on flash memory&lt;br /&gt;
   RedBoot&amp;gt; exec&lt;br /&gt;
If you want to load the kernel from different TFTP server than the one provided by DHCP, you can use the following command to set the IP address of your server:&lt;br /&gt;
   RedBoot&amp;gt; ip_address -h 147.32.86.&amp;lt;xxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CAUTION:&#039;&#039;&#039; you must boot the kernel by  RedBoot release at least 2007_02_01 otherwise it will not run! So you must load into RAM and then run the appropriate RedBoot image (or replace/update its image on flash with the new one - see  &lt;br /&gt;
the next section) and after then you can execute kernel image.&lt;br /&gt;
&lt;br /&gt;
To write the loaded kernel to FLASH memory, execute command &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-create-command.html fis create]:&lt;br /&gt;
Example:&lt;br /&gt;
    RedBoot&amp;gt; fis cr Linux -b 0x00800000 -r 0x00100000 -e 0x00100000 -l 0x116000&lt;br /&gt;
&lt;br /&gt;
To load the kernel from the FLASH are later, execute&lt;br /&gt;
    RedBoot&amp;gt; fis load Linux&lt;br /&gt;
(Then, you can perform exec -c &amp;quot;...&amp;quot; cmd.)&lt;br /&gt;
&lt;br /&gt;
To find out paramter values execute [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-list-command.html fis list].&lt;br /&gt;
&lt;br /&gt;
==NFS-root setup==&lt;br /&gt;
&lt;br /&gt;
During the development phase of application it must be tested many times. However, it is annoying to copy several application files to flash memory every time.  The practical solution is to mount via NFS working directory or whole root directory from the point of OS running on the board.&lt;br /&gt;
&lt;br /&gt;
You can download already prepared root directory from ftp://rtime.felk.cvut.cz/MPC5200/MPC5200_root_070321.tar.gz&lt;br /&gt;
&lt;br /&gt;
To export /var/MPC5200_root directory on your PC via NFS add the following line to &#039;&#039;&#039;/etc/exports&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 /var/MPC5200_root 192.168.10.0/255.255.255.0(rw,sync,no_root_squash)&lt;br /&gt;
&lt;br /&gt;
Then run command &amp;quot;&#039;&#039;&#039;exportfs -ra&#039;&#039;&#039;&amp;quot; so that the change take an effect.&lt;br /&gt;
&lt;br /&gt;
If you want MPC5200 to be mount as root directory instead of that one in flash memory:&lt;br /&gt;
 # load kernel image from tftp server into memory&lt;br /&gt;
  RedBoot&amp;gt; load zImage.elf&lt;br /&gt;
 # execute kernel image with information where to &lt;br /&gt;
 # find root directory in parameter string&lt;br /&gt;
  RedBoot&amp;gt; ex -c &amp;quot;root=/dev/nfs rw nfsroot=192.168.10.1:/var/MPC5200_root ip=dhcp&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To mount another directory from Boa use this command:&lt;br /&gt;
 mount -t nfs &amp;lt;ip&amp;gt;:/path/to/exported/dir /path/on/boa&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; exportfs is a part of knfs (Ubuntu) or nfs-kernel-server (Debian) package.&lt;br /&gt;
&lt;br /&gt;
==Updating root filesystem on BOA==&lt;br /&gt;
You can download already prepared root directory from ftp://rtime.felk.cvut.cz/MPC5200/MPC5200_root_070321.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create jffs2 image:&lt;br /&gt;
 mkfs.jffs2 -r MPC5200_root -o jffs2.img -b -e 0x10000&lt;br /&gt;
&lt;br /&gt;
On BOA:&lt;br /&gt;
&lt;br /&gt;
Delete old image:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-delete-command.html fis delete] jffs2&lt;br /&gt;
&lt;br /&gt;
Fill memory area at address 0x100000 of size 0xD00000 (size of root image + free space wanted) using &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/mfill-command.html mfill] command:&lt;br /&gt;
&lt;br /&gt;
 mfi -b 0x100000 -l 0xD00000 -p 0xffffffff&lt;br /&gt;
&lt;br /&gt;
Load root image to that memory area:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/download-command.html load] -r -b 0x100000 jffs2.img&lt;br /&gt;
&lt;br /&gt;
Write image to flash:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-create-command.html fis cr] -b 0x100000 jffs2 -l 0xD00000&lt;br /&gt;
&lt;br /&gt;
Root filesystem is mounted as read-only in Linux. To enable writting:&lt;br /&gt;
 mount -o remount,rw /&lt;br /&gt;
&lt;br /&gt;
--[[User:Molnam1|Molnam1]] 17:35, 15 December 2008 (CET)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remark:&#039;&#039;&#039; I have been unsuccessful doing these steps, maybe the filesystem has not been prepared correctly. However, there is another way to set up the JFFS2 filesystem in FLASH. If you mount a clean (0xff, 0xff,...) FLASH block device as -tjffs2, Linux will create the JFFS2 fs itself.&lt;br /&gt;
&lt;br /&gt;
Procedue (on BOA):&lt;br /&gt;
* fis create ...&lt;br /&gt;
* fis erase ...&lt;br /&gt;
* boot Linux with a root elsewhere (NFS)&lt;br /&gt;
* in Linux: mount -tjffs2 /dev/mtdblock2 /mnt&lt;br /&gt;
* voila, the fs is created; now, you can untar or cp -a root contents to /mnt&lt;br /&gt;
&lt;br /&gt;
--[[User:Pecam1|Pecam1]] 13:22, 16 February 2009 (CET)&lt;br /&gt;
&lt;br /&gt;
Linux kernel commandline to boot using root in FLASH block device is following:&lt;br /&gt;
    ex -c &amp;quot;root=/dev/mtdblock2 ro rootfstype=jffs2&amp;quot;&lt;br /&gt;
The number 2 of memory tech. device is a number of &amp;quot;jffs2&amp;quot; block in FLASH partitions list, example (0: (reserved), 1: RedBoot, 2: jffs,...):&lt;br /&gt;
    RedBoot&amp;gt; fis list&lt;br /&gt;
    Name              FLASH addr  Mem addr    Length      Entry point&lt;br /&gt;
    (reserved)        0xF0000000  0xF0000000  0x00010000  0x00000000&lt;br /&gt;
    RedBoot           0xF0010000  0xF0010000  0x00050000  0x00000000&lt;br /&gt;
    jffs2             0xF0060000  0x00100000  0x00FF0000  0x00100000&lt;br /&gt;
    Linux             0xF1050000  0x00800000  0x00110000  0x00800000&lt;br /&gt;
    FIS directory     0xF1FF0000  0xF1FF0000  0x0000F000  0x00000000&lt;br /&gt;
    RedBoot config    0xF1FFF000  0xF1FFF000  0x00001000  0x00000000&lt;br /&gt;
&lt;br /&gt;
== Login with telnet ==&lt;br /&gt;
 telnet &amp;lt;ip address of boa&amp;gt;&lt;br /&gt;
Log in as root, ask me for the password. --[[User:Sojka|Sojka]] 20:42, 21 March 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
==Setting up bootloder (automatic boot)==&lt;br /&gt;
&lt;br /&gt;
Use &#039;fconfig&#039; command (see [http://ecos.sourceware.org/ecos/docs-latest/redboot/persistent-state-flash.html RedBoot manual]) to set up bootloader configuration. Recommended configuration:&lt;br /&gt;
&lt;br /&gt;
 Run script at boot: true&lt;br /&gt;
 Boot script:&lt;br /&gt;
  load zImage.elf&lt;br /&gt;
  ex -c &amp;quot;root=/dev/nfs rw nfsroot=192.168.123.254:/var/MPC5200_root ip=dhcp&amp;quot;&lt;br /&gt;
 Boot script timeout (1000ms resolution): 10 &lt;br /&gt;
 Use BOOTP for network configuration: true&lt;br /&gt;
 Default server IP address: IP address of your computer&lt;br /&gt;
 FEC Network hardware address [MAC]: choose MAC address of the unit (example: 0x00:0x00:0x00:0x00:0x00:0x02)&lt;br /&gt;
 GDB connection port: 9000&lt;br /&gt;
 Force console for special debug messages: false&lt;br /&gt;
 Network debug at boot time: false&lt;br /&gt;
 Update RedBoot non-volatile configuration - continue (y/n)? y&lt;br /&gt;
&lt;br /&gt;
==Socketcan==&lt;br /&gt;
&lt;br /&gt;
To set up can interface, it is necessary to configure the communication speed first and then bring the interface up. Communication speed can be set up using following command (for can0 interface @ 1Mbit):&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_baudrate&lt;br /&gt;
&lt;br /&gt;
For newer version of socketcan you must use:&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_bittiming/bitrate&lt;br /&gt;
&lt;br /&gt;
The constant 660000 for 1Mbit speed was found experimentally, driver seems to calculate the transmission speed improperly. To bring up the can network interface, use the same command as with any other network interface, i.e.&lt;br /&gt;
&lt;br /&gt;
 ifconfig can0 up&lt;br /&gt;
&lt;br /&gt;
The most comfortable way of setting up both can interfaces upon startup of system is to place following script to /etc/init.d/ (name it &#039;can&#039;, for example)&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_baudrate&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can1/can_baudrate&lt;br /&gt;
 ifconfig can0 up&lt;br /&gt;
 ifconfig can1 up&lt;br /&gt;
&lt;br /&gt;
==CanFestival==&lt;br /&gt;
&lt;br /&gt;
===Obtaining and building CanFestival===&lt;br /&gt;
&lt;br /&gt;
CanFestival driver source can be downloaded from. The primary way how to do it is to check out the source directory from CanFestival CVS by these steps:&lt;br /&gt;
 cvs -d:pserver:anonymous@lolitech.dyndns.org:/canfestival login&lt;br /&gt;
 (type return, without entering a password)&lt;br /&gt;
The system will respond:&lt;br /&gt;
 Logging in to :pserver:anonymous@lolitech.dyndns.org:2401/canfestival&lt;br /&gt;
Then, enter:&lt;br /&gt;
 cvs -z3 -d:pserver:anonymous@lolitech.dyndns.org:/canfestival co -P CanFestival-3&lt;br /&gt;
Then insert CanFestival folder and run this commands:&lt;br /&gt;
 ./configure --timers=unix --can=socket --cc=powerpc-603e-linux-gnu-gcc --arch=ppc --os=linux --target=unix &lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
Building of CanFestival will produce some libraries and copy them to /usr/powerpc-603e-linux-gnu/lib folder.&lt;br /&gt;
&lt;br /&gt;
===Setting up local CANopen node===&lt;br /&gt;
&lt;br /&gt;
CanFestival source includes tool called &#039;&#039;objdictedit&#039;&#039;. This program has graphical user interface and serves to creating configuration of the CANopen node of application we develop. It is started by command &#039;&#039;objdictedit&#039;&#039;. Using this program you can create the object dictionary for the CanFestival. Mainly it is necessary to set up all SDO and PDO, the node has to send and receive. To each PDO you have to define more things - PDO receive or transmit, variable to be mapped and variable mapping. The variable will then be used in application code to exchange data between CanFestival driver and application. If you set up PDOs here they will be sent and received automatically and the values will be stored into mapped variable. Setting up SDO means that you can use it in your application, but if you want to send it, it has to be done in code.&lt;br /&gt;
After creating this basic configuration you have to build the dictionary which results into to files with extensions .h and .c. You have to link these files with your application.&lt;br /&gt;
&lt;br /&gt;
===Initializing and starting CanFestival===&lt;br /&gt;
&lt;br /&gt;
To explain how to use CanFestival I include some code examples. It supposes node configuration generated by &#039;&#039;objdictedit&#039;&#039; which name is &#039;&#039;canopen&#039;&#039;. It is then used as prefix of automatically generated functions and variables (&#039;&#039;canopen_Data&#039;&#039; is for example object dictionary used by CanFestival). &lt;br /&gt;
Header &#039;&#039;canfestival.h&#039;&#039; has to be included. For start using CanFestival it is necessary to load dynamic library with CAN bus driver API created while compiling CanFestival source. In the example SocketCan driver is used to access CAN bus. &lt;br /&gt;
 if(!LoadCanDriver(&amp;quot;libcanfestival_can_socket.so&amp;quot;)) {&lt;br /&gt;
 	exit -1;&lt;br /&gt;
 }&lt;br /&gt;
Then you have to open CAN device. Parameters of the communication have to be prepared in structure of type &#039;&#039;s_Board&#039;&#039;. In this case CAN is set to use device &#039;&#039;can1&#039;&#039; and baudrate 1Mbps. Handler of the bus is then stored to variable of type &#039;&#039;CAN_HANDLE&#039;&#039;.&lt;br /&gt;
 /**&lt;br /&gt;
  * CAN board definition.&lt;br /&gt;
  * Device name can1, baudrate 1M&lt;br /&gt;
  */&lt;br /&gt;
 s_BOARD canopen_board = {&amp;quot;1&amp;quot;, &amp;quot;1000&amp;quot;};&lt;br /&gt;
&lt;br /&gt;
 CAN_HANDLE canopen_handle;&lt;br /&gt;
 &lt;br /&gt;
 if(!(canopen_handle = canOpen(&amp;amp;canopen_board, &amp;amp;canopen_Data))) {&lt;br /&gt;
 	exit -1;&lt;br /&gt;
 }&lt;br /&gt;
CanFestival implements callbacks to some events like change of state or message reception. There are pointers to callback functions in &#039;&#039;canopen_Data&#039;&#039; structure. You can assign your own functions to these pointers or leave them unused.&lt;br /&gt;
 canopen_Data.initialisation = canopen_initialisation;&lt;br /&gt;
 canopen_Data.preOperational = canopen_preOperational; &lt;br /&gt;
 canopen_Data.operational = canopen_operational; &lt;br /&gt;
 canopen_Data.post_sync = canopen_post_sync; &lt;br /&gt;
 canopen_Data.post_TPDO = canopen_post_TPDO; &lt;br /&gt;
 canopen_Data.stopped = canopen_stopped; &lt;br /&gt;
After setting up these few things you have to call function &#039;&#039;StartTimerLoop&#039;&#039; which initializes CanFestival timers. As an argument you have to insert pointer to the first function you want to proceed after starting the timers. &lt;br /&gt;
 StartTimerLoop(&amp;amp;initNode); &lt;br /&gt;
Here is an example of such a function. It sets local node ID to 1 and bring the node to operation state. Callback functions are called after changing state if used.&lt;br /&gt;
 void initNode(CO_Data * d, UNS32 id)&lt;br /&gt;
 {&lt;br /&gt;
 	setNodeId(&amp;amp;canopen_Data, 0x01);&lt;br /&gt;
	setState(&amp;amp;canopen_Data, Initialisation);&lt;br /&gt;
	setState(&amp;amp;canopen_Data, Operational);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Stopping CanFestival===&lt;br /&gt;
&lt;br /&gt;
After finishing work with CANopen it is good to stop the communication and timers and close the device. It is done by these few functions.&lt;br /&gt;
 setState(&amp;amp;canopen_Data, Stopped);&lt;br /&gt;
 StopTimerLoop();&lt;br /&gt;
 canClose(&amp;amp;canopen_Data);&lt;br /&gt;
 canopen_handle = NULL;&lt;br /&gt;
&lt;br /&gt;
===Writing to Object dictionary===&lt;br /&gt;
&lt;br /&gt;
CANopen devices and all network services of each node are configured by writing to device object dictionary (OD). It is different while writing to local OD or OD of some network device.&lt;br /&gt;
====Writing to local OD====&lt;br /&gt;
Function &#039;&#039;WriteLocalDict&#039;&#039; is used for writing to OD of local node managed by CanFestival.&lt;br /&gt;
 UNS32 writeLocalDict( CO_Data* d, &lt;br /&gt;
 UNS16 wIndex, &lt;br /&gt;
 UNS8 bSubindex, &lt;br /&gt;
 void * pSourceData, &lt;br /&gt;
 UNS8 * pExpectedSize, &lt;br /&gt;
 UNS8 checkAccess);&lt;br /&gt;
Meaning of function arguments:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;wIndex&#039;&#039;&#039; - the index in the object dictionary where you want to write an entry&lt;br /&gt;
 &#039;&#039;&#039;bSubindex&#039;&#039;&#039; - the subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this   index. Look at the canopen standard for further information&lt;br /&gt;
 &#039;&#039;&#039;pbSourceData&#039;&#039;&#039; - pointer to the variable that holds the value that should be copied into the object dictionary&lt;br /&gt;
 &#039;&#039;&#039;pExpectedSize&#039;&#039;&#039; - pointer to variable with size of the data to be written&lt;br /&gt;
 &#039;&#039;&#039;CheckAccess&#039;&#039;&#039; - if other than 0, do not read if the data is Read Only or Constant&lt;br /&gt;
&lt;br /&gt;
====Writing to network OD====&lt;br /&gt;
&lt;br /&gt;
It is necessary to use SDO service for writing data to OD of some network device. Each CANopen device has at least one SDO server. It means that it is able to receive SDOs with one ID and answer by SDOs with another ID. It is usual that the server listen for SDOs with ID 0x600 + ID of the node and transmits SDOs of ID 0x580 + node ID. Each SDO we want to use has to be defined while creating node configuration by &#039;&#039;objdictedit&#039;&#039;. Then the SDO is sent by calling appropriate function. The best is to use function &#039;&#039;writeNetworkDictCallBack&#039;&#039; which syntax is shown below.&lt;br /&gt;
 UNS8 writeNetworkDictCallBack (CO_Data* d, &lt;br /&gt;
 UNS8 nodeId, &lt;br /&gt;
 UNS16 index,&lt;br /&gt;
 UNS8 subIndex, &lt;br /&gt;
 UNS8 count, &lt;br /&gt;
 UNS8 dataType, &lt;br /&gt;
 void *data, &lt;br /&gt;
 SDOCallback_t Callback);&lt;br /&gt;
Meaning of function arguments:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;nodeId&#039;&#039;&#039; - ID of the device we want to send SDO&lt;br /&gt;
 &#039;&#039;&#039;index&#039;&#039;&#039; - the index in the object dictionary where you want to write an entry&lt;br /&gt;
 &#039;&#039;&#039;subIndex&#039;&#039;&#039; - the subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information&lt;br /&gt;
 &#039;&#039;&#039;count&#039;&#039;&#039; - number of bytes to be written&lt;br /&gt;
 &#039;&#039;&#039;dataType&#039;&#039;&#039; - type of the data, use 0 for integers, real numbers and other values&lt;br /&gt;
 &#039;&#039;&#039;data&#039;&#039;&#039; - pointer to the data&lt;br /&gt;
 &#039;&#039;&#039;Callback&#039;&#039;&#039; - pointer to a function which is called after finishing the transfer&lt;br /&gt;
The SDO service is by definition confirmed. It means that SDO server sends response with result of the transfer after each SDO reception. This response has to be read by client to be sure that the data were written correctly. The result should be read in your function which pointer is given to the function &#039;&#039;writeNetworkDictCallBack&#039;&#039; as parameter &#039;&#039;callback&#039;&#039;. The result of SDO transfer in such a function is read by CanFestival function &#039;&#039;getWriteResultNetworkDict&#039;&#039;. This function has to be called after each SDO transmission because it releases line used to transfer. Header of this function is:&lt;br /&gt;
 UNS8 getWriteResultNetworkDict (CO_Data* d, UNS8 nodeId, UNS32 * abortCode);&lt;br /&gt;
And meaning of function arguments is:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;nodeId&#039;&#039;&#039; - ID of the device we have sent SDO&lt;br /&gt;
 &#039;&#039;&#039;abortCode&#039;&#039;&#039; - pointer to the variable where error code is written in case of error&lt;br /&gt;
The function can return one of these values according to the SDO transfer state:&lt;br /&gt;
 &#039;&#039;&#039;SDO_FINISHED&#039;&#039;&#039; - data is available&lt;br /&gt;
 &#039;&#039;&#039;SDO_ABORTED_RCV&#039;&#039;&#039; - Transfer failed. (abort SDO received)&lt;br /&gt;
 &#039;&#039;&#039;SDO_ABORTED_INTERNAL&#039;&#039;&#039; - Transfer failed. Internal abort.&lt;br /&gt;
 &#039;&#039;&#039;SDO_DOWNLOAD_IN_PROGRESS&#039;&#039;&#039; - Data not yet available&lt;br /&gt;
The function can be used in cycle waiting while return value is &#039;&#039;SDO_DOWNLOAD_IN_PROGRESS&#039;&#039;. But the better solution is calling it in callback function from &#039;&#039;writeNetworkDictCallBack&#039;&#039;. The callback is call after finishing the transfer.&lt;br /&gt;
&lt;br /&gt;
===Using PDO service===&lt;br /&gt;
&lt;br /&gt;
Using PDO service for data exchange is very easy in CanFestival. The most usual transmission type of PDOs is that they are transmitted after SYNC message. In this case it just has to be set up in objdictedit configuration and then it works, reads and stores values into mapped variables. After each PDO reception or transmission &#039;&#039;post_TPDO&#039;&#039; callback is called if used. &lt;br /&gt;
Sometimes it is necessary to send PDO from code without SYNC message reception. This is done by calling the function &#039;&#039;sendPDOevent&#039;&#039; with this syntax:&lt;br /&gt;
 UNS8 sendPDOevent(CO_Data* d);&lt;br /&gt;
where &#039;&#039;d&#039;&#039; is the pointer to local object dictionary structure. This function sends all PDOs defined by &#039;&#039;objdictedit&#039;&#039; and transmission type &#039;&#039;after event&#039;&#039; (0x255).&lt;br /&gt;
&lt;br /&gt;
===Generating SYNC message===&lt;br /&gt;
&lt;br /&gt;
If you want to set up local node to become the SYNC server you have to write some information to local OD. Here is an example of function which set up the SYNC messages generation:&lt;br /&gt;
 /**&lt;br /&gt;
  * This function initializes local canopen node to send SYNC message&lt;br /&gt;
  * with given period. &lt;br /&gt;
  * @param d - local object dictionary&lt;br /&gt;
  * @param period - period of the SYNC message in us&lt;br /&gt;
  */&lt;br /&gt;
 void synchro_setup(CO_Data *d, unsigned long period)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS32 SYNC_COBID = 0x40000080;&lt;br /&gt;
 	UNS32 SYNC_INTER = period;&lt;br /&gt;
 	UNS8 size = sizeof(UNS32); &lt;br /&gt;
 	writeLocalDict(d, 0x1006, 0x0, &amp;amp;SYNC_INTER, &amp;amp;size, RW);&lt;br /&gt;
 	writeLocalDict(d, 0x1005, 0x0, &amp;amp;SYNC_COBID, &amp;amp;size, RW);&lt;br /&gt;
 }&lt;br /&gt;
According to CANopen specification ID of the SYNC message is 0x80.&lt;br /&gt;
After the setup it can be started by command &#039;&#039;startSYNC(CO_Data *d)&#039;&#039; and stopped by command &#039;&#039;stopSYNC(CO_Data *d)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===SDO and PDO example===&lt;br /&gt;
&lt;br /&gt;
At the end I attach example of a function (&#039;&#039;cpd_start()&#039;&#039;) which starts some device communicating by CANopen. The ID of the device is given by the parameter. The other function (&#039;&#039;cpd_checkSDO_start()&#039;&#039;) is callback used to handle SDO transfer result. It is necessary to wait until one SDO transfer is finished before starting some other. Global variable &#039;&#039;cpd_init_step&#039;&#039; is used for counting actual step of SDO transfer. If some SDO transfer fails it is set to -1 and the startup process is terminated. &lt;br /&gt;
 /**&lt;br /&gt;
  * This function is given to the writeNetworkDict function as a callback.&lt;br /&gt;
  * It checks the result of SDO transmition and after finishing the transmition&lt;br /&gt;
  * it closes the transfer.&lt;br /&gt;
  * @param d - local object disctionary&lt;br /&gt;
  * @param nodeID - ID of the node which the local node is communicating with&lt;br /&gt;
  */ &lt;br /&gt;
 void cpd_checkSDO_start(CO_Data* d, UNS8 nodeId)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS32 abortCode;	&lt;br /&gt;
 	if(getWriteResultNetworkDict (d, nodeId, &amp;amp;abortCode) != SDO_FINISHED) {&lt;br /&gt;
 		cpd_init_step = -1;&lt;br /&gt;
 	}&lt;br /&gt;
 	closeSDOtransfer(&amp;amp;canopen_Data, nodeId, SDO_CLIENT);&lt;br /&gt;
 	cpd_start(&amp;amp;canopen_Data, nodeId);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 /**&lt;br /&gt;
  * This function switch canopen device into operational state. &lt;br /&gt;
  * @param d - local object dictionary&lt;br /&gt;
  * @param nodeId - ID of the device&lt;br /&gt;
  * return 0 - ok, -1 - failed&lt;br /&gt;
  */&lt;br /&gt;
 int cpd_start(CO_Data *d, UNS8 nodeId)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS8 data8;&lt;br /&gt;
 	UNS16 data16;&lt;br /&gt;
 	UNS32 data32;&lt;br /&gt;
 	switch(cpd_init_step++) {&lt;br /&gt;
 		case 0:&lt;br /&gt;
 			masterSendNMTstateChange(d, nodeId, NMT_Start_Node);&lt;br /&gt;
 			cpd_controlword = 0;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 			cpd_controlword = 6;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 			cpd_controlword = 0x0F;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 &lt;br /&gt;
 			// Start operational mode&lt;br /&gt;
 			data8 = 0xFC;&lt;br /&gt;
 			writeNetworkDictCallBack(d, nodeId, 0x6060, 0x00, 1, 0, &amp;amp;data8, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 1:&lt;br /&gt;
 			// Check operation status&lt;br /&gt;
 			readNetworkDictCallback(d, nodeId, 0x6061, 0x00, 0, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 2:&lt;br /&gt;
 			// Setpoint specification&lt;br /&gt;
 			data16 = 0x0002;&lt;br /&gt;
 			writeNetworkDictCallBack(d, nodeId, 0x301B, 0x11, 2, 0, &amp;amp;data16, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 3:&lt;br /&gt;
 			canopen_init_result = 0;&lt;br /&gt;
 			cpd_init_step = 0;&lt;br /&gt;
 			break;&lt;br /&gt;
 		case -1:&lt;br /&gt;
 			canopen_init_result = -1;&lt;br /&gt;
 			cpd_init_step = 0;&lt;br /&gt;
 			break;&lt;br /&gt;
 	}&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Emergency message===&lt;br /&gt;
&lt;br /&gt;
New version of CanFestival is extended by EMCY messages support. There is callback added which can be set to point to your own EMCY message handler.This handler has to be a function with three parameters defined in this way:&lt;br /&gt;
 void my_post_emcy(UNS8 nodeID, UNS16 errCode, UNS8 errReg)&lt;br /&gt;
After reception of an EMCY message this callback is called. The parameters keep information about node ID of the EMCY producer, error code and content of the error register.&lt;br /&gt;
To register your handler you have to set the callback in CanFestival initialization.&lt;br /&gt;
 my_Data.post_emcy = my_post_emcy;&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Boa5200_HOWTO&amp;diff=3491</id>
		<title>Boa5200 HOWTO</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Boa5200_HOWTO&amp;diff=3491"/>
		<updated>2009-02-16T12:22:46Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: /* Updating root filesystem on BOA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This document describes how to install and setup Linux and development environment for BOA5200  board. &lt;br /&gt;
Assume that you have a development machine (your PC) that you use for development and building your applications which you consequently want to get running and test on BOA5200.&lt;br /&gt;
&lt;br /&gt;
==Serial line setting==&lt;br /&gt;
The easiest way to communicate with the board ,when there is no OS and remote shell running on it, is over serial line. Recommended serial communication program is minicom. Setup minicom as follows:&lt;br /&gt;
&lt;br /&gt;
Baud Rate – 38400&lt;br /&gt;
&lt;br /&gt;
Bits - 8&lt;br /&gt;
&lt;br /&gt;
Parity – N&lt;br /&gt;
&lt;br /&gt;
Stop Bits - 1&lt;br /&gt;
&lt;br /&gt;
Hardware Flow Control:- No&lt;br /&gt;
&lt;br /&gt;
Software Flow Control:- No&lt;br /&gt;
&lt;br /&gt;
After the setup you will see Redboot&amp;gt; command prompt. Here you can enter Redboot`s commands.&lt;br /&gt;
Redboot is a simple boot manager bulit upon eCos real-time OS. For more details , see http://ecos.sourceware.org/ecos/docs-latest/redboot/redboot-guide.html.&lt;br /&gt;
&lt;br /&gt;
==IP address setting in Redboot==&lt;br /&gt;
You can set ip address in Redboot using command &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/ip-address-command.html ip_address] instead of obtaing it &lt;br /&gt;
from DHCP server(see next section).&lt;br /&gt;
&lt;br /&gt;
 ip_address [-b] [-l] local_IP_address  [/netmask_length] ] [-h  server_IP_address] [-d DNS_server_IP_address]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 ip_address -l 192.168.100.1/24 -h 192.168.100.2&lt;br /&gt;
&lt;br /&gt;
==DHCP server setup==&lt;br /&gt;
Redboot supports BOOTP protocol which means that it is able to get network information (IP,netmask,gateway IP address,etc.) from DHCP server (provides BOOTP besides DHCP protocol).&lt;br /&gt;
&lt;br /&gt;
If you do not have a DHCP server on you network, you can install one on your development box: (on debian: apt-get install dhcpd) on your development machine. Example of my dhcp configuration file /etc/dhcpd.conf:&lt;br /&gt;
 # I have two ethernet interfaces: &lt;br /&gt;
 # eth0 - Internet&lt;br /&gt;
 # eth1 - connection to BOA5200 (IP= 192.168.10.1)&lt;br /&gt;
 # I do not want to progate infos to 147.32.0.0 subnetwork&lt;br /&gt;
 subnet 147.32.0.0 netmask 255.255.0.0 {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # private subnetwork&lt;br /&gt;
 subnet 192.168.10.0 netmask 255.255.255.0 {&lt;br /&gt;
  option broadcast-address 192.168.10.255;&lt;br /&gt;
  option routers 192.168.10.1;&lt;br /&gt;
  option subnet-mask 255.255.255.0;&lt;br /&gt;
  default-lease-time 600;&lt;br /&gt;
  max-lease-time 7200;&lt;br /&gt;
 &lt;br /&gt;
 # settings for BOA5200&lt;br /&gt;
  host BOA5200 {&lt;br /&gt;
   hardware ethernet 00:08:f1:11:22:33;&lt;br /&gt;
   fixed-address 192.168.10.2;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start dhcp server and reboot the board. After booting it has assigned IP, netmask and gateway address:&lt;br /&gt;
 +PHY0: AMD AM79C874&lt;br /&gt;
 FEC eth0: 100Mb/Full Duplex&lt;br /&gt;
 Ethernet eth0: MAC address 00:08:f1:11:22:33&lt;br /&gt;
 IP: 192.168.10.2/255.255.255.0, Gateway: 192.168.10.1&lt;br /&gt;
 Default server: 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
==TFTP server setup==&lt;br /&gt;
Redboot is able to load file from remote tftp server into memory. Tftp server is lanuched by inetd daemon when a new &lt;br /&gt;
connection comes. &lt;br /&gt;
Therefore add the following line into /etc/inetd.conf :&lt;br /&gt;
 tftp            dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd&lt;br /&gt;
&lt;br /&gt;
Default tftp root directory is /tftpboot. You can change it by calling in.tftpd with specified directory as a parameter.&lt;br /&gt;
&lt;br /&gt;
===Alternative way for Ubuntu based distro===&lt;br /&gt;
&lt;br /&gt;
1. Install tftpd and related packages.&lt;br /&gt;
 sudo apt-get install xinetd tftpd tftp&lt;br /&gt;
&lt;br /&gt;
2. Create /etc/xinetd.d/tftp and put this entry:&lt;br /&gt;
&lt;br /&gt;
 service tftp&lt;br /&gt;
 {&lt;br /&gt;
 protocol        = udp&lt;br /&gt;
 port            = 69&lt;br /&gt;
 socket_type     = dgram&lt;br /&gt;
 wait            = yes&lt;br /&gt;
 user            = nobody&lt;br /&gt;
 server          = /usr/sbin/in.tftpd&lt;br /&gt;
 server_args     = /tftpboot&lt;br /&gt;
 disable         = no&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
3. Make /tftpboot directory&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir /tftpboot&lt;br /&gt;
 sudo chmod -R 777 /tftpboot&lt;br /&gt;
 sudo chown -R nobody /tftpboot&lt;br /&gt;
&lt;br /&gt;
4. Start tftpd through xinetd&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/xinetd start&lt;br /&gt;
&lt;br /&gt;
see [[http://www.example.com Installing and setting TFTPD in Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
==Tool chain==&lt;br /&gt;
Toolchain(gcc, ld, ...) for MPC5200 can be downloaded from ftp://rtime.felk.cvut.cz/MPC5200/gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
Unpack the archive:&lt;br /&gt;
&lt;br /&gt;
 cd /&lt;br /&gt;
 tar xvzf gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
&lt;br /&gt;
You can also create a debian package from archive and then install the package:&lt;br /&gt;
 alien --to-deb gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
Note: If you are not root, use fakeroot to run the command.&lt;br /&gt;
&lt;br /&gt;
==Getting the kernel==&lt;br /&gt;
&lt;br /&gt;
Linux kernel sources patched for the board are maintained in a [http://rtime.felk.cvut.cz/gitweb/boa5200/linux.git separate git tree]. Use&lt;br /&gt;
  git clone git://rtime.felk.cvut.cz/boa5200/linux.git linux-boa5200&lt;br /&gt;
to download it.&lt;br /&gt;
&lt;br /&gt;
You can also download the [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/.config;hb=HEAD default kernel .config].&lt;br /&gt;
&lt;br /&gt;
==Building kernel==&lt;br /&gt;
&lt;br /&gt;
The simples way to build the kernel is putting the .config file (see the previous section) to the directory with sources and running:&lt;br /&gt;
 make ARCH=ppc CROSS_COMPILE=powerpc-603e-linux-gnu-&lt;br /&gt;
&lt;br /&gt;
After compilation a built image is placed into arch/ppc/boot/image directory.&lt;br /&gt;
&lt;br /&gt;
The following commnad will install modules into &#039;&#039;&amp;lt;directory&amp;gt;&#039;&#039;/lib/modules/...&lt;br /&gt;
 make INSTALL_MOD_PATH=&#039;&#039;&amp;lt;directory&amp;gt;&#039;&#039; modules_install   &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Recommendation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Instead of building the kernel in the sources directory, we recommend using of a separate build directory:&lt;br /&gt;
&lt;br /&gt;
1. Make the build directory under the linux sources&lt;br /&gt;
 mkdir _build&lt;br /&gt;
 cd _build&lt;br /&gt;
&lt;br /&gt;
2. Put the [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/.config;hb=HEAD default .config] and [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/GNUmakefile;hb=HEAD GNUmakefile] into this directory&lt;br /&gt;
&lt;br /&gt;
3. Optionally update the kernel configuration&lt;br /&gt;
 make menuconfig &lt;br /&gt;
kernel config file (.config) will be updated&lt;br /&gt;
&lt;br /&gt;
Next time, always run &amp;lt;tt&amp;gt;make menuconfig&amp;lt;/tt&amp;gt; from the _build directory&lt;br /&gt;
&lt;br /&gt;
4. Compile the kenrel and install modules&lt;br /&gt;
 make &amp;amp;&amp;amp; make modules_install&lt;br /&gt;
&lt;br /&gt;
If you often forget to switch to the build directory and run make in the source directory, put the following GNUmakefile into your source directory:&lt;br /&gt;
 ifeq ($(O),)&lt;br /&gt;
 $(error Please, run make in a different build directory (or use O= option))&lt;br /&gt;
 else&lt;br /&gt;
 include Makefile&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
==Updating RedBoot==&lt;br /&gt;
&lt;br /&gt;
You need to update RedBoot in order to boot Linux 2.6 kernel.&lt;br /&gt;
&lt;br /&gt;
Download ftp://rtime.felk.cvut.cz/MPC5200/MPC5200-2007.02.01-redbootROMRAM.srec &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;!!! Warning: File names are case-sensitive !!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 # load RedBoot image from tftp server into memory at the address 0x100000&lt;br /&gt;
 RedBoot&amp;gt;lo -b 0x100000 MPC5200-2007.02.01-redbootROMRAM.srec&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;!!! Warning: File names are case-sensitive !!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 # write image in flash memory&lt;br /&gt;
 RedBoot&amp;gt;fi cr RedBoot&lt;br /&gt;
 RedBoot&amp;gt;reset&lt;br /&gt;
&lt;br /&gt;
If upgrade fails you can fallback to ROM Redboot image by typing &#039;A&amp;amp;M:&#039;&lt;br /&gt;
&lt;br /&gt;
If image of [http://ecos.sourceware.org/ecos/docs-latest/redboot/startup-mode.html ROMRAM version] of RedBoot with name &amp;quot;RedBoot&amp;quot; (case sensitive!!) is not found in FLASH minimal version of ROM RedBoot is started. This version does not support many services like TFTP protocol and FLASH management. To download ROMRAM version of RedBoot to FLASH it is necessary to follow these steps:&lt;br /&gt;
&lt;br /&gt;
Load RAM version of RedBoot to BOA using xmodem (the image file MPC5200-2006.05.10-redbootRAM.srec is placed on BOA original CD):&lt;br /&gt;
 RedBoot&amp;gt; lo -m xmodem&lt;br /&gt;
&lt;br /&gt;
When finished RedBoot should answer with something like that:&lt;br /&gt;
&lt;br /&gt;
 CEntry point: 0x00080100, address range: 0x00080000-0x000bea04&lt;br /&gt;
 xyzModem - CRC mode, 5763(SOH)/0(STX)/0(CAN) packets, 1 retries&lt;br /&gt;
&lt;br /&gt;
Then start the RedBoot:&lt;br /&gt;
 RedBoot&amp;gt; go&lt;br /&gt;
&lt;br /&gt;
RAM RedBoot should start now. Download the new version of ROMRAM RedBoot to FLASH according to the steps above.&lt;br /&gt;
&lt;br /&gt;
== Loading kernel ==&lt;br /&gt;
&lt;br /&gt;
Place the compiled kernel to the tftpboot directory. Then you can test your new image on the board as follows:&lt;br /&gt;
 # load kernel image from tftp server into memory&lt;br /&gt;
   RedBoot&amp;gt; load zImage.elf&lt;br /&gt;
 &lt;br /&gt;
 # execute image; root directory (/) is on flash memory&lt;br /&gt;
   RedBoot&amp;gt; exec&lt;br /&gt;
If you want to load the kernel from different TFTP server than the one provided by DHCP, you can use the following command to set the IP address of your server:&lt;br /&gt;
   RedBoot&amp;gt; ip_address -h 147.32.86.&amp;lt;xxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CAUTION:&#039;&#039;&#039; you must boot the kernel by  RedBoot release at least 2007_02_01 otherwise it will not run! So you must load into RAM and then run the appropriate RedBoot image (or replace/update its image on flash with the new one - see  &lt;br /&gt;
the next section) and after then you can execute kernel image.&lt;br /&gt;
&lt;br /&gt;
To write the loaded kernel to FLASH memory, execute command &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-create-command.html fis create]:&lt;br /&gt;
Example:&lt;br /&gt;
    RedBoot&amp;gt; fis cr Linux -b 0x00800000 -r 0x00100000 -e 0x00100000 -l 0x116000&lt;br /&gt;
&lt;br /&gt;
To load the kernel from the FLASH are later, execute&lt;br /&gt;
    RedBoot&amp;gt; fis load Linux&lt;br /&gt;
(Then, you can perform exec -c &amp;quot;...&amp;quot; cmd.)&lt;br /&gt;
&lt;br /&gt;
To find out paramter values execute [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-list-command.html fis list].&lt;br /&gt;
&lt;br /&gt;
==NFS-root setup==&lt;br /&gt;
&lt;br /&gt;
During the development phase of application it must be tested many times. However, it is annoying to copy several application files to flash memory every time.  The practical solution is to mount via NFS working directory or whole root directory from the point of OS running on the board.&lt;br /&gt;
&lt;br /&gt;
You can download already prepared root directory from ftp://rtime.felk.cvut.cz/MPC5200/MPC5200_root_070321.tar.gz&lt;br /&gt;
&lt;br /&gt;
To export /var/MPC5200_root directory on your PC via NFS add the following line to &#039;&#039;&#039;/etc/exports&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 /var/MPC5200_root 192.168.10.0/255.255.255.0(rw,sync,no_root_squash)&lt;br /&gt;
&lt;br /&gt;
Then run command &amp;quot;&#039;&#039;&#039;exportfs -ra&#039;&#039;&#039;&amp;quot; so that the change take an effect.&lt;br /&gt;
&lt;br /&gt;
If you want MPC5200 to be mount as root directory instead of that one in flash memory:&lt;br /&gt;
 # load kernel image from tftp server into memory&lt;br /&gt;
  RedBoot&amp;gt; load zImage.elf&lt;br /&gt;
 # execute kernel image with information where to &lt;br /&gt;
 # find root directory in parameter string&lt;br /&gt;
  RedBoot&amp;gt; ex -c &amp;quot;root=/dev/nfs rw nfsroot=192.168.10.1:/var/MPC5200_root ip=dhcp&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To mount another directory from Boa use this command:&lt;br /&gt;
 mount -t nfs &amp;lt;ip&amp;gt;:/path/to/exported/dir /path/on/boa&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; exportfs is a part of knfs (Ubuntu) or nfs-kernel-server (Debian) package.&lt;br /&gt;
&lt;br /&gt;
==Updating root filesystem on BOA==&lt;br /&gt;
You can download already prepared root directory from ftp://rtime.felk.cvut.cz/MPC5200/MPC5200_root_070321.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create jffs2 image:&lt;br /&gt;
 mkfs.jffs2 -r MPC5200_root -o jffs2.img -b -e 0x10000&lt;br /&gt;
&lt;br /&gt;
On BOA:&lt;br /&gt;
&lt;br /&gt;
Delete old image:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-delete-command.html fis delete] jffs2&lt;br /&gt;
&lt;br /&gt;
Fill memory area at address 0x100000 of size 0xD00000 (size of root image + free space wanted) using &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/mfill-command.html mfill] command:&lt;br /&gt;
&lt;br /&gt;
 mfi -b 0x100000 -l 0xD00000 -p 0xffffffff&lt;br /&gt;
&lt;br /&gt;
Load root image to that memory area:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/download-command.html load] -r -b 0x100000 jffs2.img&lt;br /&gt;
&lt;br /&gt;
Write image to flash:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-create-command.html fis cr] -b 0x100000 jffs2 -l 0xD00000&lt;br /&gt;
&lt;br /&gt;
Root filesystem is mounted as read-only in Linux. To enable writting:&lt;br /&gt;
 mount -o remount,rw /&lt;br /&gt;
&lt;br /&gt;
--[[User:Molnam1|Molnam1]] 17:35, 15 December 2008 (CET)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remark:&#039;&#039;&#039; I have been unsuccessful doing these steps, maybe the filesystem has not been prepared correctly. However, there is another way to set up the JFFS2 filesystem in FLASH. If you mount a clean (0xff, 0xff,...) FLASH block device as -tjffs2, Linux will create the JFFS2 fs itself.&lt;br /&gt;
&lt;br /&gt;
Procedue (on BOA):&lt;br /&gt;
* fis create ...&lt;br /&gt;
* fis erase ...&lt;br /&gt;
* boot Linux with a root elsewhere (NFS)&lt;br /&gt;
* in Linux: mount -tjffs2 /dev/mtdblock2 /mnt&lt;br /&gt;
* voila, the fs is created; now, you can untar or cp -a root contents to /mnt&lt;br /&gt;
&lt;br /&gt;
--[[User:Pecam1|Pecam1]] 13:22, 16 February 2009 (CET)&lt;br /&gt;
&lt;br /&gt;
== Login with telnet ==&lt;br /&gt;
 telnet &amp;lt;ip address of boa&amp;gt;&lt;br /&gt;
Log in as root, ask me for the password. --[[User:Sojka|Sojka]] 20:42, 21 March 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
==Setting up bootloder (automatic boot)==&lt;br /&gt;
&lt;br /&gt;
Use &#039;fconfig&#039; command (see [http://ecos.sourceware.org/ecos/docs-latest/redboot/persistent-state-flash.html RedBoot manual]) to set up bootloader configuration. Recommended configuration:&lt;br /&gt;
&lt;br /&gt;
 Run script at boot: true&lt;br /&gt;
 Boot script:&lt;br /&gt;
  load zImage.elf&lt;br /&gt;
  ex -c &amp;quot;root=/dev/nfs rw nfsroot=192.168.123.254:/var/MPC5200_root ip=dhcp&amp;quot;&lt;br /&gt;
 Boot script timeout (1000ms resolution): 10 &lt;br /&gt;
 Use BOOTP for network configuration: true&lt;br /&gt;
 Default server IP address: IP address of your computer&lt;br /&gt;
 FEC Network hardware address [MAC]: choose MAC address of the unit (example: 0x00:0x00:0x00:0x00:0x00:0x02)&lt;br /&gt;
 GDB connection port: 9000&lt;br /&gt;
 Force console for special debug messages: false&lt;br /&gt;
 Network debug at boot time: false&lt;br /&gt;
 Update RedBoot non-volatile configuration - continue (y/n)? y&lt;br /&gt;
&lt;br /&gt;
==Socketcan==&lt;br /&gt;
&lt;br /&gt;
To set up can interface, it is necessary to configure the communication speed first and then bring the interface up. Communication speed can be set up using following command (for can0 interface @ 1Mbit):&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_baudrate&lt;br /&gt;
&lt;br /&gt;
For newer version of socketcan you must use:&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_bittiming/bitrate&lt;br /&gt;
&lt;br /&gt;
The constant 660000 for 1Mbit speed was found experimentally, driver seems to calculate the transmission speed improperly. To bring up the can network interface, use the same command as with any other network interface, i.e.&lt;br /&gt;
&lt;br /&gt;
 ifconfig can0 up&lt;br /&gt;
&lt;br /&gt;
The most comfortable way of setting up both can interfaces upon startup of system is to place following script to /etc/init.d/ (name it &#039;can&#039;, for example)&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_baudrate&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can1/can_baudrate&lt;br /&gt;
 ifconfig can0 up&lt;br /&gt;
 ifconfig can1 up&lt;br /&gt;
&lt;br /&gt;
==CanFestival==&lt;br /&gt;
&lt;br /&gt;
===Obtaining and building CanFestival===&lt;br /&gt;
&lt;br /&gt;
CanFestival driver source can be downloaded from. The primary way how to do it is to check out the source directory from CanFestival CVS by these steps:&lt;br /&gt;
 cvs -d:pserver:anonymous@lolitech.dyndns.org:/canfestival login&lt;br /&gt;
 (type return, without entering a password)&lt;br /&gt;
The system will respond:&lt;br /&gt;
 Logging in to :pserver:anonymous@lolitech.dyndns.org:2401/canfestival&lt;br /&gt;
Then, enter:&lt;br /&gt;
 cvs -z3 -d:pserver:anonymous@lolitech.dyndns.org:/canfestival co -P CanFestival-3&lt;br /&gt;
Then insert CanFestival folder and run this commands:&lt;br /&gt;
 ./configure --timers=unix --can=socket --cc=powerpc-603e-linux-gnu-gcc --arch=ppc --os=linux --target=unix &lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
Building of CanFestival will produce some libraries and copy them to /usr/powerpc-603e-linux-gnu/lib folder.&lt;br /&gt;
&lt;br /&gt;
===Setting up local CANopen node===&lt;br /&gt;
&lt;br /&gt;
CanFestival source includes tool called &#039;&#039;objdictedit&#039;&#039;. This program has graphical user interface and serves to creating configuration of the CANopen node of application we develop. It is started by command &#039;&#039;objdictedit&#039;&#039;. Using this program you can create the object dictionary for the CanFestival. Mainly it is necessary to set up all SDO and PDO, the node has to send and receive. To each PDO you have to define more things - PDO receive or transmit, variable to be mapped and variable mapping. The variable will then be used in application code to exchange data between CanFestival driver and application. If you set up PDOs here they will be sent and received automatically and the values will be stored into mapped variable. Setting up SDO means that you can use it in your application, but if you want to send it, it has to be done in code.&lt;br /&gt;
After creating this basic configuration you have to build the dictionary which results into to files with extensions .h and .c. You have to link these files with your application.&lt;br /&gt;
&lt;br /&gt;
===Initializing and starting CanFestival===&lt;br /&gt;
&lt;br /&gt;
To explain how to use CanFestival I include some code examples. It supposes node configuration generated by &#039;&#039;objdictedit&#039;&#039; which name is &#039;&#039;canopen&#039;&#039;. It is then used as prefix of automatically generated functions and variables (&#039;&#039;canopen_Data&#039;&#039; is for example object dictionary used by CanFestival). &lt;br /&gt;
Header &#039;&#039;canfestival.h&#039;&#039; has to be included. For start using CanFestival it is necessary to load dynamic library with CAN bus driver API created while compiling CanFestival source. In the example SocketCan driver is used to access CAN bus. &lt;br /&gt;
 if(!LoadCanDriver(&amp;quot;libcanfestival_can_socket.so&amp;quot;)) {&lt;br /&gt;
 	exit -1;&lt;br /&gt;
 }&lt;br /&gt;
Then you have to open CAN device. Parameters of the communication have to be prepared in structure of type &#039;&#039;s_Board&#039;&#039;. In this case CAN is set to use device &#039;&#039;can1&#039;&#039; and baudrate 1Mbps. Handler of the bus is then stored to variable of type &#039;&#039;CAN_HANDLE&#039;&#039;.&lt;br /&gt;
 /**&lt;br /&gt;
  * CAN board definition.&lt;br /&gt;
  * Device name can1, baudrate 1M&lt;br /&gt;
  */&lt;br /&gt;
 s_BOARD canopen_board = {&amp;quot;1&amp;quot;, &amp;quot;1000&amp;quot;};&lt;br /&gt;
&lt;br /&gt;
 CAN_HANDLE canopen_handle;&lt;br /&gt;
 &lt;br /&gt;
 if(!(canopen_handle = canOpen(&amp;amp;canopen_board, &amp;amp;canopen_Data))) {&lt;br /&gt;
 	exit -1;&lt;br /&gt;
 }&lt;br /&gt;
CanFestival implements callbacks to some events like change of state or message reception. There are pointers to callback functions in &#039;&#039;canopen_Data&#039;&#039; structure. You can assign your own functions to these pointers or leave them unused.&lt;br /&gt;
 canopen_Data.initialisation = canopen_initialisation;&lt;br /&gt;
 canopen_Data.preOperational = canopen_preOperational; &lt;br /&gt;
 canopen_Data.operational = canopen_operational; &lt;br /&gt;
 canopen_Data.post_sync = canopen_post_sync; &lt;br /&gt;
 canopen_Data.post_TPDO = canopen_post_TPDO; &lt;br /&gt;
 canopen_Data.stopped = canopen_stopped; &lt;br /&gt;
After setting up these few things you have to call function &#039;&#039;StartTimerLoop&#039;&#039; which initializes CanFestival timers. As an argument you have to insert pointer to the first function you want to proceed after starting the timers. &lt;br /&gt;
 StartTimerLoop(&amp;amp;initNode); &lt;br /&gt;
Here is an example of such a function. It sets local node ID to 1 and bring the node to operation state. Callback functions are called after changing state if used.&lt;br /&gt;
 void initNode(CO_Data * d, UNS32 id)&lt;br /&gt;
 {&lt;br /&gt;
 	setNodeId(&amp;amp;canopen_Data, 0x01);&lt;br /&gt;
	setState(&amp;amp;canopen_Data, Initialisation);&lt;br /&gt;
	setState(&amp;amp;canopen_Data, Operational);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Stopping CanFestival===&lt;br /&gt;
&lt;br /&gt;
After finishing work with CANopen it is good to stop the communication and timers and close the device. It is done by these few functions.&lt;br /&gt;
 setState(&amp;amp;canopen_Data, Stopped);&lt;br /&gt;
 StopTimerLoop();&lt;br /&gt;
 canClose(&amp;amp;canopen_Data);&lt;br /&gt;
 canopen_handle = NULL;&lt;br /&gt;
&lt;br /&gt;
===Writing to Object dictionary===&lt;br /&gt;
&lt;br /&gt;
CANopen devices and all network services of each node are configured by writing to device object dictionary (OD). It is different while writing to local OD or OD of some network device.&lt;br /&gt;
====Writing to local OD====&lt;br /&gt;
Function &#039;&#039;WriteLocalDict&#039;&#039; is used for writing to OD of local node managed by CanFestival.&lt;br /&gt;
 UNS32 writeLocalDict( CO_Data* d, &lt;br /&gt;
 UNS16 wIndex, &lt;br /&gt;
 UNS8 bSubindex, &lt;br /&gt;
 void * pSourceData, &lt;br /&gt;
 UNS8 * pExpectedSize, &lt;br /&gt;
 UNS8 checkAccess);&lt;br /&gt;
Meaning of function arguments:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;wIndex&#039;&#039;&#039; - the index in the object dictionary where you want to write an entry&lt;br /&gt;
 &#039;&#039;&#039;bSubindex&#039;&#039;&#039; - the subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this   index. Look at the canopen standard for further information&lt;br /&gt;
 &#039;&#039;&#039;pbSourceData&#039;&#039;&#039; - pointer to the variable that holds the value that should be copied into the object dictionary&lt;br /&gt;
 &#039;&#039;&#039;pExpectedSize&#039;&#039;&#039; - pointer to variable with size of the data to be written&lt;br /&gt;
 &#039;&#039;&#039;CheckAccess&#039;&#039;&#039; - if other than 0, do not read if the data is Read Only or Constant&lt;br /&gt;
&lt;br /&gt;
====Writing to network OD====&lt;br /&gt;
&lt;br /&gt;
It is necessary to use SDO service for writing data to OD of some network device. Each CANopen device has at least one SDO server. It means that it is able to receive SDOs with one ID and answer by SDOs with another ID. It is usual that the server listen for SDOs with ID 0x600 + ID of the node and transmits SDOs of ID 0x580 + node ID. Each SDO we want to use has to be defined while creating node configuration by &#039;&#039;objdictedit&#039;&#039;. Then the SDO is sent by calling appropriate function. The best is to use function &#039;&#039;writeNetworkDictCallBack&#039;&#039; which syntax is shown below.&lt;br /&gt;
 UNS8 writeNetworkDictCallBack (CO_Data* d, &lt;br /&gt;
 UNS8 nodeId, &lt;br /&gt;
 UNS16 index,&lt;br /&gt;
 UNS8 subIndex, &lt;br /&gt;
 UNS8 count, &lt;br /&gt;
 UNS8 dataType, &lt;br /&gt;
 void *data, &lt;br /&gt;
 SDOCallback_t Callback);&lt;br /&gt;
Meaning of function arguments:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;nodeId&#039;&#039;&#039; - ID of the device we want to send SDO&lt;br /&gt;
 &#039;&#039;&#039;index&#039;&#039;&#039; - the index in the object dictionary where you want to write an entry&lt;br /&gt;
 &#039;&#039;&#039;subIndex&#039;&#039;&#039; - the subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information&lt;br /&gt;
 &#039;&#039;&#039;count&#039;&#039;&#039; - number of bytes to be written&lt;br /&gt;
 &#039;&#039;&#039;dataType&#039;&#039;&#039; - type of the data, use 0 for integers, real numbers and other values&lt;br /&gt;
 &#039;&#039;&#039;data&#039;&#039;&#039; - pointer to the data&lt;br /&gt;
 &#039;&#039;&#039;Callback&#039;&#039;&#039; - pointer to a function which is called after finishing the transfer&lt;br /&gt;
The SDO service is by definition confirmed. It means that SDO server sends response with result of the transfer after each SDO reception. This response has to be read by client to be sure that the data were written correctly. The result should be read in your function which pointer is given to the function &#039;&#039;writeNetworkDictCallBack&#039;&#039; as parameter &#039;&#039;callback&#039;&#039;. The result of SDO transfer in such a function is read by CanFestival function &#039;&#039;getWriteResultNetworkDict&#039;&#039;. This function has to be called after each SDO transmission because it releases line used to transfer. Header of this function is:&lt;br /&gt;
 UNS8 getWriteResultNetworkDict (CO_Data* d, UNS8 nodeId, UNS32 * abortCode);&lt;br /&gt;
And meaning of function arguments is:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;nodeId&#039;&#039;&#039; - ID of the device we have sent SDO&lt;br /&gt;
 &#039;&#039;&#039;abortCode&#039;&#039;&#039; - pointer to the variable where error code is written in case of error&lt;br /&gt;
The function can return one of these values according to the SDO transfer state:&lt;br /&gt;
 &#039;&#039;&#039;SDO_FINISHED&#039;&#039;&#039; - data is available&lt;br /&gt;
 &#039;&#039;&#039;SDO_ABORTED_RCV&#039;&#039;&#039; - Transfer failed. (abort SDO received)&lt;br /&gt;
 &#039;&#039;&#039;SDO_ABORTED_INTERNAL&#039;&#039;&#039; - Transfer failed. Internal abort.&lt;br /&gt;
 &#039;&#039;&#039;SDO_DOWNLOAD_IN_PROGRESS&#039;&#039;&#039; - Data not yet available&lt;br /&gt;
The function can be used in cycle waiting while return value is &#039;&#039;SDO_DOWNLOAD_IN_PROGRESS&#039;&#039;. But the better solution is calling it in callback function from &#039;&#039;writeNetworkDictCallBack&#039;&#039;. The callback is call after finishing the transfer.&lt;br /&gt;
&lt;br /&gt;
===Using PDO service===&lt;br /&gt;
&lt;br /&gt;
Using PDO service for data exchange is very easy in CanFestival. The most usual transmission type of PDOs is that they are transmitted after SYNC message. In this case it just has to be set up in objdictedit configuration and then it works, reads and stores values into mapped variables. After each PDO reception or transmission &#039;&#039;post_TPDO&#039;&#039; callback is called if used. &lt;br /&gt;
Sometimes it is necessary to send PDO from code without SYNC message reception. This is done by calling the function &#039;&#039;sendPDOevent&#039;&#039; with this syntax:&lt;br /&gt;
 UNS8 sendPDOevent(CO_Data* d);&lt;br /&gt;
where &#039;&#039;d&#039;&#039; is the pointer to local object dictionary structure. This function sends all PDOs defined by &#039;&#039;objdictedit&#039;&#039; and transmission type &#039;&#039;after event&#039;&#039; (0x255).&lt;br /&gt;
&lt;br /&gt;
===Generating SYNC message===&lt;br /&gt;
&lt;br /&gt;
If you want to set up local node to become the SYNC server you have to write some information to local OD. Here is an example of function which set up the SYNC messages generation:&lt;br /&gt;
 /**&lt;br /&gt;
  * This function initializes local canopen node to send SYNC message&lt;br /&gt;
  * with given period. &lt;br /&gt;
  * @param d - local object dictionary&lt;br /&gt;
  * @param period - period of the SYNC message in us&lt;br /&gt;
  */&lt;br /&gt;
 void synchro_setup(CO_Data *d, unsigned long period)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS32 SYNC_COBID = 0x40000080;&lt;br /&gt;
 	UNS32 SYNC_INTER = period;&lt;br /&gt;
 	UNS8 size = sizeof(UNS32); &lt;br /&gt;
 	writeLocalDict(d, 0x1006, 0x0, &amp;amp;SYNC_INTER, &amp;amp;size, RW);&lt;br /&gt;
 	writeLocalDict(d, 0x1005, 0x0, &amp;amp;SYNC_COBID, &amp;amp;size, RW);&lt;br /&gt;
 }&lt;br /&gt;
According to CANopen specification ID of the SYNC message is 0x80.&lt;br /&gt;
After the setup it can be started by command &#039;&#039;startSYNC(CO_Data *d)&#039;&#039; and stopped by command &#039;&#039;stopSYNC(CO_Data *d)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===SDO and PDO example===&lt;br /&gt;
&lt;br /&gt;
At the end I attach example of a function (&#039;&#039;cpd_start()&#039;&#039;) which starts some device communicating by CANopen. The ID of the device is given by the parameter. The other function (&#039;&#039;cpd_checkSDO_start()&#039;&#039;) is callback used to handle SDO transfer result. It is necessary to wait until one SDO transfer is finished before starting some other. Global variable &#039;&#039;cpd_init_step&#039;&#039; is used for counting actual step of SDO transfer. If some SDO transfer fails it is set to -1 and the startup process is terminated. &lt;br /&gt;
 /**&lt;br /&gt;
  * This function is given to the writeNetworkDict function as a callback.&lt;br /&gt;
  * It checks the result of SDO transmition and after finishing the transmition&lt;br /&gt;
  * it closes the transfer.&lt;br /&gt;
  * @param d - local object disctionary&lt;br /&gt;
  * @param nodeID - ID of the node which the local node is communicating with&lt;br /&gt;
  */ &lt;br /&gt;
 void cpd_checkSDO_start(CO_Data* d, UNS8 nodeId)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS32 abortCode;	&lt;br /&gt;
 	if(getWriteResultNetworkDict (d, nodeId, &amp;amp;abortCode) != SDO_FINISHED) {&lt;br /&gt;
 		cpd_init_step = -1;&lt;br /&gt;
 	}&lt;br /&gt;
 	closeSDOtransfer(&amp;amp;canopen_Data, nodeId, SDO_CLIENT);&lt;br /&gt;
 	cpd_start(&amp;amp;canopen_Data, nodeId);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 /**&lt;br /&gt;
  * This function switch canopen device into operational state. &lt;br /&gt;
  * @param d - local object dictionary&lt;br /&gt;
  * @param nodeId - ID of the device&lt;br /&gt;
  * return 0 - ok, -1 - failed&lt;br /&gt;
  */&lt;br /&gt;
 int cpd_start(CO_Data *d, UNS8 nodeId)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS8 data8;&lt;br /&gt;
 	UNS16 data16;&lt;br /&gt;
 	UNS32 data32;&lt;br /&gt;
 	switch(cpd_init_step++) {&lt;br /&gt;
 		case 0:&lt;br /&gt;
 			masterSendNMTstateChange(d, nodeId, NMT_Start_Node);&lt;br /&gt;
 			cpd_controlword = 0;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 			cpd_controlword = 6;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 			cpd_controlword = 0x0F;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 &lt;br /&gt;
 			// Start operational mode&lt;br /&gt;
 			data8 = 0xFC;&lt;br /&gt;
 			writeNetworkDictCallBack(d, nodeId, 0x6060, 0x00, 1, 0, &amp;amp;data8, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 1:&lt;br /&gt;
 			// Check operation status&lt;br /&gt;
 			readNetworkDictCallback(d, nodeId, 0x6061, 0x00, 0, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 2:&lt;br /&gt;
 			// Setpoint specification&lt;br /&gt;
 			data16 = 0x0002;&lt;br /&gt;
 			writeNetworkDictCallBack(d, nodeId, 0x301B, 0x11, 2, 0, &amp;amp;data16, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 3:&lt;br /&gt;
 			canopen_init_result = 0;&lt;br /&gt;
 			cpd_init_step = 0;&lt;br /&gt;
 			break;&lt;br /&gt;
 		case -1:&lt;br /&gt;
 			canopen_init_result = -1;&lt;br /&gt;
 			cpd_init_step = 0;&lt;br /&gt;
 			break;&lt;br /&gt;
 	}&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Emergency message===&lt;br /&gt;
&lt;br /&gt;
New version of CanFestival is extended by EMCY messages support. There is callback added which can be set to point to your own EMCY message handler.This handler has to be a function with three parameters defined in this way:&lt;br /&gt;
 void my_post_emcy(UNS8 nodeID, UNS16 errCode, UNS8 errReg)&lt;br /&gt;
After reception of an EMCY message this callback is called. The parameters keep information about node ID of the EMCY producer, error code and content of the error register.&lt;br /&gt;
To register your handler you have to set the callback in CanFestival initialization.&lt;br /&gt;
 my_Data.post_emcy = my_post_emcy;&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Boa5200_HOWTO&amp;diff=3490</id>
		<title>Boa5200 HOWTO</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Boa5200_HOWTO&amp;diff=3490"/>
		<updated>2009-02-16T12:15:12Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: /* Loading kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This document describes how to install and setup Linux and development environment for BOA5200  board. &lt;br /&gt;
Assume that you have a development machine (your PC) that you use for development and building your applications which you consequently want to get running and test on BOA5200.&lt;br /&gt;
&lt;br /&gt;
==Serial line setting==&lt;br /&gt;
The easiest way to communicate with the board ,when there is no OS and remote shell running on it, is over serial line. Recommended serial communication program is minicom. Setup minicom as follows:&lt;br /&gt;
&lt;br /&gt;
Baud Rate – 38400&lt;br /&gt;
&lt;br /&gt;
Bits - 8&lt;br /&gt;
&lt;br /&gt;
Parity – N&lt;br /&gt;
&lt;br /&gt;
Stop Bits - 1&lt;br /&gt;
&lt;br /&gt;
Hardware Flow Control:- No&lt;br /&gt;
&lt;br /&gt;
Software Flow Control:- No&lt;br /&gt;
&lt;br /&gt;
After the setup you will see Redboot&amp;gt; command prompt. Here you can enter Redboot`s commands.&lt;br /&gt;
Redboot is a simple boot manager bulit upon eCos real-time OS. For more details , see http://ecos.sourceware.org/ecos/docs-latest/redboot/redboot-guide.html.&lt;br /&gt;
&lt;br /&gt;
==IP address setting in Redboot==&lt;br /&gt;
You can set ip address in Redboot using command &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/ip-address-command.html ip_address] instead of obtaing it &lt;br /&gt;
from DHCP server(see next section).&lt;br /&gt;
&lt;br /&gt;
 ip_address [-b] [-l] local_IP_address  [/netmask_length] ] [-h  server_IP_address] [-d DNS_server_IP_address]&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 ip_address -l 192.168.100.1/24 -h 192.168.100.2&lt;br /&gt;
&lt;br /&gt;
==DHCP server setup==&lt;br /&gt;
Redboot supports BOOTP protocol which means that it is able to get network information (IP,netmask,gateway IP address,etc.) from DHCP server (provides BOOTP besides DHCP protocol).&lt;br /&gt;
&lt;br /&gt;
If you do not have a DHCP server on you network, you can install one on your development box: (on debian: apt-get install dhcpd) on your development machine. Example of my dhcp configuration file /etc/dhcpd.conf:&lt;br /&gt;
 # I have two ethernet interfaces: &lt;br /&gt;
 # eth0 - Internet&lt;br /&gt;
 # eth1 - connection to BOA5200 (IP= 192.168.10.1)&lt;br /&gt;
 # I do not want to progate infos to 147.32.0.0 subnetwork&lt;br /&gt;
 subnet 147.32.0.0 netmask 255.255.0.0 {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # private subnetwork&lt;br /&gt;
 subnet 192.168.10.0 netmask 255.255.255.0 {&lt;br /&gt;
  option broadcast-address 192.168.10.255;&lt;br /&gt;
  option routers 192.168.10.1;&lt;br /&gt;
  option subnet-mask 255.255.255.0;&lt;br /&gt;
  default-lease-time 600;&lt;br /&gt;
  max-lease-time 7200;&lt;br /&gt;
 &lt;br /&gt;
 # settings for BOA5200&lt;br /&gt;
  host BOA5200 {&lt;br /&gt;
   hardware ethernet 00:08:f1:11:22:33;&lt;br /&gt;
   fixed-address 192.168.10.2;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start dhcp server and reboot the board. After booting it has assigned IP, netmask and gateway address:&lt;br /&gt;
 +PHY0: AMD AM79C874&lt;br /&gt;
 FEC eth0: 100Mb/Full Duplex&lt;br /&gt;
 Ethernet eth0: MAC address 00:08:f1:11:22:33&lt;br /&gt;
 IP: 192.168.10.2/255.255.255.0, Gateway: 192.168.10.1&lt;br /&gt;
 Default server: 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
==TFTP server setup==&lt;br /&gt;
Redboot is able to load file from remote tftp server into memory. Tftp server is lanuched by inetd daemon when a new &lt;br /&gt;
connection comes. &lt;br /&gt;
Therefore add the following line into /etc/inetd.conf :&lt;br /&gt;
 tftp            dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd&lt;br /&gt;
&lt;br /&gt;
Default tftp root directory is /tftpboot. You can change it by calling in.tftpd with specified directory as a parameter.&lt;br /&gt;
&lt;br /&gt;
===Alternative way for Ubuntu based distro===&lt;br /&gt;
&lt;br /&gt;
1. Install tftpd and related packages.&lt;br /&gt;
 sudo apt-get install xinetd tftpd tftp&lt;br /&gt;
&lt;br /&gt;
2. Create /etc/xinetd.d/tftp and put this entry:&lt;br /&gt;
&lt;br /&gt;
 service tftp&lt;br /&gt;
 {&lt;br /&gt;
 protocol        = udp&lt;br /&gt;
 port            = 69&lt;br /&gt;
 socket_type     = dgram&lt;br /&gt;
 wait            = yes&lt;br /&gt;
 user            = nobody&lt;br /&gt;
 server          = /usr/sbin/in.tftpd&lt;br /&gt;
 server_args     = /tftpboot&lt;br /&gt;
 disable         = no&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
3. Make /tftpboot directory&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir /tftpboot&lt;br /&gt;
 sudo chmod -R 777 /tftpboot&lt;br /&gt;
 sudo chown -R nobody /tftpboot&lt;br /&gt;
&lt;br /&gt;
4. Start tftpd through xinetd&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/xinetd start&lt;br /&gt;
&lt;br /&gt;
see [[http://www.example.com Installing and setting TFTPD in Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
==Tool chain==&lt;br /&gt;
Toolchain(gcc, ld, ...) for MPC5200 can be downloaded from ftp://rtime.felk.cvut.cz/MPC5200/gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
Unpack the archive:&lt;br /&gt;
&lt;br /&gt;
 cd /&lt;br /&gt;
 tar xvzf gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
&lt;br /&gt;
You can also create a debian package from archive and then install the package:&lt;br /&gt;
 alien --to-deb gcc-powerpc-603e-linux-gnu-4.1.1-bin.tar.gz&lt;br /&gt;
Note: If you are not root, use fakeroot to run the command.&lt;br /&gt;
&lt;br /&gt;
==Getting the kernel==&lt;br /&gt;
&lt;br /&gt;
Linux kernel sources patched for the board are maintained in a [http://rtime.felk.cvut.cz/gitweb/boa5200/linux.git separate git tree]. Use&lt;br /&gt;
  git clone git://rtime.felk.cvut.cz/boa5200/linux.git linux-boa5200&lt;br /&gt;
to download it.&lt;br /&gt;
&lt;br /&gt;
You can also download the [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/.config;hb=HEAD default kernel .config].&lt;br /&gt;
&lt;br /&gt;
==Building kernel==&lt;br /&gt;
&lt;br /&gt;
The simples way to build the kernel is putting the .config file (see the previous section) to the directory with sources and running:&lt;br /&gt;
 make ARCH=ppc CROSS_COMPILE=powerpc-603e-linux-gnu-&lt;br /&gt;
&lt;br /&gt;
After compilation a built image is placed into arch/ppc/boot/image directory.&lt;br /&gt;
&lt;br /&gt;
The following commnad will install modules into &#039;&#039;&amp;lt;directory&amp;gt;&#039;&#039;/lib/modules/...&lt;br /&gt;
 make INSTALL_MOD_PATH=&#039;&#039;&amp;lt;directory&amp;gt;&#039;&#039; modules_install   &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Recommendation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Instead of building the kernel in the sources directory, we recommend using of a separate build directory:&lt;br /&gt;
&lt;br /&gt;
1. Make the build directory under the linux sources&lt;br /&gt;
 mkdir _build&lt;br /&gt;
 cd _build&lt;br /&gt;
&lt;br /&gt;
2. Put the [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/.config;hb=HEAD default .config] and [http://rtime.felk.cvut.cz/gitweb/boa5200/configs.git?a=blob_plain;f=linux/GNUmakefile;hb=HEAD GNUmakefile] into this directory&lt;br /&gt;
&lt;br /&gt;
3. Optionally update the kernel configuration&lt;br /&gt;
 make menuconfig &lt;br /&gt;
kernel config file (.config) will be updated&lt;br /&gt;
&lt;br /&gt;
Next time, always run &amp;lt;tt&amp;gt;make menuconfig&amp;lt;/tt&amp;gt; from the _build directory&lt;br /&gt;
&lt;br /&gt;
4. Compile the kenrel and install modules&lt;br /&gt;
 make &amp;amp;&amp;amp; make modules_install&lt;br /&gt;
&lt;br /&gt;
If you often forget to switch to the build directory and run make in the source directory, put the following GNUmakefile into your source directory:&lt;br /&gt;
 ifeq ($(O),)&lt;br /&gt;
 $(error Please, run make in a different build directory (or use O= option))&lt;br /&gt;
 else&lt;br /&gt;
 include Makefile&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
==Updating RedBoot==&lt;br /&gt;
&lt;br /&gt;
You need to update RedBoot in order to boot Linux 2.6 kernel.&lt;br /&gt;
&lt;br /&gt;
Download ftp://rtime.felk.cvut.cz/MPC5200/MPC5200-2007.02.01-redbootROMRAM.srec &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;!!! Warning: File names are case-sensitive !!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 # load RedBoot image from tftp server into memory at the address 0x100000&lt;br /&gt;
 RedBoot&amp;gt;lo -b 0x100000 MPC5200-2007.02.01-redbootROMRAM.srec&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;!!! Warning: File names are case-sensitive !!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 # write image in flash memory&lt;br /&gt;
 RedBoot&amp;gt;fi cr RedBoot&lt;br /&gt;
 RedBoot&amp;gt;reset&lt;br /&gt;
&lt;br /&gt;
If upgrade fails you can fallback to ROM Redboot image by typing &#039;A&amp;amp;M:&#039;&lt;br /&gt;
&lt;br /&gt;
If image of [http://ecos.sourceware.org/ecos/docs-latest/redboot/startup-mode.html ROMRAM version] of RedBoot with name &amp;quot;RedBoot&amp;quot; (case sensitive!!) is not found in FLASH minimal version of ROM RedBoot is started. This version does not support many services like TFTP protocol and FLASH management. To download ROMRAM version of RedBoot to FLASH it is necessary to follow these steps:&lt;br /&gt;
&lt;br /&gt;
Load RAM version of RedBoot to BOA using xmodem (the image file MPC5200-2006.05.10-redbootRAM.srec is placed on BOA original CD):&lt;br /&gt;
 RedBoot&amp;gt; lo -m xmodem&lt;br /&gt;
&lt;br /&gt;
When finished RedBoot should answer with something like that:&lt;br /&gt;
&lt;br /&gt;
 CEntry point: 0x00080100, address range: 0x00080000-0x000bea04&lt;br /&gt;
 xyzModem - CRC mode, 5763(SOH)/0(STX)/0(CAN) packets, 1 retries&lt;br /&gt;
&lt;br /&gt;
Then start the RedBoot:&lt;br /&gt;
 RedBoot&amp;gt; go&lt;br /&gt;
&lt;br /&gt;
RAM RedBoot should start now. Download the new version of ROMRAM RedBoot to FLASH according to the steps above.&lt;br /&gt;
&lt;br /&gt;
== Loading kernel ==&lt;br /&gt;
&lt;br /&gt;
Place the compiled kernel to the tftpboot directory. Then you can test your new image on the board as follows:&lt;br /&gt;
 # load kernel image from tftp server into memory&lt;br /&gt;
   RedBoot&amp;gt; load zImage.elf&lt;br /&gt;
 &lt;br /&gt;
 # execute image; root directory (/) is on flash memory&lt;br /&gt;
   RedBoot&amp;gt; exec&lt;br /&gt;
If you want to load the kernel from different TFTP server than the one provided by DHCP, you can use the following command to set the IP address of your server:&lt;br /&gt;
   RedBoot&amp;gt; ip_address -h 147.32.86.&amp;lt;xxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CAUTION:&#039;&#039;&#039; you must boot the kernel by  RedBoot release at least 2007_02_01 otherwise it will not run! So you must load into RAM and then run the appropriate RedBoot image (or replace/update its image on flash with the new one - see  &lt;br /&gt;
the next section) and after then you can execute kernel image.&lt;br /&gt;
&lt;br /&gt;
To write the loaded kernel to FLASH memory, execute command &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-create-command.html fis create]:&lt;br /&gt;
Example:&lt;br /&gt;
    RedBoot&amp;gt; fis cr Linux -b 0x00800000 -r 0x00100000 -e 0x00100000 -l 0x116000&lt;br /&gt;
&lt;br /&gt;
To load the kernel from the FLASH are later, execute&lt;br /&gt;
    RedBoot&amp;gt; fis load Linux&lt;br /&gt;
(Then, you can perform exec -c &amp;quot;...&amp;quot; cmd.)&lt;br /&gt;
&lt;br /&gt;
To find out paramter values execute [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-list-command.html fis list].&lt;br /&gt;
&lt;br /&gt;
==NFS-root setup==&lt;br /&gt;
&lt;br /&gt;
During the development phase of application it must be tested many times. However, it is annoying to copy several application files to flash memory every time.  The practical solution is to mount via NFS working directory or whole root directory from the point of OS running on the board.&lt;br /&gt;
&lt;br /&gt;
You can download already prepared root directory from ftp://rtime.felk.cvut.cz/MPC5200/MPC5200_root_070321.tar.gz&lt;br /&gt;
&lt;br /&gt;
To export /var/MPC5200_root directory on your PC via NFS add the following line to &#039;&#039;&#039;/etc/exports&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 /var/MPC5200_root 192.168.10.0/255.255.255.0(rw,sync,no_root_squash)&lt;br /&gt;
&lt;br /&gt;
Then run command &amp;quot;&#039;&#039;&#039;exportfs -ra&#039;&#039;&#039;&amp;quot; so that the change take an effect.&lt;br /&gt;
&lt;br /&gt;
If you want MPC5200 to be mount as root directory instead of that one in flash memory:&lt;br /&gt;
 # load kernel image from tftp server into memory&lt;br /&gt;
  RedBoot&amp;gt; load zImage.elf&lt;br /&gt;
 # execute kernel image with information where to &lt;br /&gt;
 # find root directory in parameter string&lt;br /&gt;
  RedBoot&amp;gt; ex -c &amp;quot;root=/dev/nfs rw nfsroot=192.168.10.1:/var/MPC5200_root ip=dhcp&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To mount another directory from Boa use this command:&lt;br /&gt;
 mount -t nfs &amp;lt;ip&amp;gt;:/path/to/exported/dir /path/on/boa&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; exportfs is a part of knfs (Ubuntu) or nfs-kernel-server (Debian) package.&lt;br /&gt;
&lt;br /&gt;
==Updating root filesystem on BOA==&lt;br /&gt;
You can download already prepared root directory from ftp://rtime.felk.cvut.cz/MPC5200/MPC5200_root_070321.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create jffs2 image:&lt;br /&gt;
 mkfs.jffs2 -r MPC5200_root -o jffs2.img -b -e 0x10000&lt;br /&gt;
&lt;br /&gt;
On BOA:&lt;br /&gt;
&lt;br /&gt;
Delete old image:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-delete-command.html fis delete] jffs2&lt;br /&gt;
&lt;br /&gt;
Fill memory area at address 0x100000 of size 0xD00000 (size of root image + free space wanted) using &lt;br /&gt;
[http://ecos.sourceware.org/ecos/docs-latest/redboot/mfill-command.html mfill] command:&lt;br /&gt;
&lt;br /&gt;
 mfi -b 0x100000 -l 0xD00000 -p 0xffffffff&lt;br /&gt;
&lt;br /&gt;
Load root image to that memory area:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/download-command.html load] -r -b 0x100000 jffs2.img&lt;br /&gt;
&lt;br /&gt;
Write image to flash:&lt;br /&gt;
 [http://ecos.sourceware.org/ecos/docs-latest/redboot/fis-create-command.html fis cr] -b 0x100000 jffs2 -l 0xD00000&lt;br /&gt;
&lt;br /&gt;
Root filesystem is mounted as read-only in Linux. To enable writting:&lt;br /&gt;
 mount -o remount,rw /&lt;br /&gt;
&lt;br /&gt;
--[[User:Molnam1|Molnam1]] 17:35, 15 December 2008 (CET)&lt;br /&gt;
&lt;br /&gt;
== Login with telnet ==&lt;br /&gt;
 telnet &amp;lt;ip address of boa&amp;gt;&lt;br /&gt;
Log in as root, ask me for the password. --[[User:Sojka|Sojka]] 20:42, 21 March 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
==Setting up bootloder (automatic boot)==&lt;br /&gt;
&lt;br /&gt;
Use &#039;fconfig&#039; command (see [http://ecos.sourceware.org/ecos/docs-latest/redboot/persistent-state-flash.html RedBoot manual]) to set up bootloader configuration. Recommended configuration:&lt;br /&gt;
&lt;br /&gt;
 Run script at boot: true&lt;br /&gt;
 Boot script:&lt;br /&gt;
  load zImage.elf&lt;br /&gt;
  ex -c &amp;quot;root=/dev/nfs rw nfsroot=192.168.123.254:/var/MPC5200_root ip=dhcp&amp;quot;&lt;br /&gt;
 Boot script timeout (1000ms resolution): 10 &lt;br /&gt;
 Use BOOTP for network configuration: true&lt;br /&gt;
 Default server IP address: IP address of your computer&lt;br /&gt;
 FEC Network hardware address [MAC]: choose MAC address of the unit (example: 0x00:0x00:0x00:0x00:0x00:0x02)&lt;br /&gt;
 GDB connection port: 9000&lt;br /&gt;
 Force console for special debug messages: false&lt;br /&gt;
 Network debug at boot time: false&lt;br /&gt;
 Update RedBoot non-volatile configuration - continue (y/n)? y&lt;br /&gt;
&lt;br /&gt;
==Socketcan==&lt;br /&gt;
&lt;br /&gt;
To set up can interface, it is necessary to configure the communication speed first and then bring the interface up. Communication speed can be set up using following command (for can0 interface @ 1Mbit):&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_baudrate&lt;br /&gt;
&lt;br /&gt;
For newer version of socketcan you must use:&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_bittiming/bitrate&lt;br /&gt;
&lt;br /&gt;
The constant 660000 for 1Mbit speed was found experimentally, driver seems to calculate the transmission speed improperly. To bring up the can network interface, use the same command as with any other network interface, i.e.&lt;br /&gt;
&lt;br /&gt;
 ifconfig can0 up&lt;br /&gt;
&lt;br /&gt;
The most comfortable way of setting up both can interfaces upon startup of system is to place following script to /etc/init.d/ (name it &#039;can&#039;, for example)&lt;br /&gt;
&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can0/can_baudrate&lt;br /&gt;
 echo 660000 &amp;gt;/sys/class/net/can1/can_baudrate&lt;br /&gt;
 ifconfig can0 up&lt;br /&gt;
 ifconfig can1 up&lt;br /&gt;
&lt;br /&gt;
==CanFestival==&lt;br /&gt;
&lt;br /&gt;
===Obtaining and building CanFestival===&lt;br /&gt;
&lt;br /&gt;
CanFestival driver source can be downloaded from. The primary way how to do it is to check out the source directory from CanFestival CVS by these steps:&lt;br /&gt;
 cvs -d:pserver:anonymous@lolitech.dyndns.org:/canfestival login&lt;br /&gt;
 (type return, without entering a password)&lt;br /&gt;
The system will respond:&lt;br /&gt;
 Logging in to :pserver:anonymous@lolitech.dyndns.org:2401/canfestival&lt;br /&gt;
Then, enter:&lt;br /&gt;
 cvs -z3 -d:pserver:anonymous@lolitech.dyndns.org:/canfestival co -P CanFestival-3&lt;br /&gt;
Then insert CanFestival folder and run this commands:&lt;br /&gt;
 ./configure --timers=unix --can=socket --cc=powerpc-603e-linux-gnu-gcc --arch=ppc --os=linux --target=unix &lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
Building of CanFestival will produce some libraries and copy them to /usr/powerpc-603e-linux-gnu/lib folder.&lt;br /&gt;
&lt;br /&gt;
===Setting up local CANopen node===&lt;br /&gt;
&lt;br /&gt;
CanFestival source includes tool called &#039;&#039;objdictedit&#039;&#039;. This program has graphical user interface and serves to creating configuration of the CANopen node of application we develop. It is started by command &#039;&#039;objdictedit&#039;&#039;. Using this program you can create the object dictionary for the CanFestival. Mainly it is necessary to set up all SDO and PDO, the node has to send and receive. To each PDO you have to define more things - PDO receive or transmit, variable to be mapped and variable mapping. The variable will then be used in application code to exchange data between CanFestival driver and application. If you set up PDOs here they will be sent and received automatically and the values will be stored into mapped variable. Setting up SDO means that you can use it in your application, but if you want to send it, it has to be done in code.&lt;br /&gt;
After creating this basic configuration you have to build the dictionary which results into to files with extensions .h and .c. You have to link these files with your application.&lt;br /&gt;
&lt;br /&gt;
===Initializing and starting CanFestival===&lt;br /&gt;
&lt;br /&gt;
To explain how to use CanFestival I include some code examples. It supposes node configuration generated by &#039;&#039;objdictedit&#039;&#039; which name is &#039;&#039;canopen&#039;&#039;. It is then used as prefix of automatically generated functions and variables (&#039;&#039;canopen_Data&#039;&#039; is for example object dictionary used by CanFestival). &lt;br /&gt;
Header &#039;&#039;canfestival.h&#039;&#039; has to be included. For start using CanFestival it is necessary to load dynamic library with CAN bus driver API created while compiling CanFestival source. In the example SocketCan driver is used to access CAN bus. &lt;br /&gt;
 if(!LoadCanDriver(&amp;quot;libcanfestival_can_socket.so&amp;quot;)) {&lt;br /&gt;
 	exit -1;&lt;br /&gt;
 }&lt;br /&gt;
Then you have to open CAN device. Parameters of the communication have to be prepared in structure of type &#039;&#039;s_Board&#039;&#039;. In this case CAN is set to use device &#039;&#039;can1&#039;&#039; and baudrate 1Mbps. Handler of the bus is then stored to variable of type &#039;&#039;CAN_HANDLE&#039;&#039;.&lt;br /&gt;
 /**&lt;br /&gt;
  * CAN board definition.&lt;br /&gt;
  * Device name can1, baudrate 1M&lt;br /&gt;
  */&lt;br /&gt;
 s_BOARD canopen_board = {&amp;quot;1&amp;quot;, &amp;quot;1000&amp;quot;};&lt;br /&gt;
&lt;br /&gt;
 CAN_HANDLE canopen_handle;&lt;br /&gt;
 &lt;br /&gt;
 if(!(canopen_handle = canOpen(&amp;amp;canopen_board, &amp;amp;canopen_Data))) {&lt;br /&gt;
 	exit -1;&lt;br /&gt;
 }&lt;br /&gt;
CanFestival implements callbacks to some events like change of state or message reception. There are pointers to callback functions in &#039;&#039;canopen_Data&#039;&#039; structure. You can assign your own functions to these pointers or leave them unused.&lt;br /&gt;
 canopen_Data.initialisation = canopen_initialisation;&lt;br /&gt;
 canopen_Data.preOperational = canopen_preOperational; &lt;br /&gt;
 canopen_Data.operational = canopen_operational; &lt;br /&gt;
 canopen_Data.post_sync = canopen_post_sync; &lt;br /&gt;
 canopen_Data.post_TPDO = canopen_post_TPDO; &lt;br /&gt;
 canopen_Data.stopped = canopen_stopped; &lt;br /&gt;
After setting up these few things you have to call function &#039;&#039;StartTimerLoop&#039;&#039; which initializes CanFestival timers. As an argument you have to insert pointer to the first function you want to proceed after starting the timers. &lt;br /&gt;
 StartTimerLoop(&amp;amp;initNode); &lt;br /&gt;
Here is an example of such a function. It sets local node ID to 1 and bring the node to operation state. Callback functions are called after changing state if used.&lt;br /&gt;
 void initNode(CO_Data * d, UNS32 id)&lt;br /&gt;
 {&lt;br /&gt;
 	setNodeId(&amp;amp;canopen_Data, 0x01);&lt;br /&gt;
	setState(&amp;amp;canopen_Data, Initialisation);&lt;br /&gt;
	setState(&amp;amp;canopen_Data, Operational);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Stopping CanFestival===&lt;br /&gt;
&lt;br /&gt;
After finishing work with CANopen it is good to stop the communication and timers and close the device. It is done by these few functions.&lt;br /&gt;
 setState(&amp;amp;canopen_Data, Stopped);&lt;br /&gt;
 StopTimerLoop();&lt;br /&gt;
 canClose(&amp;amp;canopen_Data);&lt;br /&gt;
 canopen_handle = NULL;&lt;br /&gt;
&lt;br /&gt;
===Writing to Object dictionary===&lt;br /&gt;
&lt;br /&gt;
CANopen devices and all network services of each node are configured by writing to device object dictionary (OD). It is different while writing to local OD or OD of some network device.&lt;br /&gt;
====Writing to local OD====&lt;br /&gt;
Function &#039;&#039;WriteLocalDict&#039;&#039; is used for writing to OD of local node managed by CanFestival.&lt;br /&gt;
 UNS32 writeLocalDict( CO_Data* d, &lt;br /&gt;
 UNS16 wIndex, &lt;br /&gt;
 UNS8 bSubindex, &lt;br /&gt;
 void * pSourceData, &lt;br /&gt;
 UNS8 * pExpectedSize, &lt;br /&gt;
 UNS8 checkAccess);&lt;br /&gt;
Meaning of function arguments:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;wIndex&#039;&#039;&#039; - the index in the object dictionary where you want to write an entry&lt;br /&gt;
 &#039;&#039;&#039;bSubindex&#039;&#039;&#039; - the subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this   index. Look at the canopen standard for further information&lt;br /&gt;
 &#039;&#039;&#039;pbSourceData&#039;&#039;&#039; - pointer to the variable that holds the value that should be copied into the object dictionary&lt;br /&gt;
 &#039;&#039;&#039;pExpectedSize&#039;&#039;&#039; - pointer to variable with size of the data to be written&lt;br /&gt;
 &#039;&#039;&#039;CheckAccess&#039;&#039;&#039; - if other than 0, do not read if the data is Read Only or Constant&lt;br /&gt;
&lt;br /&gt;
====Writing to network OD====&lt;br /&gt;
&lt;br /&gt;
It is necessary to use SDO service for writing data to OD of some network device. Each CANopen device has at least one SDO server. It means that it is able to receive SDOs with one ID and answer by SDOs with another ID. It is usual that the server listen for SDOs with ID 0x600 + ID of the node and transmits SDOs of ID 0x580 + node ID. Each SDO we want to use has to be defined while creating node configuration by &#039;&#039;objdictedit&#039;&#039;. Then the SDO is sent by calling appropriate function. The best is to use function &#039;&#039;writeNetworkDictCallBack&#039;&#039; which syntax is shown below.&lt;br /&gt;
 UNS8 writeNetworkDictCallBack (CO_Data* d, &lt;br /&gt;
 UNS8 nodeId, &lt;br /&gt;
 UNS16 index,&lt;br /&gt;
 UNS8 subIndex, &lt;br /&gt;
 UNS8 count, &lt;br /&gt;
 UNS8 dataType, &lt;br /&gt;
 void *data, &lt;br /&gt;
 SDOCallback_t Callback);&lt;br /&gt;
Meaning of function arguments:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;nodeId&#039;&#039;&#039; - ID of the device we want to send SDO&lt;br /&gt;
 &#039;&#039;&#039;index&#039;&#039;&#039; - the index in the object dictionary where you want to write an entry&lt;br /&gt;
 &#039;&#039;&#039;subIndex&#039;&#039;&#039; - the subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information&lt;br /&gt;
 &#039;&#039;&#039;count&#039;&#039;&#039; - number of bytes to be written&lt;br /&gt;
 &#039;&#039;&#039;dataType&#039;&#039;&#039; - type of the data, use 0 for integers, real numbers and other values&lt;br /&gt;
 &#039;&#039;&#039;data&#039;&#039;&#039; - pointer to the data&lt;br /&gt;
 &#039;&#039;&#039;Callback&#039;&#039;&#039; - pointer to a function which is called after finishing the transfer&lt;br /&gt;
The SDO service is by definition confirmed. It means that SDO server sends response with result of the transfer after each SDO reception. This response has to be read by client to be sure that the data were written correctly. The result should be read in your function which pointer is given to the function &#039;&#039;writeNetworkDictCallBack&#039;&#039; as parameter &#039;&#039;callback&#039;&#039;. The result of SDO transfer in such a function is read by CanFestival function &#039;&#039;getWriteResultNetworkDict&#039;&#039;. This function has to be called after each SDO transmission because it releases line used to transfer. Header of this function is:&lt;br /&gt;
 UNS8 getWriteResultNetworkDict (CO_Data* d, UNS8 nodeId, UNS32 * abortCode);&lt;br /&gt;
And meaning of function arguments is:&lt;br /&gt;
 &#039;&#039;&#039;d&#039;&#039;&#039; - pointer to local object dictionary structure&lt;br /&gt;
 &#039;&#039;&#039;nodeId&#039;&#039;&#039; - ID of the device we have sent SDO&lt;br /&gt;
 &#039;&#039;&#039;abortCode&#039;&#039;&#039; - pointer to the variable where error code is written in case of error&lt;br /&gt;
The function can return one of these values according to the SDO transfer state:&lt;br /&gt;
 &#039;&#039;&#039;SDO_FINISHED&#039;&#039;&#039; - data is available&lt;br /&gt;
 &#039;&#039;&#039;SDO_ABORTED_RCV&#039;&#039;&#039; - Transfer failed. (abort SDO received)&lt;br /&gt;
 &#039;&#039;&#039;SDO_ABORTED_INTERNAL&#039;&#039;&#039; - Transfer failed. Internal abort.&lt;br /&gt;
 &#039;&#039;&#039;SDO_DOWNLOAD_IN_PROGRESS&#039;&#039;&#039; - Data not yet available&lt;br /&gt;
The function can be used in cycle waiting while return value is &#039;&#039;SDO_DOWNLOAD_IN_PROGRESS&#039;&#039;. But the better solution is calling it in callback function from &#039;&#039;writeNetworkDictCallBack&#039;&#039;. The callback is call after finishing the transfer.&lt;br /&gt;
&lt;br /&gt;
===Using PDO service===&lt;br /&gt;
&lt;br /&gt;
Using PDO service for data exchange is very easy in CanFestival. The most usual transmission type of PDOs is that they are transmitted after SYNC message. In this case it just has to be set up in objdictedit configuration and then it works, reads and stores values into mapped variables. After each PDO reception or transmission &#039;&#039;post_TPDO&#039;&#039; callback is called if used. &lt;br /&gt;
Sometimes it is necessary to send PDO from code without SYNC message reception. This is done by calling the function &#039;&#039;sendPDOevent&#039;&#039; with this syntax:&lt;br /&gt;
 UNS8 sendPDOevent(CO_Data* d);&lt;br /&gt;
where &#039;&#039;d&#039;&#039; is the pointer to local object dictionary structure. This function sends all PDOs defined by &#039;&#039;objdictedit&#039;&#039; and transmission type &#039;&#039;after event&#039;&#039; (0x255).&lt;br /&gt;
&lt;br /&gt;
===Generating SYNC message===&lt;br /&gt;
&lt;br /&gt;
If you want to set up local node to become the SYNC server you have to write some information to local OD. Here is an example of function which set up the SYNC messages generation:&lt;br /&gt;
 /**&lt;br /&gt;
  * This function initializes local canopen node to send SYNC message&lt;br /&gt;
  * with given period. &lt;br /&gt;
  * @param d - local object dictionary&lt;br /&gt;
  * @param period - period of the SYNC message in us&lt;br /&gt;
  */&lt;br /&gt;
 void synchro_setup(CO_Data *d, unsigned long period)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS32 SYNC_COBID = 0x40000080;&lt;br /&gt;
 	UNS32 SYNC_INTER = period;&lt;br /&gt;
 	UNS8 size = sizeof(UNS32); &lt;br /&gt;
 	writeLocalDict(d, 0x1006, 0x0, &amp;amp;SYNC_INTER, &amp;amp;size, RW);&lt;br /&gt;
 	writeLocalDict(d, 0x1005, 0x0, &amp;amp;SYNC_COBID, &amp;amp;size, RW);&lt;br /&gt;
 }&lt;br /&gt;
According to CANopen specification ID of the SYNC message is 0x80.&lt;br /&gt;
After the setup it can be started by command &#039;&#039;startSYNC(CO_Data *d)&#039;&#039; and stopped by command &#039;&#039;stopSYNC(CO_Data *d)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===SDO and PDO example===&lt;br /&gt;
&lt;br /&gt;
At the end I attach example of a function (&#039;&#039;cpd_start()&#039;&#039;) which starts some device communicating by CANopen. The ID of the device is given by the parameter. The other function (&#039;&#039;cpd_checkSDO_start()&#039;&#039;) is callback used to handle SDO transfer result. It is necessary to wait until one SDO transfer is finished before starting some other. Global variable &#039;&#039;cpd_init_step&#039;&#039; is used for counting actual step of SDO transfer. If some SDO transfer fails it is set to -1 and the startup process is terminated. &lt;br /&gt;
 /**&lt;br /&gt;
  * This function is given to the writeNetworkDict function as a callback.&lt;br /&gt;
  * It checks the result of SDO transmition and after finishing the transmition&lt;br /&gt;
  * it closes the transfer.&lt;br /&gt;
  * @param d - local object disctionary&lt;br /&gt;
  * @param nodeID - ID of the node which the local node is communicating with&lt;br /&gt;
  */ &lt;br /&gt;
 void cpd_checkSDO_start(CO_Data* d, UNS8 nodeId)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS32 abortCode;	&lt;br /&gt;
 	if(getWriteResultNetworkDict (d, nodeId, &amp;amp;abortCode) != SDO_FINISHED) {&lt;br /&gt;
 		cpd_init_step = -1;&lt;br /&gt;
 	}&lt;br /&gt;
 	closeSDOtransfer(&amp;amp;canopen_Data, nodeId, SDO_CLIENT);&lt;br /&gt;
 	cpd_start(&amp;amp;canopen_Data, nodeId);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 /**&lt;br /&gt;
  * This function switch canopen device into operational state. &lt;br /&gt;
  * @param d - local object dictionary&lt;br /&gt;
  * @param nodeId - ID of the device&lt;br /&gt;
  * return 0 - ok, -1 - failed&lt;br /&gt;
  */&lt;br /&gt;
 int cpd_start(CO_Data *d, UNS8 nodeId)&lt;br /&gt;
 {&lt;br /&gt;
 	UNS8 data8;&lt;br /&gt;
 	UNS16 data16;&lt;br /&gt;
 	UNS32 data32;&lt;br /&gt;
 	switch(cpd_init_step++) {&lt;br /&gt;
 		case 0:&lt;br /&gt;
 			masterSendNMTstateChange(d, nodeId, NMT_Start_Node);&lt;br /&gt;
 			cpd_controlword = 0;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 			cpd_controlword = 6;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 			cpd_controlword = 0x0F;&lt;br /&gt;
                        sendPDOevent(d);&lt;br /&gt;
 &lt;br /&gt;
 			// Start operational mode&lt;br /&gt;
 			data8 = 0xFC;&lt;br /&gt;
 			writeNetworkDictCallBack(d, nodeId, 0x6060, 0x00, 1, 0, &amp;amp;data8, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 1:&lt;br /&gt;
 			// Check operation status&lt;br /&gt;
 			readNetworkDictCallback(d, nodeId, 0x6061, 0x00, 0, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 2:&lt;br /&gt;
 			// Setpoint specification&lt;br /&gt;
 			data16 = 0x0002;&lt;br /&gt;
 			writeNetworkDictCallBack(d, nodeId, 0x301B, 0x11, 2, 0, &amp;amp;data16, cpd_checkSDO_start);&lt;br /&gt;
 			break;&lt;br /&gt;
 		case 3:&lt;br /&gt;
 			canopen_init_result = 0;&lt;br /&gt;
 			cpd_init_step = 0;&lt;br /&gt;
 			break;&lt;br /&gt;
 		case -1:&lt;br /&gt;
 			canopen_init_result = -1;&lt;br /&gt;
 			cpd_init_step = 0;&lt;br /&gt;
 			break;&lt;br /&gt;
 	}&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Emergency message===&lt;br /&gt;
&lt;br /&gt;
New version of CanFestival is extended by EMCY messages support. There is callback added which can be set to point to your own EMCY message handler.This handler has to be a function with three parameters defined in this way:&lt;br /&gt;
 void my_post_emcy(UNS8 nodeID, UNS16 errCode, UNS8 errReg)&lt;br /&gt;
After reception of an EMCY message this callback is called. The parameters keep information about node ID of the EMCY producer, error code and content of the error register.&lt;br /&gt;
To register your handler you have to set the callback in CanFestival initialization.&lt;br /&gt;
 my_Data.post_emcy = my_post_emcy;&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=ML403&amp;diff=3414</id>
		<title>ML403</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=ML403&amp;diff=3414"/>
		<updated>2009-01-06T22:40:36Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FPGA HW&amp;amp;SW development environment ==&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
&lt;br /&gt;
* Xilinx tools&lt;br /&gt;
** ISE 9.2i -- package for FPGA HW design; compiles input (HDL, netlist, schematics) and optimizes output bitstream according to given user constraints (mainly timing and pin assignment). In our work, ISE programs are almost exclusively invoked by EDK tools.&lt;br /&gt;
** EDK 9.2i -- package for FPGA HW&amp;amp;SW embedded system development; contains libraries of embedded computer IP cores and serves to glue HW FPGA cores together with software.&lt;br /&gt;
** Chipscope 9.1i (optional) -- logic analyzer inside of FPGA. Dedicated IP core sends measured waveforms by JTAG to Chipscope analyzer, running on PC with GUI.&lt;br /&gt;
* open-source software&lt;br /&gt;
** libusb-driver -- much better replacement/emulator of driver for Xilinx USB-JTAG adapter&lt;br /&gt;
** gcc 4.3.2, binutils, glibc -- development of system-less as well as Linux SW for PowerPC, contained in Xilinx Virtex-4 hybrid FPGA&lt;br /&gt;
** Linux 2.6.27-rc4 PowerPC kernel containing Xilinx Virtex support&lt;br /&gt;
&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
&lt;br /&gt;
* Xilinx Virtex-4 XC4VFX12 hybrid FPGA IC on ML405 evaluation board&lt;br /&gt;
&lt;br /&gt;
== Xilinx FPGA HW&amp;amp;SW development ==&lt;br /&gt;
&lt;br /&gt;
=== Running Linux on FPGA embedded system ===&lt;br /&gt;
&lt;br /&gt;
System HW is created by XPS (Xilinx Platform Studio, the essential part of EDK). The system is composed of library IP cores: the main processor (actually a hard-core in case of PowerPC), peripherals (UART, Ethernet), clock modules, memory drivers and various bridges, and possibly also user developed HDL IP cores. XPS provides a way to instantiate each core once or more times in one system, to interconnect the cores either by defined interfaces (buses), or by generic named signals. Global clock is defined, which will imply timing constraints. Also a pin map is defined for signals, which should be pinned out of the FPGA package. For standard buses, XPS can also allocate memory resources and divide them between selected peripherals to avoid bus collision.&lt;br /&gt;
&lt;br /&gt;
All the mentioned hardware description is stored in a single file, system.mhs. From this file, XPS can create netlists and then invoke several ISE tools, to compile whole hardware into an output bitstream.&lt;br /&gt;
&lt;br /&gt;
XPS initial work flow to get HW running with Linux or a system-less software:&lt;br /&gt;
&lt;br /&gt;
* Get an initial design either by copying a directory tree from a working one, or start it by XPS Base System Builder (GUI wizard). &lt;br /&gt;
&lt;br /&gt;
== Configuration of open-source software for Xilinx Virtex-4 ==&lt;br /&gt;
&lt;br /&gt;
=== Toolchain binaries for Debian ===&lt;br /&gt;
&lt;br /&gt;
Invoke next line to add rtime cross-dev into packages sources list&lt;br /&gt;
&lt;br /&gt;
 echo deb ftp://rtime.felk.cvut.cz/debian unstable main &amp;gt;/etc/apt/sources.list.d/rtime-debs.list&lt;br /&gt;
&lt;br /&gt;
Update packages cache (aptitude update)&lt;br /&gt;
Check, that libmpfr1ldbl and libgmp3c2 packages are installed and select next packages&lt;br /&gt;
&lt;br /&gt;
 binutils-powerpc-elf&lt;br /&gt;
 binutils-powerpc-linux-gnu&lt;br /&gt;
 gcc-powerpc-elf&lt;br /&gt;
 gcc-powerpc-linux-gnu&lt;br /&gt;
 glibc-powerpc-linux-gnu&lt;br /&gt;
&lt;br /&gt;
=== Toolchain preparation and kernel build information ===&lt;br /&gt;
&lt;br /&gt;
Debian PowerPC GCC build log&lt;br /&gt;
&lt;br /&gt;
[http://buildd.debian.org/build.php?arch=&amp;amp;pkg=gcc-4.3 Debian GCC-4.3 build logs]&lt;br /&gt;
&lt;br /&gt;
==== Kernel headers install ====&lt;br /&gt;
&lt;br /&gt;
[http://xilinx.wikidot.com/u-boot http://xilinx.wikidot.com/u-boot]&lt;br /&gt;
&lt;br /&gt;
 mkdir src&lt;br /&gt;
 cd src&lt;br /&gt;
 git clone  git://git.xilinx.com/u-boot-xlnx.git&lt;br /&gt;
 git clone  git://git.xilinx.com/gen-mhs-devtree.git&lt;br /&gt;
 git clone --reference /usr/src/linux-devel git://git.xilinx.com/linux-2.6-xlnx.git&lt;br /&gt;
&lt;br /&gt;
 mkdir -p build/ml403/linux&lt;br /&gt;
 cd build/ml403/linux&lt;br /&gt;
&lt;br /&gt;
Copy and adapt GNUmakefile to override ARCH and select kernel source directory&lt;br /&gt;
&lt;br /&gt;
Run&lt;br /&gt;
&lt;br /&gt;
 make headers_install&lt;br /&gt;
&lt;br /&gt;
The header-files for building GCC nd GLIB are prepared in usr/include directory.&lt;br /&gt;
Copy files found there to the directory /usr/powerpc-linux-gnu/sys-include&lt;br /&gt;
&lt;br /&gt;
==== Glibc ====&lt;br /&gt;
&lt;br /&gt;
The required files are glibc-2.7ds1.tar.bz2 glibc-linuxthreads-20071023.tar.bz2 glibc-libidn-2.7.tar.bz2 glibc-ports-2.7.tar.bz2&lt;br /&gt;
&lt;br /&gt;
 mkdir -p src&lt;br /&gt;
 cd src&lt;br /&gt;
 tar -xjf ../glibc-2.7ds1.tar.bz2&lt;br /&gt;
 tar -xjf ../glibc-linuxthreads-20071023.tar.bz2&lt;br /&gt;
 tar -xjf ../glibc-libidn-2.7.tar.bz2&lt;br /&gt;
 ( cd glibc-2.7 ; mv glibc-libidn-2.7 libidn )&lt;br /&gt;
 tar -xjf ../glibc-ports-2.7.tar.bz2&lt;br /&gt;
 ( cd glibc-2.7 ; mv glibc-ports-2.7 ports )&lt;br /&gt;
 ln -s glibc-2.7 glibc&lt;br /&gt;
&lt;br /&gt;
Prepare directory to build PowerPC version of GLIBC&lt;br /&gt;
&lt;br /&gt;
 mkdir -p build/powerpc-linux/glibc&lt;br /&gt;
&lt;br /&gt;
If there is no previous install of GLIBC, use next dummy build to install headers.&lt;br /&gt;
They are required to build GCC later&lt;br /&gt;
&lt;br /&gt;
 libc_cv_ppc_machine=yes \&lt;br /&gt;
 libc_cv_mabi_ibmlongdouble=yes \&lt;br /&gt;
 libc_cv_mlong_double_128=yes \&lt;br /&gt;
 libc_cv_forced_unwind=yes \&lt;br /&gt;
 libc_cv_c_cleanup=yes \&lt;br /&gt;
 CC=gcc \&lt;br /&gt;
 ../../../src/glibc/configure --prefix=/usr \&lt;br /&gt;
        --build=x86_64-linux-gnu \&lt;br /&gt;
        --host=powerpc-linux-gnu \&lt;br /&gt;
        --prefix=/usr \&lt;br /&gt;
        --without-cvs \&lt;br /&gt;
        --enable-add-ons=libidn,nptl \&lt;br /&gt;
        --enable-profile \&lt;br /&gt;
        --without-selinux \&lt;br /&gt;
        --with-headers=/usr/powerpc-linux-gnu/sys-include \&lt;br /&gt;
        --enable-kernel=2.6.26 \&lt;br /&gt;
        --enable-hacker-mode \&lt;br /&gt;
        --without-cvs --disable-sanity-checks&lt;br /&gt;
&lt;br /&gt;
 make DESTDIR=/usr-pkg/glibc-linux-powerpc-2.7-1 \&lt;br /&gt;
       inst_includedir=/usr-pkg/glibc-linux-powerpc-2.7-1/include \&lt;br /&gt;
       install-headers&lt;br /&gt;
&lt;br /&gt;
==== Build binutils ====&lt;br /&gt;
&lt;br /&gt;
 ../../../binutils/configure \&lt;br /&gt;
        --prefix=/usr \&lt;br /&gt;
        --disable-nls \&lt;br /&gt;
        --build=x86_64-linux-gnu \&lt;br /&gt;
        --host=x86_64-linux-gnu \&lt;br /&gt;
        --target=powerpc-linux-gnu \&lt;br /&gt;
        --enable-targets=powerpc64-linux-gnu&lt;br /&gt;
&lt;br /&gt;
 make &amp;amp;&amp;amp; make DESTDIR=/usr-pkg/binutils-powerpc-linux-gnu_2.18-2_amd64 install&lt;br /&gt;
&lt;br /&gt;
==== Build GCC ====&lt;br /&gt;
&lt;br /&gt;
 ../../../gcc-4.3/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-libstdcxx-debug \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-softfloat \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=powerpc-linux,powerpc64-linux \&lt;br /&gt;
         --with-cpu=default32 \&lt;br /&gt;
         --with-long-double-128 \&lt;br /&gt;
         --enable-checking=release \&lt;br /&gt;
         --build=x86_64-linux-gnu \&lt;br /&gt;
         --host=x86_64-linux-gnu \&lt;br /&gt;
         --target=powerpc-linux-gnu \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --disable-libmudflap&lt;br /&gt;
&lt;br /&gt;
==== Finally build GLIBC ====&lt;br /&gt;
&lt;br /&gt;
 ../../../src/glibc/configure \&lt;br /&gt;
        --build=x86_64-linux-gnu \&lt;br /&gt;
        --host=powerpc-linux-gnu \&lt;br /&gt;
        --prefix=/usr \&lt;br /&gt;
        --without-cvs \&lt;br /&gt;
        --enable-add-ons=libidn,nptl \&lt;br /&gt;
        --enable-profile \&lt;br /&gt;
        --without-selinux \&lt;br /&gt;
        --with-headers=/usr/powerpc-linux-gnu/sys-include \&lt;br /&gt;
        --enable-kernel=2.6.20&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 make install_root=/usr-pkg/glibc-2.7-powerpc install&lt;br /&gt;
&lt;br /&gt;
=== U-Boot ===&lt;br /&gt;
&lt;br /&gt;
  make ml405_config&lt;br /&gt;
  make&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=ML403&amp;diff=3413</id>
		<title>ML403</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=ML403&amp;diff=3413"/>
		<updated>2009-01-06T19:06:37Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FPGA HW&amp;amp;SW development environment ==&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
&lt;br /&gt;
* Xilinx tools&lt;br /&gt;
** ISE 9.2i -- package for FPGA HW design; compiles input (HDL, netlist, schematics) and optimizes output bitstream according to given user constraints (mainly timing and pin assignment). In our work, ISE programs are almost exclusively invoked by EDK tools.&lt;br /&gt;
** EDK 9.2i -- package for FPGA HW&amp;amp;SW embedded system development; contains libraries of embedded computer IP cores and serves to glue HW FPGA cores together with software.&lt;br /&gt;
** Chipscope 9.1i (optional) -- logic analyzer inside of FPGA. Dedicated IP core sends measured waveforms by JTAG to Chipscope analyzer, running on PC with GUI.&lt;br /&gt;
* open-source software&lt;br /&gt;
** libusb-driver -- much better replacement/emulator of driver for Xilinx USB-JTAG adapter&lt;br /&gt;
** gcc 4.3.2, binutils, glibc -- development of system-less as well as Linux SW for PowerPC, contained in Xilinx Virtex-4 hybrid FPGA&lt;br /&gt;
** Linux 2.6.27-rc4 PowerPC kernel containing Xilinx Virtex support&lt;br /&gt;
&lt;br /&gt;
=== Hardrware ===&lt;br /&gt;
&lt;br /&gt;
* Xilinx Virtex-4 XC4VFX12 hybrid FPGA IC on ML405 evaluation board&lt;br /&gt;
&lt;br /&gt;
== ML403 Xilinx Virtex-4 board ==&lt;br /&gt;
&lt;br /&gt;
=== Toolchain binaries for Debian ===&lt;br /&gt;
&lt;br /&gt;
Invoke next line to add rtime cross-dev into packages sources list&lt;br /&gt;
&lt;br /&gt;
 echo deb ftp://rtime.felk.cvut.cz/debian unstable main &amp;gt;/etc/apt/sources.list.d/rtime-debs.list&lt;br /&gt;
&lt;br /&gt;
Update packages cache (aptitude update)&lt;br /&gt;
Check, that libmpfr1ldbl and libgmp3c2 packages are installed and select next packages&lt;br /&gt;
&lt;br /&gt;
 binutils-powerpc-elf&lt;br /&gt;
 binutils-powerpc-linux-gnu&lt;br /&gt;
 gcc-powerpc-elf&lt;br /&gt;
 gcc-powerpc-linux-gnu&lt;br /&gt;
 glibc-powerpc-linux-gnu&lt;br /&gt;
&lt;br /&gt;
=== Toolchain preparation and kernel build information ===&lt;br /&gt;
&lt;br /&gt;
Debian PowerPC GCC build log&lt;br /&gt;
&lt;br /&gt;
[http://buildd.debian.org/build.php?arch=&amp;amp;pkg=gcc-4.3 Debian GCC-4.3 build logs]&lt;br /&gt;
&lt;br /&gt;
==== Kernel headers install ====&lt;br /&gt;
&lt;br /&gt;
[http://xilinx.wikidot.com/u-boot http://xilinx.wikidot.com/u-boot]&lt;br /&gt;
&lt;br /&gt;
 mkdir src&lt;br /&gt;
 cd src&lt;br /&gt;
 git clone  git://git.xilinx.com/u-boot-xlnx.git&lt;br /&gt;
 git clone  git://git.xilinx.com/gen-mhs-devtree.git&lt;br /&gt;
 git clone --reference /usr/src/linux-devel git://git.xilinx.com/linux-2.6-xlnx.git&lt;br /&gt;
&lt;br /&gt;
 mkdir -p build/ml403/linux&lt;br /&gt;
 cd build/ml403/linux&lt;br /&gt;
&lt;br /&gt;
Copy and adapt GNUmakefile to override ARCH and select kernel source directory&lt;br /&gt;
&lt;br /&gt;
Run&lt;br /&gt;
&lt;br /&gt;
 make headers_install&lt;br /&gt;
&lt;br /&gt;
The header-files for building GCC nd GLIB are prepared in usr/include directory.&lt;br /&gt;
Copy files found there to the directory /usr/powerpc-linux-gnu/sys-include&lt;br /&gt;
&lt;br /&gt;
==== Glibc ====&lt;br /&gt;
&lt;br /&gt;
The required files are glibc-2.7ds1.tar.bz2 glibc-linuxthreads-20071023.tar.bz2 glibc-libidn-2.7.tar.bz2 glibc-ports-2.7.tar.bz2&lt;br /&gt;
&lt;br /&gt;
 mkdir -p src&lt;br /&gt;
 cd src&lt;br /&gt;
 tar -xjf ../glibc-2.7ds1.tar.bz2&lt;br /&gt;
 tar -xjf ../glibc-linuxthreads-20071023.tar.bz2&lt;br /&gt;
 tar -xjf ../glibc-libidn-2.7.tar.bz2&lt;br /&gt;
 ( cd glibc-2.7 ; mv glibc-libidn-2.7 libidn )&lt;br /&gt;
 tar -xjf ../glibc-ports-2.7.tar.bz2&lt;br /&gt;
 ( cd glibc-2.7 ; mv glibc-ports-2.7 ports )&lt;br /&gt;
 ln -s glibc-2.7 glibc&lt;br /&gt;
&lt;br /&gt;
Prepare directory to build PowerPC version of GLIBC&lt;br /&gt;
&lt;br /&gt;
 mkdir -p build/powerpc-linux/glibc&lt;br /&gt;
&lt;br /&gt;
If there is no previous install of GLIBC, use next dummy build to install headers.&lt;br /&gt;
They are required to build GCC later&lt;br /&gt;
&lt;br /&gt;
 libc_cv_ppc_machine=yes \&lt;br /&gt;
 libc_cv_mabi_ibmlongdouble=yes \&lt;br /&gt;
 libc_cv_mlong_double_128=yes \&lt;br /&gt;
 libc_cv_forced_unwind=yes \&lt;br /&gt;
 libc_cv_c_cleanup=yes \&lt;br /&gt;
 CC=gcc \&lt;br /&gt;
 ../../../src/glibc/configure --prefix=/usr \&lt;br /&gt;
        --build=x86_64-linux-gnu \&lt;br /&gt;
        --host=powerpc-linux-gnu \&lt;br /&gt;
        --prefix=/usr \&lt;br /&gt;
        --without-cvs \&lt;br /&gt;
        --enable-add-ons=libidn,nptl \&lt;br /&gt;
        --enable-profile \&lt;br /&gt;
        --without-selinux \&lt;br /&gt;
        --with-headers=/usr/powerpc-linux-gnu/sys-include \&lt;br /&gt;
        --enable-kernel=2.6.26 \&lt;br /&gt;
        --enable-hacker-mode \&lt;br /&gt;
        --without-cvs --disable-sanity-checks&lt;br /&gt;
&lt;br /&gt;
 make DESTDIR=/usr-pkg/glibc-linux-powerpc-2.7-1 \&lt;br /&gt;
       inst_includedir=/usr-pkg/glibc-linux-powerpc-2.7-1/include \&lt;br /&gt;
       install-headers&lt;br /&gt;
&lt;br /&gt;
==== Build binutils ====&lt;br /&gt;
&lt;br /&gt;
 ../../../binutils/configure \&lt;br /&gt;
        --prefix=/usr \&lt;br /&gt;
        --disable-nls \&lt;br /&gt;
        --build=x86_64-linux-gnu \&lt;br /&gt;
        --host=x86_64-linux-gnu \&lt;br /&gt;
        --target=powerpc-linux-gnu \&lt;br /&gt;
        --enable-targets=powerpc64-linux-gnu&lt;br /&gt;
&lt;br /&gt;
 make &amp;amp;&amp;amp; make DESTDIR=/usr-pkg/binutils-powerpc-linux-gnu_2.18-2_amd64 install&lt;br /&gt;
&lt;br /&gt;
==== Build GCC ====&lt;br /&gt;
&lt;br /&gt;
 ../../../gcc-4.3/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-libstdcxx-debug \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-softfloat \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=powerpc-linux,powerpc64-linux \&lt;br /&gt;
         --with-cpu=default32 \&lt;br /&gt;
         --with-long-double-128 \&lt;br /&gt;
         --enable-checking=release \&lt;br /&gt;
         --build=x86_64-linux-gnu \&lt;br /&gt;
         --host=x86_64-linux-gnu \&lt;br /&gt;
         --target=powerpc-linux-gnu \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --disable-libmudflap&lt;br /&gt;
&lt;br /&gt;
==== Finally build GLIBC ====&lt;br /&gt;
&lt;br /&gt;
 ../../../src/glibc/configure \&lt;br /&gt;
        --build=x86_64-linux-gnu \&lt;br /&gt;
        --host=powerpc-linux-gnu \&lt;br /&gt;
        --prefix=/usr \&lt;br /&gt;
        --without-cvs \&lt;br /&gt;
        --enable-add-ons=libidn,nptl \&lt;br /&gt;
        --enable-profile \&lt;br /&gt;
        --without-selinux \&lt;br /&gt;
        --with-headers=/usr/powerpc-linux-gnu/sys-include \&lt;br /&gt;
        --enable-kernel=2.6.20&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 make install_root=/usr-pkg/glibc-2.7-powerpc install&lt;br /&gt;
&lt;br /&gt;
=== U-Boot ===&lt;br /&gt;
&lt;br /&gt;
  make ml405_config&lt;br /&gt;
  make&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Main_Page&amp;diff=3408</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Main_Page&amp;diff=3408"/>
		<updated>2009-01-06T16:41:32Z</updated>

		<summary type="html">&lt;p&gt;Pecam1: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;For Czech students:&#039;&#039;&#039; Tato wiki by měla sloužit ke sdílení informací při vývoji různého HW na [http://dce.felk.cvut.cz/ katedře řídící techniky] FEL ČVUT. Důvod vzniku této wiki je ten, že se asto vyskytuje případ, kdy několik studentu pracuje na stejném a nebo podobném hardwaru a jeden lověk dělá práci, která by se mohla hodit i ostatním. Pokud se to ujme, mohla by tato Wiki sloužit jako místo, kde by se publikovaly výsledky práce jednotlivých lidí tak, aby tato práce mohla být užitená i pro ostatní. Mohly by se zde vyskytovat různé návody, odkazy na aktuální verze softwaru apod.&lt;br /&gt;
&lt;br /&gt;
Konkrétní obsah závisí jen na vás. Pokud pracujete s nějakým hardwarem, [http://rtime.felk.cvut.cz/~sojka/ kontaktujte mě] a já vám zde zřídím úet. Anonymní editace je zakázaná kvůli spamerům.&lt;br /&gt;
&lt;br /&gt;
--[[Wikipedista:Sojka|Sojka]] 20:29, 5. 5. 2005 (CEST)&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Boa5200]]&lt;br /&gt;
* [[ColdFire_DEMO52233 | ColdFire DEMO52233 (Board from Freescale)]] &lt;br /&gt;
* [[MIDAM MPC5200 DB1]] (Mikroklima)&lt;br /&gt;
* [[H8S/2638]]&lt;br /&gt;
* [[HC12 | Motorola HC12]]&lt;br /&gt;
* [[LPC21xx]]&lt;br /&gt;
* [[PiMX1]] i.MX1 processor based board&lt;br /&gt;
* [[Wireless_Sensor_Networks | Wireless Sensor Networks (WSNs)]]&lt;br /&gt;
* [[ML403 | ML403 Xilinx Virtex-4]]&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
&lt;br /&gt;
* [[System-Less Framework]]&lt;br /&gt;
* [http://rtime.felk.cvut.cz/omk/ OMK - Advanced Make-System]&lt;br /&gt;
&lt;br /&gt;
== Source Code Version Control ==&lt;br /&gt;
&lt;br /&gt;
* [[Git]], [[Git repository on this server]]&lt;br /&gt;
* [[Darcs]]&lt;br /&gt;
&lt;br /&gt;
== HW recomendation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware shops ===&lt;br /&gt;
* [http://www.gme.cz GM electronic]&lt;br /&gt;
* [http://www.pselectronic.cz/ PS electronic]&lt;br /&gt;
* [http://www.ges.cz/ GES electronic]&lt;br /&gt;
* [http://www.tme.cz/ TME electronic eshop]&lt;br /&gt;
&lt;br /&gt;
=== Board developers ===&lt;br /&gt;
* [http://www.volny.cz/psk/ PSK] Advanced board developer; Czech only&lt;br /&gt;
* [http://www.volny.cz/plspoj/ Mr. Kohout] Not advanced board developer with short delivery date; Czech only&lt;br /&gt;
* [http://www.pragoboard.cz/czech/index_cz.htm PragoBoard s.r.o.] Advanced board developer; communication is not easy; English allowed&lt;br /&gt;
* [http://www.seapraha.cz/index.php SEA Praha] Unknown board developer&lt;br /&gt;
&lt;br /&gt;
== Wiki documentation ==&lt;br /&gt;
&lt;br /&gt;
Please see [http://meta.wikipedia.org/wiki/MediaWiki_i18n documentation on customizing the interface]&lt;br /&gt;
and the [http://meta.wikipedia.org/wiki/MediaWiki_User&#039;s_Guide User&#039;s Guide] for usage and configuration help.&lt;/div&gt;</summary>
		<author><name>Pecam1</name></author>
	</entry>
</feed>