<?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=Pisa</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=Pisa"/>
	<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php/Special:Contributions/Pisa"/>
	<updated>2026-05-22T15:14:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4239</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4239"/>
		<updated>2016-05-26T20:08:50Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* Running RTEMS Under RPi2 QEMU */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi JTAG debugguing ==&lt;br /&gt;
&lt;br /&gt;
 * RPi JTAG setup documentation http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;br /&gt;
&lt;br /&gt;
U-boot commands to enable JTAG pins&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 mw.l 0x20200000 0x04a020&lt;br /&gt;
 mw.l 0x20200008 0x65b6c0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[FTDI2232_JTAG#PiKRON.27s_JTAG_adapter|FTDI2232 JT_USB5]] RPi Connection and Configuration ===&lt;br /&gt;
&lt;br /&gt;
Interconnection of 10 pin JT_USB5 cable to RPi P1 connector&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! JT_USB5 pin !! Signal !! RPi P1   !! Type   !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  1          || TCK    || 22       || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  2          || VREF   || 1        || Out    || Target voltage reference 3.3 V&lt;br /&gt;
|-&lt;br /&gt;
|  3          || TDI    || 7        || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  4          || RTCK   || 16       || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  5          || TDO    || 18       || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  6          || RST    || NC       ||        || Reset&lt;br /&gt;
|-&lt;br /&gt;
|  7          || nTRST  || 15       || In/Out || Test system reset&lt;br /&gt;
|-&lt;br /&gt;
|  8          || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|-&lt;br /&gt;
|  9          || TMS    || 13       || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  10         || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 &lt;br /&gt;
 interface ftdi&lt;br /&gt;
 &lt;br /&gt;
 #ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
 ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_init 0x0cf8 0x0cfb&lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040&lt;br /&gt;
 ftdi_layout_signal LED -ndata 0x0800&lt;br /&gt;
 &lt;br /&gt;
 transport select jtag&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
    set  _CHIPNAME $CHIPNAME&lt;br /&gt;
 } else {&lt;br /&gt;
    set  _CHIPNAME raspi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CPU_TAPID ] } {&lt;br /&gt;
    set _CPU_TAPID $CPU_TAPID&lt;br /&gt;
 } else {&lt;br /&gt;
    set _CPU_TAPID 0x07b7617F&lt;br /&gt;
 }&lt;br /&gt;
 jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID&lt;br /&gt;
 &lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.arm&lt;br /&gt;
 target create $_TARGETNAME arm11 -chain-position $_TARGETNAME&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 init&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete setup with U-boot TFTP based kernel load can be found at&lt;br /&gt;
&lt;br /&gt;
* https://github.com/ppisa/rpi-utils/tree/master/jtag-debug&lt;br /&gt;
&lt;br /&gt;
=== RTEMS Boot with use of U-boot ===&lt;br /&gt;
&lt;br /&gt;
Setup of RTEMS image boot over TFTP with U-boot and static IP address&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;u-boot.bin&#039;&#039;&#039; to RPi boot partition and setup first stage loader to run U-boot - i.e. modify &#039;&#039;&#039;config.txt&#039;&#039;&#039; select&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kernel=u-boot.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure TFTP server on host system and convert binary to U-boot image format&lt;br /&gt;
( RTEMS tests applications in ELF format can be found after successful compilation in build samples subdirectory, i.e. for ticker arm-rtems4.11/c/raspberrypi/testsuites/samples/ticker/ticker.exe). Convert that to U-boot image.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-rtems4.11-objcopy -R -S --strip-debug -O binary ticker.exe ticker.bin || exit 1&lt;br /&gt;
cat ticker.bin | gzip -9 &amp;gt;ticker.gz&lt;br /&gt;
mkimage -A arm -O rtems -T kernel -a 0x00008000 -e 0x00008000 -n &amp;quot;RTEMS&amp;quot; -d ticker.gz ticker.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;ticker.img&#039;&#039;&#039; to TFTP served directory (I use &amp;lt;tt&amp;gt;/srv/tftp/rpi/rtems&amp;lt;/tt&amp;gt; on Debian).&lt;br /&gt;
&lt;br /&gt;
Setup U-boot environment. One option is to use &#039;&#039;&#039;uEnv.txt&#039;&#039;&#039; file on the RPi SD-card boot partition with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
serverip=192.168.1.10&lt;br /&gt;
ipaddr=192.168.1.33&lt;br /&gt;
bootargs=place_for_kernel_options&lt;br /&gt;
bootcmd=mw.l 0x20200000 0x04a020; mw.l 0x20200008 0x65b6c0; usb start; tftp ${kernel_addr_r} 192.168.1.10:/rpi/rtems/app.img ; bootm ${kernel_addr_r}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sequence specifies default command invoked by &#039;&#039;&#039;boot&#039;&#039;&#039; and automatically during startup.&lt;br /&gt;
The direct memory locations change is there to enable JTAG debugger pins on P1 connector.&lt;br /&gt;
&lt;br /&gt;
=== Running RTEMS Under RPi2 QEMU ===&lt;br /&gt;
&lt;br /&gt;
RTEMS BSP for RPi2 is configured for actual RTEMS 4.12 development sources&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
../../../git/rtems/configure --target=arm-rtems4.12 --prefix=/opt/rtems4.12 \&lt;br /&gt;
  --enable-rtems-inlines --disable-multiprocessing --enable-cxx \&lt;br /&gt;
  --enable-rdbg --enable-maintainer-mode --enable-tests=samples \&lt;br /&gt;
  --enable-networking --enable-posix --disable-itron --disable-ada \&lt;br /&gt;
  --disable-expada --disable-multilib --disable-docs \&lt;br /&gt;
  --enable-rtemsbsp=&amp;quot;raspberrypi2&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
QEMU version 2.6 introduces Raspberry Pi BSP support. But QEMU kernel parameter&lt;br /&gt;
does not load right plain binary kernel image. But it recognizes and loads and starts&lt;br /&gt;
right way U-boot images. The run of RTEMS applications build for RPi2 from&lt;br /&gt;
4.12 development GIT works well. The &amp;quot;kimage&amp;quot; U-boot utility has to be installed&lt;br /&gt;
on system (Debian package u-boot-tools). Then RTEMS ELF application image can be&lt;br /&gt;
prepared and run by QEMU&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXE_NAME=rtems/arm-rtems4.12/c/raspberrypi2/testsuites/samples/ticker/ticker.exe&lt;br /&gt;
START_ADDR=0x00008000&lt;br /&gt;
&lt;br /&gt;
arm-rtems4.12-objcopy -R -S --strip-debug -O binary &amp;quot;$EXE_NAME&amp;quot; &amp;quot;$EXE_NAME.bin&amp;quot; || exit 1&lt;br /&gt;
cat &amp;quot;$EXE_NAME.bin&amp;quot; | gzip -9 &amp;gt;&amp;quot;$EXE_NAME.gz&amp;quot;&lt;br /&gt;
mkimage \&lt;br /&gt;
  -A arm -O rtems -T kernel -a $START_ADDR -e $START_ADDR -n &amp;quot;RTEMS&amp;quot; \&lt;br /&gt;
  -d &amp;quot;$EXE_NAME.gz&amp;quot; &amp;quot;$EXE_NAME.img&amp;quot;&lt;br /&gt;
&lt;br /&gt;
qemu-system-arm -M raspi2 \&lt;br /&gt;
  -serial stdio \&lt;br /&gt;
  -kernel &amp;quot;$EXE_NAME.img&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Debugging RTEMS Under RPi2 QEMU ===&lt;br /&gt;
&lt;br /&gt;
Start QEMU with request to wait for GDB&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
qemu-system-arm \&lt;br /&gt;
  -M raspi2 \&lt;br /&gt;
  -serial stdio \&lt;br /&gt;
  -s -S&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two options enable GDB support and stop QEMU&lt;br /&gt;
after initialization. I redirect serial line I/O&lt;br /&gt;
to console to ease capture and copy pasting.&lt;br /&gt;
&lt;br /&gt;
I have not succeed with RTEMS application load through -kernel&lt;br /&gt;
option nor from SDcard (-sd qemu/rpi2-sd.img). I have tried plain&lt;br /&gt;
binary. But I have no problem to debug RTEMS start by&lt;br /&gt;
GDB which loads ELF application image&lt;br /&gt;
&lt;br /&gt;
I start GDB with application image and qemu-debug-rpi2-app.gdb&lt;br /&gt;
command script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-elf-gdb -x qemu-debig-rpi2-app.gdb rtems/arm-rtems4.12/c/raspberrypi2/testsuites/samples/ticker/ticker.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;qemu-debug-rpi2-app.gdb&amp;quot; script content is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
target remote localhost:1234&lt;br /&gt;
hbreak *0x0&lt;br /&gt;
&lt;br /&gt;
# set breakpoint to the location where application&lt;br /&gt;
# is expected and QEMU jumps after initialization&lt;br /&gt;
hbreak *0x8000&lt;br /&gt;
c&lt;br /&gt;
# continue initialization till breakpoint at 0x8000&lt;br /&gt;
# is reached&lt;br /&gt;
&lt;br /&gt;
# load RTEMS ELF application image&lt;br /&gt;
load&lt;br /&gt;
# set breakpoints to catch fatal exceptions&lt;br /&gt;
hbreak *0x0004&lt;br /&gt;
hbreak *0x0008&lt;br /&gt;
hbreak *0x000C&lt;br /&gt;
hbreak *0x0010&lt;br /&gt;
hbreak *0x001C&lt;br /&gt;
&lt;br /&gt;
set $pc=0x8000&lt;br /&gt;
# set breakpoints of interrest for debugging&lt;br /&gt;
hbreak bsp_start_hook_0&lt;br /&gt;
hbreak bsp_start_hook_1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GDB starts, sets breakpoint at 0x8000 and releases QEMU&lt;br /&gt;
from initial wait for GDB. QEMU/ARM CPU initializes and executes&lt;br /&gt;
till it jumps to 0x8000 and stops on breakpoint.&lt;br /&gt;
This returns control back to GDB. It loads application&lt;br /&gt;
image and sets breakpoints and waits for user.&lt;br /&gt;
You can step through code (si,s,ni,n commands) or let&lt;br /&gt;
it run at &amp;quot;full&amp;quot; emulated speed (c). It stops&lt;br /&gt;
at predefined breakpoints and state can be examined.&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4238</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4238"/>
		<updated>2016-05-26T20:03:01Z</updated>

		<summary type="html">&lt;p&gt;Pisa: RTEMS Rsapberry Pi 2 BSP debugging under QEMU&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi JTAG debugguing ==&lt;br /&gt;
&lt;br /&gt;
 * RPi JTAG setup documentation http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;br /&gt;
&lt;br /&gt;
U-boot commands to enable JTAG pins&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 mw.l 0x20200000 0x04a020&lt;br /&gt;
 mw.l 0x20200008 0x65b6c0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[FTDI2232_JTAG#PiKRON.27s_JTAG_adapter|FTDI2232 JT_USB5]] RPi Connection and Configuration ===&lt;br /&gt;
&lt;br /&gt;
Interconnection of 10 pin JT_USB5 cable to RPi P1 connector&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! JT_USB5 pin !! Signal !! RPi P1   !! Type   !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  1          || TCK    || 22       || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  2          || VREF   || 1        || Out    || Target voltage reference 3.3 V&lt;br /&gt;
|-&lt;br /&gt;
|  3          || TDI    || 7        || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  4          || RTCK   || 16       || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  5          || TDO    || 18       || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  6          || RST    || NC       ||        || Reset&lt;br /&gt;
|-&lt;br /&gt;
|  7          || nTRST  || 15       || In/Out || Test system reset&lt;br /&gt;
|-&lt;br /&gt;
|  8          || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|-&lt;br /&gt;
|  9          || TMS    || 13       || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  10         || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 &lt;br /&gt;
 interface ftdi&lt;br /&gt;
 &lt;br /&gt;
 #ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
 ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_init 0x0cf8 0x0cfb&lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040&lt;br /&gt;
 ftdi_layout_signal LED -ndata 0x0800&lt;br /&gt;
 &lt;br /&gt;
 transport select jtag&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
    set  _CHIPNAME $CHIPNAME&lt;br /&gt;
 } else {&lt;br /&gt;
    set  _CHIPNAME raspi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CPU_TAPID ] } {&lt;br /&gt;
    set _CPU_TAPID $CPU_TAPID&lt;br /&gt;
 } else {&lt;br /&gt;
    set _CPU_TAPID 0x07b7617F&lt;br /&gt;
 }&lt;br /&gt;
 jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID&lt;br /&gt;
 &lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.arm&lt;br /&gt;
 target create $_TARGETNAME arm11 -chain-position $_TARGETNAME&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 init&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete setup with U-boot TFTP based kernel load can be found at&lt;br /&gt;
&lt;br /&gt;
* https://github.com/ppisa/rpi-utils/tree/master/jtag-debug&lt;br /&gt;
&lt;br /&gt;
=== RTEMS Boot with use of U-boot ===&lt;br /&gt;
&lt;br /&gt;
Setup of RTEMS image boot over TFTP with U-boot and static IP address&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;u-boot.bin&#039;&#039;&#039; to RPi boot partition and setup first stage loader to run U-boot - i.e. modify &#039;&#039;&#039;config.txt&#039;&#039;&#039; select&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kernel=u-boot.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure TFTP server on host system and convert binary to U-boot image format&lt;br /&gt;
( RTEMS tests applications in ELF format can be found after successful compilation in build samples subdirectory, i.e. for ticker arm-rtems4.11/c/raspberrypi/testsuites/samples/ticker/ticker.exe). Convert that to U-boot image.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-rtems4.11-objcopy -R -S --strip-debug -O binary ticker.exe ticker.bin || exit 1&lt;br /&gt;
cat ticker.bin | gzip -9 &amp;gt;ticker.gz&lt;br /&gt;
mkimage -A arm -O rtems -T kernel -a 0x00008000 -e 0x00008000 -n &amp;quot;RTEMS&amp;quot; -d ticker.gz ticker.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;ticker.img&#039;&#039;&#039; to TFTP served directory (I use &amp;lt;tt&amp;gt;/srv/tftp/rpi/rtems&amp;lt;/tt&amp;gt; on Debian).&lt;br /&gt;
&lt;br /&gt;
Setup U-boot environment. One option is to use &#039;&#039;&#039;uEnv.txt&#039;&#039;&#039; file on the RPi SD-card boot partition with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
serverip=192.168.1.10&lt;br /&gt;
ipaddr=192.168.1.33&lt;br /&gt;
bootargs=place_for_kernel_options&lt;br /&gt;
bootcmd=mw.l 0x20200000 0x04a020; mw.l 0x20200008 0x65b6c0; usb start; tftp ${kernel_addr_r} 192.168.1.10:/rpi/rtems/app.img ; bootm ${kernel_addr_r}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sequence specifies default command invoked by &#039;&#039;&#039;boot&#039;&#039;&#039; and automatically during startup.&lt;br /&gt;
The direct memory locations change is there to enable JTAG debugger pins on P1 connector.&lt;br /&gt;
&lt;br /&gt;
=== Running RTEMS Under RPi2 QEMU ===&lt;br /&gt;
&lt;br /&gt;
RTEMS BSP for RPi2 is configured for actual RTEMS 4.12 development sources&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
../../../git/rtems/configure --target=arm-rtems4.12 --prefix=/opt/rtems4.12 \&lt;br /&gt;
  --enable-rtems-inlines --disable-multiprocessing --enable-cxx \&lt;br /&gt;
  --enable-rdbg --enable-maintainer-mode --enable-tests=samples \&lt;br /&gt;
  --enable-networking --enable-posix --disable-itron --disable-ada \&lt;br /&gt;
  --disable-expada --disable-multilib --disable-docs \&lt;br /&gt;
  --enable-rtemsbsp=&amp;quot;raspberrypi2&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
QEMU version 2.6 introduces Raspberry Pi BSP support. But QEMU kernel parameter&lt;br /&gt;
does not load right plain binary kernel image. But it recognizes and loads and starts&lt;br /&gt;
right way U-boot images. The run of RTEMS applications build for RPi2 from&lt;br /&gt;
4.12 development GIT works well. The &amp;quot;kimage&amp;quot; U-boot utility has to be installed&lt;br /&gt;
on system (Debian package u-boot-tools). Then RTEMS ELF application image can be&lt;br /&gt;
prepared and run by QEMU&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXE_NAME=rtems/arm-rtems4.12/c/raspberrypi2/testsuites/samples/ticker/ticker.exe&lt;br /&gt;
&lt;br /&gt;
arm-rtems4.12-objcopy -R -S --strip-debug -O binary &amp;quot;$EXE_NAME&amp;quot; &amp;quot;$EXE_NAME.bin&amp;quot; || exit 1&lt;br /&gt;
cat &amp;quot;$EXE_NAME.bin&amp;quot; | gzip -9 &amp;gt;&amp;quot;$EXE_NAME.gz&amp;quot;&lt;br /&gt;
mkimage \&lt;br /&gt;
  -A arm -O rtems -T kernel -a $START_ADDR -e $START_ADDR -n &amp;quot;RTEMS&amp;quot; \&lt;br /&gt;
  -d &amp;quot;$EXE_NAME.gz&amp;quot; &amp;quot;$EXE_NAME.img&amp;quot;&lt;br /&gt;
&lt;br /&gt;
qemu-system-arm -M raspi2 \&lt;br /&gt;
  -serial stdio \&lt;br /&gt;
  -kernel &amp;quot;$EXE_NAME.img&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Debugging RTEMS Under RPi2 QEMU ===&lt;br /&gt;
&lt;br /&gt;
Start QEMU with request to wait for GDB&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
qemu-system-arm \&lt;br /&gt;
  -M raspi2 \&lt;br /&gt;
  -serial stdio \&lt;br /&gt;
  -s -S&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two options enable GDB support and stop QEMU&lt;br /&gt;
after initialization. I redirect serial line I/O&lt;br /&gt;
to console to ease capture and copy pasting.&lt;br /&gt;
&lt;br /&gt;
I have not succeed with RTEMS application load through -kernel&lt;br /&gt;
option nor from SDcard (-sd qemu/rpi2-sd.img). I have tried plain&lt;br /&gt;
binary. But I have no problem to debug RTEMS start by&lt;br /&gt;
GDB which loads ELF application image&lt;br /&gt;
&lt;br /&gt;
I start GDB with application image and qemu-debug-rpi2-app.gdb&lt;br /&gt;
command script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-elf-gdb -x qemu-debig-rpi2-app.gdb rtems/arm-rtems4.12/c/raspberrypi2/testsuites/samples/ticker/ticker.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;qemu-debug-rpi2-app.gdb&amp;quot; script content is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
target remote localhost:1234&lt;br /&gt;
hbreak *0x0&lt;br /&gt;
&lt;br /&gt;
# set breakpoint to the location where application&lt;br /&gt;
# is expected and QEMU jumps after initialization&lt;br /&gt;
hbreak *0x8000&lt;br /&gt;
c&lt;br /&gt;
# continue initialization till breakpoint at 0x8000&lt;br /&gt;
# is reached&lt;br /&gt;
&lt;br /&gt;
# load RTEMS ELF application image&lt;br /&gt;
load&lt;br /&gt;
# set breakpoints to catch fatal exceptions&lt;br /&gt;
hbreak *0x0004&lt;br /&gt;
hbreak *0x0008&lt;br /&gt;
hbreak *0x000C&lt;br /&gt;
hbreak *0x0010&lt;br /&gt;
hbreak *0x001C&lt;br /&gt;
&lt;br /&gt;
set $pc=0x8000&lt;br /&gt;
# set breakpoints of interrest for debugging&lt;br /&gt;
hbreak bsp_start_hook_0&lt;br /&gt;
hbreak bsp_start_hook_1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GDB starts, sets breakpoint at 0x8000 and releases QEMU&lt;br /&gt;
from initial wait for GDB. QEMU/ARM CPU initializes and executes&lt;br /&gt;
till it jumps to 0x8000 and stops on breakpoint.&lt;br /&gt;
This returns control back to GDB. It loads application&lt;br /&gt;
image and sets breakpoints and waits for user.&lt;br /&gt;
You can step through code (si,s,ni,n commands) or let&lt;br /&gt;
it run at &amp;quot;full&amp;quot; emulated speed (c). It stops&lt;br /&gt;
at predefined breakpoints and state can be examined.&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4237</id>
		<title>Zynq</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4237"/>
		<updated>2016-05-24T23:53:42Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git&lt;br /&gt;
&lt;br /&gt;
* Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git&lt;br /&gt;
&lt;br /&gt;
* eLinux Wiki Zynq category http://elinux.org/Category:Zynq&lt;br /&gt;
&lt;br /&gt;
* Toolchain for Debian or Ubuntu&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://debian.pengutronix.de/debian/ sid main contrib non-free&amp;quot; &amp;gt;/etc/apt/sources.list.d/pengutronix.list&lt;br /&gt;
 aptitude update&lt;br /&gt;
 aptitude install oselas.toolchain-2014.12.2-arm-cortexa8-linux-gnueabihf-gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized&lt;br /&gt;
&lt;br /&gt;
Build kernel&lt;br /&gt;
&lt;br /&gt;
 mkdir zynq&lt;br /&gt;
 git clone git://rtime.felk.cvut.cz/zynq/linux-build.git&lt;br /&gt;
 cd linux-build&lt;br /&gt;
 git submodule update --init&lt;br /&gt;
&lt;br /&gt;
Check that toolchain location matches CROSS_COMPILE variable in [http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git/blob/refs/heads/master:/build/xlnx_4.0.8-rt6/linux/GNUmakefile build/xlnx_4.0.8-rt6/linux/GNUmakefile]. Then invoke&lt;br /&gt;
&lt;br /&gt;
 cd build/xlnx_4.0.8-rt6/linux/&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
U-boot arguments for MicroZed board&lt;br /&gt;
&lt;br /&gt;
 bootargs=root=/dev/mmcblk0p2 rw console=ttyPS1,115200 earlyprintk&lt;br /&gt;
&lt;br /&gt;
Install Debian ARMhf distribution to the media on x86 host with use of chroot and qemu&lt;br /&gt;
&lt;br /&gt;
Preparation of FPGA configuration files for direct FPGA configuration by Linux or U-boot requires to prepare &amp;lt;code&amp;gt;system.bif&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 all:&lt;br /&gt;
 {&lt;br /&gt;
 system.bit&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
then &amp;lt;code&amp;gt;bootgen&amp;lt;/code&amp;gt; is used to prepare binary file&lt;br /&gt;
&lt;br /&gt;
 bootgen -image system.bif -w -process_bitstream bin&lt;br /&gt;
&lt;br /&gt;
Runtime FPGA reconfiguration&lt;br /&gt;
&lt;br /&gt;
 cat system.bit.bin &amp;gt; /dev/xdevcfg&lt;br /&gt;
&lt;br /&gt;
=== Debian Linux Install ===&lt;br /&gt;
&lt;br /&gt;
Debootstrap on x86 system&lt;br /&gt;
&lt;br /&gt;
Install&lt;br /&gt;
&lt;br /&gt;
 apt-get install binfmt-support qemu qemu-user-static debootstrap&lt;br /&gt;
&lt;br /&gt;
Create directory for target system&lt;br /&gt;
&lt;br /&gt;
 mkdir debian_armhf&lt;br /&gt;
&lt;br /&gt;
 debootstrap --arch=armhf --foreign --include=debian-keyring,mc,libc6-de,libstdc ++6,busybox,aptitude jessie debian-armhf/ ftp://ftp.cz.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
Install static version of QEMU which is able to interpret target architecture userspace programs  &lt;br /&gt;
&lt;br /&gt;
 cp /usr/bin/qemu-arm-static debian_armhf/usr/bin&lt;br /&gt;
&lt;br /&gt;
Finish the second stage of deboostrap&lt;br /&gt;
&lt;br /&gt;
 LC_ALL=C LANGUAGE=C LANG=C chroot debian_armhf /debootstrap/debootstrap --second-stage&lt;br /&gt;
 LC_ALL=C LANGUAGE=C LANG=C chroot debian_armhf dpkg --configure -a&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4236</id>
		<title>Zynq</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4236"/>
		<updated>2016-05-20T11:07:32Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git&lt;br /&gt;
&lt;br /&gt;
* Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git&lt;br /&gt;
&lt;br /&gt;
* eLinux Wiki Zynq category http://elinux.org/Category:Zynq&lt;br /&gt;
&lt;br /&gt;
* Toolchain for Debian or Ubuntu&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://debian.pengutronix.de/debian/ sid main contrib non-free&amp;quot; &amp;gt;/etc/apt/sources.list.d/pengutronix.list&lt;br /&gt;
 aptitude update&lt;br /&gt;
 aptitude install oselas.toolchain-2014.12.2-arm-cortexa8-linux-gnueabihf-gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized&lt;br /&gt;
&lt;br /&gt;
Build kernel&lt;br /&gt;
&lt;br /&gt;
 mkdir zynq&lt;br /&gt;
 git clone git://rtime.felk.cvut.cz/zynq/linux-build.git&lt;br /&gt;
 cd linux-build&lt;br /&gt;
 git submodule update --init&lt;br /&gt;
&lt;br /&gt;
Check that toolchain location matches CROSS_COMPILE variable in [http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git/blob/refs/heads/master:/build/xlnx_4.0.8-rt6/linux/GNUmakefile build/xlnx_4.0.8-rt6/linux/GNUmakefile]. Then invoke&lt;br /&gt;
&lt;br /&gt;
 cd build/xlnx_4.0.8-rt6/linux/&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
U-boot arguments for MicroZed board&lt;br /&gt;
&lt;br /&gt;
 bootargs=root=/dev/mmcblk0p2 rw console=ttyPS1,115200 earlyprintk&lt;br /&gt;
&lt;br /&gt;
Install Debian ARMhf distribution to the media on x86 host with use of chroot and qemu&lt;br /&gt;
&lt;br /&gt;
Preparation of FPGA configuration files for direct FPGA configuration by Linux or U-boot requires to prepare &amp;lt;code&amp;gt;system.bif&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 all:&lt;br /&gt;
 {&lt;br /&gt;
 system.bit&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
then &amp;lt;code&amp;gt;bootgen&amp;lt;/code&amp;gt; is used to prepare binary file&lt;br /&gt;
&lt;br /&gt;
 bootgen -image system.bif -w -process_bitstream bin&lt;br /&gt;
&lt;br /&gt;
Runtime FPGA reconfiguration&lt;br /&gt;
&lt;br /&gt;
 cat system.bit.bin &amp;gt; /dev/xdevcfg&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4235</id>
		<title>Zynq</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4235"/>
		<updated>2016-05-20T11:04:01Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git&lt;br /&gt;
&lt;br /&gt;
* Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git&lt;br /&gt;
&lt;br /&gt;
* eLinux Wiki Zynq category http://elinux.org/Category:Zynq&lt;br /&gt;
&lt;br /&gt;
* Toolchain for Debian or Ubuntu&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://debian.pengutronix.de/debian/ sid main contrib non-free&amp;quot; &amp;gt;/etc/apt/sources.list.d/pengutronix.list&lt;br /&gt;
 aptitude update&lt;br /&gt;
 aptitude install oselas.toolchain-2014.12.2-arm-cortexa8-linux-gnueabihf-gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized&lt;br /&gt;
&lt;br /&gt;
Build kernel&lt;br /&gt;
&lt;br /&gt;
 mkdir zynq&lt;br /&gt;
 git clone git://rtime.felk.cvut.cz/zynq/linux-build.git&lt;br /&gt;
 cd linux-build&lt;br /&gt;
 git submodule update --init&lt;br /&gt;
&lt;br /&gt;
Check that toolchain location matches CROSS_COMPILE variable in [http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git/blob/refs/heads/master:/build/xlnx_4.0.8-rt6/linux/GNUmakefile build/xlnx_4.0.8-rt6/linux/GNUmakefile]. Then invoke&lt;br /&gt;
&lt;br /&gt;
 cd build/xlnx_4.0.8-rt6/linux/&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
U-boot arguments for MicroZed board&lt;br /&gt;
&lt;br /&gt;
 bootargs=root=/dev/mmcblk0p2 rw console=ttyPS1,115200 earlyprintk&lt;br /&gt;
&lt;br /&gt;
Install Debian ARMhf distribution to the media on x86 host with use of chroot and qemu&lt;br /&gt;
&lt;br /&gt;
Preparation of FPGA configuration files&lt;br /&gt;
&lt;br /&gt;
 bootgen -image system.bif -w -process_bitstream bin&lt;br /&gt;
&lt;br /&gt;
Runtime FPGA reconfiguration&lt;br /&gt;
&lt;br /&gt;
 cat system.bit.bin &amp;gt; /dev/xdevcfg&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4234</id>
		<title>Zynq</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4234"/>
		<updated>2016-05-07T21:34:48Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git&lt;br /&gt;
&lt;br /&gt;
* Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git&lt;br /&gt;
&lt;br /&gt;
* eLinux Wiki Zynq category http://elinux.org/Category:Zynq&lt;br /&gt;
&lt;br /&gt;
* Toolchain for Debian or Ubuntu&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://debian.pengutronix.de/debian/ sid main contrib non-free&amp;quot; &amp;gt;/etc/apt/sources.list.d/pengutronix.list&lt;br /&gt;
 aptitude update&lt;br /&gt;
 aptitude install oselas.toolchain-2014.12.2-arm-cortexa8-linux-gnueabihf-gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized&lt;br /&gt;
&lt;br /&gt;
Build kernel&lt;br /&gt;
&lt;br /&gt;
 mkdir zynq&lt;br /&gt;
 git clone git://rtime.felk.cvut.cz/zynq/linux-build.git&lt;br /&gt;
 cd linux-build&lt;br /&gt;
 git submodule update --init&lt;br /&gt;
&lt;br /&gt;
Check that toolchain location matches CROSS_COMPILE variable in [http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git/blob/refs/heads/master:/build/xlnx_4.0.8-rt6/linux/GNUmakefile build/xlnx_4.0.8-rt6/linux/GNUmakefile]. Then invoke&lt;br /&gt;
&lt;br /&gt;
 cd build/xlnx_4.0.8-rt6/linux/&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
U-boot arguments for MicroZed board&lt;br /&gt;
&lt;br /&gt;
 bootargs=root=/dev/mmcblk0p2 rw console=ttyPS1,115200 earlyprintk&lt;br /&gt;
&lt;br /&gt;
Install Debian ARMhf distribution to the media on x86 host with use of chroot and qemu&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4233</id>
		<title>Zynq</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4233"/>
		<updated>2016-05-07T21:33:26Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git&lt;br /&gt;
&lt;br /&gt;
* Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git&lt;br /&gt;
&lt;br /&gt;
* eLinux Wiki Zynq category http://elinux.org/Category:Zynq&lt;br /&gt;
&lt;br /&gt;
* Toolchain for Debian or Ubuntu&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://debian.pengutronix.de/debian/ sid main contrib non-free&amp;quot; &amp;gt;/etc/apt/sources.list.d/pengutronix.list&lt;br /&gt;
 aptitude update&lt;br /&gt;
 aptitude install oselas.toolchain-2014.12.2-arm-cortexa8-linux-gnueabihf-gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized&lt;br /&gt;
&lt;br /&gt;
Build kernel&lt;br /&gt;
&lt;br /&gt;
 mkdir zynq&lt;br /&gt;
 git clone git://rtime.felk.cvut.cz/zynq/linux-build.git&lt;br /&gt;
 cd linux-build&lt;br /&gt;
 git submodule update --init&lt;br /&gt;
&lt;br /&gt;
Check that toolchain location matches CROSS_COMPILE variable in [http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git/blob/refs/heads/master:/build/xlnx_4.0.8-rt6/linux/GNUmakefile build/xlnx_4.0.8-rt6/linux/GNUmakefile]. Then invoke&lt;br /&gt;
&lt;br /&gt;
 cd build/xlnx_4.0.8-rt6/linux/&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
U-boot arguments for MicroZed board&lt;br /&gt;
&lt;br /&gt;
 bootargs=root=/dev/mmcblk0p2 rw console=ttyPS1,115200 earlyprintk&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=A0B36APO_Virtual_Hardware&amp;diff=4232</id>
		<title>A0B36APO Virtual Hardware</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=A0B36APO_Virtual_Hardware&amp;diff=4232"/>
		<updated>2016-05-02T00:27:58Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Update links to APO subject pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:apo_bazmek.jpg|thumb|right|Simple terminal used by students]]&lt;br /&gt;
&lt;br /&gt;
[https://cw.fel.cvut.cz/wiki/courses/a0b36apo/start A0B36APO] (Architektury pocitacu -- Computer architectures) is a course taught by [http://cs.felk.cvut.cz/webis/courses.html Department of Computer Science and Engineering] and [http://dce.fel.cvut.cz/ Department of Control Engineering].&lt;br /&gt;
&lt;br /&gt;
Students [https://cw.fel.cvut.cz/wiki/courses/a0b36apo/tutorials/10/start have to work with specialized hardware]. This page describes how to use the virtual implementation of the specialized hardware -- this can help students to work at home without the access to the real hardware.&lt;br /&gt;
&lt;br /&gt;
=== Qemu ===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Qemu Qemu] is a processor emulator which enables to run separate Operating System on Virtual Hardware.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== APOHW ==&lt;br /&gt;
APOHW comprises PCIe I/O card and Simple terminal (keyboard + text LCD).&lt;br /&gt;
&lt;br /&gt;
[[File:apo_diagr.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using APOHW =&lt;br /&gt;
How to obtain the source code:&lt;br /&gt;
  git clone git://github.com/CTU-IIG/qemu.git -b apohw&lt;br /&gt;
&lt;br /&gt;
How to compile it:&lt;br /&gt;
  ./configure --enable-system --target-list=i386-softmmu --enable-sdl --enable-kvm&lt;br /&gt;
&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;To compile Qemu on bare Ubuntu 12.04, you will need to install zlib1g-dev, libglib2.0-dev, libsdl1.2-dev&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
How to run it:&lt;br /&gt;
  ./i386-softmmu/qemu-system-i386 -device apohw \&lt;br /&gt;
     -hda ../../debian_lenny_i386_standard.qcow2 \&lt;br /&gt;
     --boot c \&lt;br /&gt;
     -enable-kvm&lt;br /&gt;
&lt;br /&gt;
You need to have some [http://blog.aurel32.net/46 image file with GNU/Linux installed  on it]. KVM command is optional.&lt;br /&gt;
&lt;br /&gt;
In another terminal then run:&lt;br /&gt;
  telnet localhost 55555&lt;br /&gt;
... and perceive the miracle&lt;br /&gt;
&lt;br /&gt;
= What is not implemented =&lt;br /&gt;
* Proper timing features of the hardware&lt;br /&gt;
* I/O card is PCI, not PCIe -- however memory access is the same.&lt;br /&gt;
* HD44780 does not support 4bit access&lt;br /&gt;
* HD44780 does not support display shifting&lt;br /&gt;
* HD44780 does not support editable CGRAM&lt;br /&gt;
* Buzzer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Bugs ===&lt;br /&gt;
Bug reports please send to lisovy@gmail.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Useful links ===&lt;br /&gt;
[http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html HD44780 DDRAM explained]&lt;br /&gt;
&lt;br /&gt;
[https://lwn.net/images/pdf/LDD3/ch12.pdf PCI drivers on Linux]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4231</id>
		<title>Zynq</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4231"/>
		<updated>2016-04-29T13:20:02Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git&lt;br /&gt;
&lt;br /&gt;
* Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git&lt;br /&gt;
&lt;br /&gt;
* eLinux Wiki Zynq category http://elinux.org/Category:Zynq&lt;br /&gt;
&lt;br /&gt;
* Toolchain for Debian or Ubuntu&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://debian.pengutronix.de/debian/ sid main contrib non-free&amp;quot; &amp;gt;/etc/apt/sources.list.d/pengutronix.list&lt;br /&gt;
 aptitude update&lt;br /&gt;
 aptitude install oselas.toolchain-2014.12.2-arm-cortexa8-linux-gnueabihf-gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized&lt;br /&gt;
&lt;br /&gt;
Build kernel&lt;br /&gt;
&lt;br /&gt;
 mkdir zynq&lt;br /&gt;
 git clone git://rtime.felk.cvut.cz/zynq/linux-build.git&lt;br /&gt;
 cd linux-build&lt;br /&gt;
 git submodule update --init&lt;br /&gt;
&lt;br /&gt;
Check that toolchain location matches CROSS_COMPILE variable in [http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git/blob/refs/heads/master:/build/xlnx_4.0.8-rt6/linux/GNUmakefile build/xlnx_4.0.8-rt6/linux/GNUmakefile]. Then invoke&lt;br /&gt;
&lt;br /&gt;
 cd build/xlnx_4.0.8-rt6/linux/&lt;br /&gt;
 make&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4230</id>
		<title>Zynq</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Zynq&amp;diff=4230"/>
		<updated>2016-04-25T17:01:50Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Created page with &amp;quot; * Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git  * Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* Linux kenrel for Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux.git&lt;br /&gt;
&lt;br /&gt;
* Configs, Makefiles etc. for Linux on Xilinx Zynq http://rtime.felk.cvut.cz/gitweb/zynq/linux-build.git&lt;br /&gt;
&lt;br /&gt;
* eLinux Wiki Zynq category http://elinux.org/Category:Zynq&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Template:Main_Page/Hardware&amp;diff=4229</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=4229"/>
		<updated>2016-04-25T16:56:40Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[A0B36APO Virtual Hardware]]&lt;br /&gt;
* [[Alpha PWS500a]]&lt;br /&gt;
* [[AT91SAM7X256]]&lt;br /&gt;
* [[Boa5200]]&lt;br /&gt;
* [[ColdFire_DEMO52233 | ColdFire DEMO52233 (Board from Freescale)]] &lt;br /&gt;
* [[ColdFire_MCF548x | ColdFire MCF548x (resources and experiments)]] &lt;br /&gt;
* [[Dell XPS12]]&lt;br /&gt;
* [[FPGA]]&lt;br /&gt;
* [[FTDI2232 JTAG]]&lt;br /&gt;
* [[H8S/2638]]&lt;br /&gt;
* [[HC12 | Motorola HC12]]&lt;br /&gt;
* [[Humusoft MF6xx]]&lt;br /&gt;
* [[LX CPU1]]&lt;br /&gt;
* [[LPC21xx]]&lt;br /&gt;
* [[MIDAM MPC5200 DB1]] (Mikroklima)&lt;br /&gt;
* [[ML403 | ML403 Xilinx Virtex-4]]&lt;br /&gt;
* [[MSP430F5529 Launchpad]]&lt;br /&gt;
* [[NetFPGA]]&lt;br /&gt;
* [[OJ10 - welding robot]]&lt;br /&gt;
* [[PiMX1]] i.MX1 processor based board&lt;br /&gt;
* [[Raspberry Pi]] (RPi, BCM2835)&lt;br /&gt;
* [[STM32 VLDISCOVERY]]&lt;br /&gt;
* [[TC1798|TC1798 - Infineon AUDO MAX]]&lt;br /&gt;
* [[TMS570LS3137]]&lt;br /&gt;
* [[USB2CAN 8devices]]&lt;br /&gt;
* [[Wireless_Sensor_Networks | Wireless Sensor Networks (WSNs)]]&lt;br /&gt;
* [[XC2S100-kit|Xilinx Spartan II XC2S100 Demo Board]]&lt;br /&gt;
* [[XC2V1000-kit|Xilinx Virtex II XC2V1000 Demo Board]]&lt;br /&gt;
* [[Zynq|Xilinx Zynq-7000]]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4219</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4219"/>
		<updated>2015-07-20T15:59:53Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver) base = &amp;lt;tt&amp;gt;0xfff7e500&amp;lt;/tt&amp;gt;&lt;br /&gt;
* On RPP board SCILIN is is used for terminal connection base = &amp;lt;tt&amp;gt;0xfff7e400&amp;lt;/tt&amp;gt;&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in addition, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
Consult [[FTDI2232_JTAG]] page for generic OpenOCD setup for ARM targets debugging.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/ http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/ openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/ http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
&lt;br /&gt;
Program application starting at zero address&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00040000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
Program binary image starting at 256kB boundary and maximal length 1MB&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the area after the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00040000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.bin 0x00040000&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* https://devel.rtems.org/wiki/TBR/BSP/Tms570&lt;br /&gt;
* https://devel.rtems.org/wiki/GSoC/2014/PortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4218</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4218"/>
		<updated>2015-07-20T14:48:41Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* FTDI2232 JT_USB5 RPi Connection and Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi JTAG debugguing ==&lt;br /&gt;
&lt;br /&gt;
 * RPi JTAG setup documentation http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;br /&gt;
&lt;br /&gt;
U-boot commands to enable JTAG pins&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 mw.l 0x20200000 0x04a020&lt;br /&gt;
 mw.l 0x20200008 0x65b6c0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[FTDI2232_JTAG#PiKRON.27s_JTAG_adapter|FTDI2232 JT_USB5]] RPi Connection and Configuration ===&lt;br /&gt;
&lt;br /&gt;
Interconnection of 10 pin JT_USB5 cable to RPi P1 connector&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! JT_USB5 pin !! Signal !! RPi P1   !! Type   !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  1          || TCK    || 22       || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  2          || VREF   || 1        || Out    || Target voltage reference 3.3 V&lt;br /&gt;
|-&lt;br /&gt;
|  3          || TDI    || 7        || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  4          || RTCK   || 16       || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  5          || TDO    || 18       || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  6          || RST    || NC       ||        || Reset&lt;br /&gt;
|-&lt;br /&gt;
|  7          || nTRST  || 15       || In/Out || Test system reset&lt;br /&gt;
|-&lt;br /&gt;
|  8          || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|-&lt;br /&gt;
|  9          || TMS    || 13       || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  10         || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 &lt;br /&gt;
 interface ftdi&lt;br /&gt;
 &lt;br /&gt;
 #ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
 ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_init 0x0cf8 0x0cfb&lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040&lt;br /&gt;
 ftdi_layout_signal LED -ndata 0x0800&lt;br /&gt;
 &lt;br /&gt;
 transport select jtag&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
    set  _CHIPNAME $CHIPNAME&lt;br /&gt;
 } else {&lt;br /&gt;
    set  _CHIPNAME raspi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CPU_TAPID ] } {&lt;br /&gt;
    set _CPU_TAPID $CPU_TAPID&lt;br /&gt;
 } else {&lt;br /&gt;
    set _CPU_TAPID 0x07b7617F&lt;br /&gt;
 }&lt;br /&gt;
 jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID&lt;br /&gt;
 &lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.arm&lt;br /&gt;
 target create $_TARGETNAME arm11 -chain-position $_TARGETNAME&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 init&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete setup with U-boot TFTP based kernel load can be found at&lt;br /&gt;
&lt;br /&gt;
* https://github.com/ppisa/rpi-utils/tree/master/jtag-debug&lt;br /&gt;
&lt;br /&gt;
=== RTEMS Boot with use of U-boot ===&lt;br /&gt;
&lt;br /&gt;
Setup of RTEMS image boot over TFTP with U-boot and static IP address&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;u-boot.bin&#039;&#039;&#039; to RPi boot partition and setup first stage loader to run U-boot - i.e. modify &#039;&#039;&#039;config.txt&#039;&#039;&#039; select&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kernel=u-boot.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure TFTP server on host system and convert binary to U-boot image format&lt;br /&gt;
( RTEMS tests applications in ELF format can be found after successful compilation in build samples subdirectory, i.e. for ticker arm-rtems4.11/c/raspberrypi/testsuites/samples/ticker/ticker.exe). Convert that to U-boot image.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-rtems4.11-objcopy -R -S --strip-debug -O binary ticker.exe ticker.bin || exit 1&lt;br /&gt;
cat ticker.bin | gzip -9 &amp;gt;ticker.gz&lt;br /&gt;
mkimage -A arm -O rtems -T kernel -a 0x00008000 -e 0x00008000 -n &amp;quot;RTEMS&amp;quot; -d ticker.gz ticker.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;ticker.img&#039;&#039;&#039; to TFTP served directory (I use &amp;lt;tt&amp;gt;/srv/tftp/rpi/rtems&amp;lt;/tt&amp;gt; on Debian).&lt;br /&gt;
&lt;br /&gt;
Setup U-boot environment. One option is to use &#039;&#039;&#039;uEnv.txt&#039;&#039;&#039; file on the RPi SD-card boot partition with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
serverip=192.168.1.10&lt;br /&gt;
ipaddr=192.168.1.33&lt;br /&gt;
bootargs=place_for_kernel_options&lt;br /&gt;
bootcmd=mw.l 0x20200000 0x04a020; mw.l 0x20200008 0x65b6c0; usb start; tftp ${kernel_addr_r} 192.168.1.10:/rpi/rtems/app.img ; bootm ${kernel_addr_r}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sequence specifies default command invoked by &#039;&#039;&#039;boot&#039;&#039;&#039; and automatically during startup.&lt;br /&gt;
The direct memory locations change is there to enable JTAG debugger pins on P1 connector.&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4217</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4217"/>
		<updated>2015-07-20T14:48:06Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Raspberry Pi TFTP based kernel load with JTAG enabled&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi JTAG debugguing ==&lt;br /&gt;
&lt;br /&gt;
 * RPi JTAG setup documentation http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;br /&gt;
&lt;br /&gt;
U-boot commands to enable JTAG pins&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 mw.l 0x20200000 0x04a020&lt;br /&gt;
 mw.l 0x20200008 0x65b6c0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[FTDI2232_JTAG#PiKRON.27s_JTAG_adapter|FTDI2232 JT_USB5]] RPi Connection and Configuration ===&lt;br /&gt;
&lt;br /&gt;
Interconnection of 10 pin JT_USB5 cable to RPi P1 connector&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! JT_USB5 pin !! Signal !! RPi P1   !! Type   !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  1          || TCK    || 22       || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  2          || VREF   || 1        || Out    || Target voltage reference 3.3 V&lt;br /&gt;
|-&lt;br /&gt;
|  3          || TDI    || 7        || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  4          || RTCK   || 16       || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  5          || TDO    || 18       || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  6          || RST    || NC       ||        || Reset&lt;br /&gt;
|-&lt;br /&gt;
|  7          || nTRST  || 15       || In/Out || Test system reset&lt;br /&gt;
|-&lt;br /&gt;
|  8          || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|-&lt;br /&gt;
|  9          || TMS    || 13       || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  10         || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 &lt;br /&gt;
 interface ftdi&lt;br /&gt;
 &lt;br /&gt;
 #ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
 ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_init 0x0cf8 0x0cfb&lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040&lt;br /&gt;
 ftdi_layout_signal LED -ndata 0x0800&lt;br /&gt;
 &lt;br /&gt;
 transport select jtag&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
    set  _CHIPNAME $CHIPNAME&lt;br /&gt;
 } else {&lt;br /&gt;
    set  _CHIPNAME raspi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CPU_TAPID ] } {&lt;br /&gt;
    set _CPU_TAPID $CPU_TAPID&lt;br /&gt;
 } else {&lt;br /&gt;
    set _CPU_TAPID 0x07b7617F&lt;br /&gt;
 }&lt;br /&gt;
 jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID&lt;br /&gt;
 &lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.arm&lt;br /&gt;
 target create $_TARGETNAME arm11 -chain-position $_TARGETNAME&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 init&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete setup with U-boot TFTP based kernel load can be found at&lt;br /&gt;
&lt;br /&gt;
 * https://github.com/ppisa/rpi-utils/tree/master/jtag-debug&lt;br /&gt;
&lt;br /&gt;
=== RTEMS Boot with use of U-boot ===&lt;br /&gt;
&lt;br /&gt;
Setup of RTEMS image boot over TFTP with U-boot and static IP address&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;u-boot.bin&#039;&#039;&#039; to RPi boot partition and setup first stage loader to run U-boot - i.e. modify &#039;&#039;&#039;config.txt&#039;&#039;&#039; select&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kernel=u-boot.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure TFTP server on host system and convert binary to U-boot image format&lt;br /&gt;
( RTEMS tests applications in ELF format can be found after successful compilation in build samples subdirectory, i.e. for ticker arm-rtems4.11/c/raspberrypi/testsuites/samples/ticker/ticker.exe). Convert that to U-boot image.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-rtems4.11-objcopy -R -S --strip-debug -O binary ticker.exe ticker.bin || exit 1&lt;br /&gt;
cat ticker.bin | gzip -9 &amp;gt;ticker.gz&lt;br /&gt;
mkimage -A arm -O rtems -T kernel -a 0x00008000 -e 0x00008000 -n &amp;quot;RTEMS&amp;quot; -d ticker.gz ticker.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;ticker.img&#039;&#039;&#039; to TFTP served directory (I use &amp;lt;tt&amp;gt;/srv/tftp/rpi/rtems&amp;lt;/tt&amp;gt; on Debian).&lt;br /&gt;
&lt;br /&gt;
Setup U-boot environment. One option is to use &#039;&#039;&#039;uEnv.txt&#039;&#039;&#039; file on the RPi SD-card boot partition with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
serverip=192.168.1.10&lt;br /&gt;
ipaddr=192.168.1.33&lt;br /&gt;
bootargs=place_for_kernel_options&lt;br /&gt;
bootcmd=mw.l 0x20200000 0x04a020; mw.l 0x20200008 0x65b6c0; usb start; tftp ${kernel_addr_r} 192.168.1.10:/rpi/rtems/app.img ; bootm ${kernel_addr_r}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sequence specifies default command invoked by &#039;&#039;&#039;boot&#039;&#039;&#039; and automatically during startup.&lt;br /&gt;
The direct memory locations change is there to enable JTAG debugger pins on P1 connector.&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4216</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4216"/>
		<updated>2015-07-20T14:16:22Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* SCI port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver) base = &amp;lt;tt&amp;gt;0xfff7e500&amp;lt;/tt&amp;gt;&lt;br /&gt;
* On RPP board SCILIN is is used for terminal connection base = &amp;lt;tt&amp;gt;0xfff7e400&amp;lt;/tt&amp;gt;&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in addition, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
Consult [[FTDI2232_JTAG]] page for generic OpenOCD setup for ARM targets debugging.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/ http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/ openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/ http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
&lt;br /&gt;
Program application starting at zero address&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00040000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
Program binary image starting at 256kB boundary and maximal length 1MB&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the area after the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00040000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.bin 0x00040000&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4215</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4215"/>
		<updated>2015-07-20T14:15:34Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Remark about TMS570 SCI use on RPP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver) base = &amp;lt;tt&amp;gt;0xfff7e400&amp;lt;/tt&amp;gt;&lt;br /&gt;
* On RPP board SCILIN is is used for terminal connection base = &amp;lt;tt&amp;gt;0xfff7e500&amp;lt;/tt&amp;gt;&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in addition, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
Consult [[FTDI2232_JTAG]] page for generic OpenOCD setup for ARM targets debugging.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/ http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/ openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/ http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
&lt;br /&gt;
Program application starting at zero address&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00040000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
Program binary image starting at 256kB boundary and maximal length 1MB&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the area after the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00040000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.bin 0x00040000&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4214</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4214"/>
		<updated>2015-07-20T13:41:35Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Description of U-boot load of RTEMS application image.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi JTAG debugguing ==&lt;br /&gt;
&lt;br /&gt;
 * RPi JTAG setup documentation http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;br /&gt;
&lt;br /&gt;
U-boot commands to enable JTAG pins&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 mw.l 0x20200000 0x04a020&lt;br /&gt;
 mw.l 0x20200008 0x65b6c0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[FTDI2232_JTAG#PiKRON.27s_JTAG_adapter|FTDI2232 JT_USB5]] RPi Connection and Configuration ===&lt;br /&gt;
&lt;br /&gt;
Interconnection of 10 pin JT_USB5 cable to RPi P1 connector&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! JT_USB5 pin !! Signal !! RPi P1   !! Type   !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  1          || TCK    || 22       || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  2          || VREF   || 1        || Out    || Target voltage reference 3.3 V&lt;br /&gt;
|-&lt;br /&gt;
|  3          || TDI    || 7        || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  4          || RTCK   || 16       || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  5          || TDO    || 18       || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  6          || RST    || NC       ||        || Reset&lt;br /&gt;
|-&lt;br /&gt;
|  7          || nTRST  || 15       || In/Out || Test system reset&lt;br /&gt;
|-&lt;br /&gt;
|  8          || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|-&lt;br /&gt;
|  9          || TMS    || 13       || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  10         || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 &lt;br /&gt;
 interface ftdi&lt;br /&gt;
 &lt;br /&gt;
 #ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
 ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_init 0x0cf8 0x0cfb&lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040&lt;br /&gt;
 ftdi_layout_signal LED -ndata 0x0800&lt;br /&gt;
 &lt;br /&gt;
 transport select jtag&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
    set  _CHIPNAME $CHIPNAME&lt;br /&gt;
 } else {&lt;br /&gt;
    set  _CHIPNAME raspi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CPU_TAPID ] } {&lt;br /&gt;
    set _CPU_TAPID $CPU_TAPID&lt;br /&gt;
 } else {&lt;br /&gt;
    set _CPU_TAPID 0x07b7617F&lt;br /&gt;
 }&lt;br /&gt;
 jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID&lt;br /&gt;
 &lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.arm&lt;br /&gt;
 target create $_TARGETNAME arm11 -chain-position $_TARGETNAME&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 init&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== RTEMS Boot with use of U-boot ===&lt;br /&gt;
&lt;br /&gt;
Setup of RTEMS image boot over TFTP with U-boot and static IP address&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;u-boot.bin&#039;&#039;&#039; to RPi boot partition and setup first stage loader to run U-boot - i.e. modify &#039;&#039;&#039;config.txt&#039;&#039;&#039; select&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kernel=u-boot.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure TFTP server on host system and convert binary to U-boot image format&lt;br /&gt;
( RTEMS tests applications in ELF format can be found after successful compilation in build samples subdirectory, i.e. for ticker arm-rtems4.11/c/raspberrypi/testsuites/samples/ticker/ticker.exe). Convert that to U-boot image.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-rtems4.11-objcopy -R -S --strip-debug -O binary ticker.exe ticker.bin || exit 1&lt;br /&gt;
cat ticker.bin | gzip -9 &amp;gt;ticker.gz&lt;br /&gt;
mkimage -A arm -O rtems -T kernel -a 0x00008000 -e 0x00008000 -n &amp;quot;RTEMS&amp;quot; -d ticker.gz ticker.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy &#039;&#039;&#039;ticker.img&#039;&#039;&#039; to TFTP served directory (I use &amp;lt;tt&amp;gt;/srv/tftp/rpi/rtems&amp;lt;/tt&amp;gt; on Debian).&lt;br /&gt;
&lt;br /&gt;
Setup U-boot environment. One option is to use &#039;&#039;&#039;uEnv.txt&#039;&#039;&#039; file on the RPi SD-card boot partition with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
serverip=192.168.1.10&lt;br /&gt;
ipaddr=192.168.1.33&lt;br /&gt;
bootargs=place_for_kernel_options&lt;br /&gt;
bootcmd=mw.l 0x20200000 0x04a020; mw.l 0x20200008 0x65b6c0; usb start; tftp ${kernel_addr_r} 192.168.1.10:/rpi/rtems/app.img ; bootm ${kernel_addr_r}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sequence specifies default command invoked by &#039;&#039;&#039;boot&#039;&#039;&#039; and automatically during startup.&lt;br /&gt;
The direct memory locations change is there to enable JTAG debugger pins on P1 connector.&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4213</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4213"/>
		<updated>2015-07-19T20:56:13Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* = FTDI2232 JT_USB5 RPi Connection and Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi JTAG debugguing ==&lt;br /&gt;
&lt;br /&gt;
 * RPi JTAG setup documentation http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;br /&gt;
&lt;br /&gt;
U-boot commands to enable JTAG pins&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 mw.l 0x20200000 0x04a020&lt;br /&gt;
 mw.l 0x20200008 0x65b6c0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[FTDI2232_JTAG#PiKRON.27s_JTAG_adapter|FTDI2232 JT_USB5]] RPi Connection and Configuration ===&lt;br /&gt;
&lt;br /&gt;
Interconnection of 10 pin JT_USB5 cable to RPi P1 connector&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! JT_USB5 pin !! Signal !! RPi P1   !! Type   !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  1          || TCK    || 22       || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  2          || VREF   || 1        || Out    || Target voltage reference 3.3 V&lt;br /&gt;
|-&lt;br /&gt;
|  3          || TDI    || 7        || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  4          || RTCK   || 16       || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  5          || TDO    || 18       || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  6          || RST    || NC       ||        || Reset&lt;br /&gt;
|-&lt;br /&gt;
|  7          || nTRST  || 15       || In/Out || Test system reset&lt;br /&gt;
|-&lt;br /&gt;
|  8          || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|-&lt;br /&gt;
|  9          || TMS    || 13       || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  10         || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 &lt;br /&gt;
 interface ftdi&lt;br /&gt;
 &lt;br /&gt;
 #ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
 ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_init 0x0cf8 0x0cfb&lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040&lt;br /&gt;
 ftdi_layout_signal LED -ndata 0x0800&lt;br /&gt;
 &lt;br /&gt;
 transport select jtag&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
    set  _CHIPNAME $CHIPNAME&lt;br /&gt;
 } else {&lt;br /&gt;
    set  _CHIPNAME raspi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CPU_TAPID ] } {&lt;br /&gt;
    set _CPU_TAPID $CPU_TAPID&lt;br /&gt;
 } else {&lt;br /&gt;
    set _CPU_TAPID 0x07b7617F&lt;br /&gt;
 }&lt;br /&gt;
 jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID&lt;br /&gt;
 &lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.arm&lt;br /&gt;
 target create $_TARGETNAME arm11 -chain-position $_TARGETNAME&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 init&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4212</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4212"/>
		<updated>2015-07-19T20:55:49Z</updated>

		<summary type="html">&lt;p&gt;Pisa: JTAG to Raspberry Pi connection and config&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi JTAG debugguing ==&lt;br /&gt;
&lt;br /&gt;
 * RPi JTAG setup documentation http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;br /&gt;
&lt;br /&gt;
U-boot commands to enable JTAG pins&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 mw.l 0x20200000 0x04a020&lt;br /&gt;
 mw.l 0x20200008 0x65b6c0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[FTDI2232_JTAG#PiKRON.27s_JTAG_adapter|FTDI2232 JT_USB5]] RPi Connection and Configuration ==&lt;br /&gt;
&lt;br /&gt;
Interconnection of 10 pin JT_USB5 cable to RPi P1 connector&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! JT_USB5 pin !! Signal !! RPi P1   !! Type   !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  1          || TCK    || 22       || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  2          || VREF   || 1        || Out    || Target voltage reference 3.3 V&lt;br /&gt;
|-&lt;br /&gt;
|  3          || TDI    || 7        || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  4          || RTCK   || 16       || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  5          || TDO    || 18       || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  6          || RST    || NC       ||        || Reset&lt;br /&gt;
|-&lt;br /&gt;
|  7          || nTRST  || 15       || In/Out || Test system reset&lt;br /&gt;
|-&lt;br /&gt;
|  8          || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|-&lt;br /&gt;
|  9          || TMS    || 13       || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  10         || GND    || 6, 9, 25 || In/Out || Target ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 &lt;br /&gt;
 interface ftdi&lt;br /&gt;
 &lt;br /&gt;
 #ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
 ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_init 0x0cf8 0x0cfb&lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
 &lt;br /&gt;
 ftdi_layout_signal nTRST -data 0x0010&lt;br /&gt;
 ftdi_layout_signal nSRST -ndata 0x0040&lt;br /&gt;
 ftdi_layout_signal LED -ndata 0x0800&lt;br /&gt;
 &lt;br /&gt;
 transport select jtag&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
    set  _CHIPNAME $CHIPNAME&lt;br /&gt;
 } else {&lt;br /&gt;
    set  _CHIPNAME raspi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 reset_config none&lt;br /&gt;
 &lt;br /&gt;
 if { [info exists CPU_TAPID ] } {&lt;br /&gt;
    set _CPU_TAPID $CPU_TAPID&lt;br /&gt;
 } else {&lt;br /&gt;
    set _CPU_TAPID 0x07b7617F&lt;br /&gt;
 }&lt;br /&gt;
 jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID&lt;br /&gt;
 &lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.arm&lt;br /&gt;
 target create $_TARGETNAME arm11 -chain-position $_TARGETNAME&lt;br /&gt;
 &lt;br /&gt;
 adapter_khz 500&lt;br /&gt;
 &lt;br /&gt;
 init&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=A0B36APO_Virtual_Hardware&amp;diff=4211</id>
		<title>A0B36APO Virtual Hardware</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=A0B36APO_Virtual_Hardware&amp;diff=4211"/>
		<updated>2015-05-07T08:48:23Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Update location of QEMU with integrated APOHW support.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:apo_bazmek.jpg|thumb|right|Simple terminal used by students]]&lt;br /&gt;
&lt;br /&gt;
[https://edux.feld.cvut.cz/courses/A0B36APO/start A0B36APO] (Architektury pocitacu -- Computer architectures) is a course taught by [http://cs.felk.cvut.cz/webis/courses.html Department of Computer Science and Engineering] and [http://dce.fel.cvut.cz/ Department of Control Engineering].&lt;br /&gt;
&lt;br /&gt;
Students [https://edux.feld.cvut.cz/courses/A0B36APO/tutorials/10/start have to work with specialized hardware]. This page describes how to use the virtual implementation of the specialized hardware -- this can help students to work at home without the access to the real hardware.&lt;br /&gt;
&lt;br /&gt;
=== Qemu ===&lt;br /&gt;
[https://en.wikipedia.org/wiki/Qemu Qemu] is a processor emulator which enables to run separate Operating System on Virtual Hardware.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== APOHW ==&lt;br /&gt;
APOHW comprises PCIe I/O card and Simple terminal (keyboard + text LCD).&lt;br /&gt;
&lt;br /&gt;
[[File:apo_diagr.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using APOHW =&lt;br /&gt;
How to obtain the source code:&lt;br /&gt;
  git clone git://github.com/CTU-IIG/qemu.git -b apohw&lt;br /&gt;
&lt;br /&gt;
How to compile it:&lt;br /&gt;
  ./configure --enable-system --target-list=i386-softmmu --enable-sdl --enable-kvm&lt;br /&gt;
&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;To compile Qemu on bare Ubuntu 12.04, you will need to install zlib1g-dev, libglib2.0-dev, libsdl1.2-dev&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
How to run it:&lt;br /&gt;
  ./i386-softmmu/qemu-system-i386 -device apohw \&lt;br /&gt;
     -hda ../../debian_lenny_i386_standard.qcow2 \&lt;br /&gt;
     --boot c \&lt;br /&gt;
     -enable-kvm&lt;br /&gt;
&lt;br /&gt;
You need to have some [http://blog.aurel32.net/46 image file with GNU/Linux installed  on it]. KVM command is optional.&lt;br /&gt;
&lt;br /&gt;
In another terminal then run:&lt;br /&gt;
  telnet localhost 55555&lt;br /&gt;
... and perceive the miracle&lt;br /&gt;
&lt;br /&gt;
= What is not implemented =&lt;br /&gt;
* Proper timing features of the hardware&lt;br /&gt;
* I/O card is PCI, not PCIe -- however memory access is the same.&lt;br /&gt;
* HD44780 does not support 4bit access&lt;br /&gt;
* HD44780 does not support display shifting&lt;br /&gt;
* HD44780 does not support editable CGRAM&lt;br /&gt;
* Buzzer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Bugs ===&lt;br /&gt;
Bug reports please send to lisovy@gmail.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Useful links ===&lt;br /&gt;
[http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html HD44780 DDRAM explained]&lt;br /&gt;
&lt;br /&gt;
[https://lwn.net/images/pdf/LDD3/ch12.pdf PCI drivers on Linux]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4209</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4209"/>
		<updated>2015-03-15T23:02:54Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/rpi-utils read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4208</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4208"/>
		<updated>2015-03-15T23:02:29Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Pointers to RPi repositories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GNU/Linux Kernel and other Utilities ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi fully-preemptive Linux kernel for RPi]&lt;br /&gt;
* [https://github.com/ppisa/linux-rpi read-only root + overlay and U-boot with DTS]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4205</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4205"/>
		<updated>2014-10-16T10:19:03Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
* [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
* [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4204</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4204"/>
		<updated>2014-10-16T10:18:26Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
 * [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
 * [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 /* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
 OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
 GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 alpha-no-ev4-directive.diff&lt;br /&gt;
 boehm-gc-getnprocs.diff&lt;br /&gt;
 note-gnu-stack.diff&lt;br /&gt;
 gcc-target-include-asm.diff&lt;br /&gt;
 pr57653.diff&lt;br /&gt;
 pr61046.diff&lt;br /&gt;
 pr61336.diff&lt;br /&gt;
 gcc-setmultilib-fix.diff&lt;br /&gt;
 pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4203</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=Raspberry_Pi&amp;diff=4203"/>
		<updated>2014-10-16T10:17:25Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Raspberry Pi projects and toolchain&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Based Projects ==&lt;br /&gt;
&lt;br /&gt;
 * [http://lintarget.sourceforge.net/rpi-motor-control/index.html Raspberry Pi minimal components DC motor servo control]&lt;br /&gt;
 * [http://lintarget.sourceforge.net/can_bus/index.html The small robotic arm control with use of Simulink CAN blocks with ERT Linux target]&lt;br /&gt;
&lt;br /&gt;
== GCC Tool-chain  for Cross-Compilation  ==&lt;br /&gt;
&lt;br /&gt;
There are more suggestion of different arm-gnueabihf toolchains variants to use for cross-build of applications for Raspberry Pi&lt;br /&gt;
platform. But all of them which I have easily found do not correctly match ARMv6 BCM2835 target. The unfortunate selection&lt;br /&gt;
of &#039;&#039;arm-linux-gnueabihf&#039;&#039; as GNU triplet for Raspbian build clashes with official &#039;&#039;arm-linux-gnueabihf&#039;&#039; tool-chains&lt;br /&gt;
which target ARMv7 architecture and produced binaries are less or more incompatible with RPi hardware and GLIBC build.&lt;br /&gt;
&lt;br /&gt;
I have decided to define separate/non-classing GCC architecture &#039;&#039;arm-rpi-linux-gnueabihf&#039;&#039; variant and use original&lt;br /&gt;
Raspbian GLIBC binaries to ensure best compatibility for build tool-chain. The simple approach is to put whole Raspbian&lt;br /&gt;
root filesystem copy to &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt;. The mosts of the files are not required&lt;br /&gt;
in fact so reduction to subset of &amp;lt;tt&amp;gt;/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/libnfsidmap&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/lib/arm-linux-gnueabihf/security&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/include&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/usr/lib/arm-rpi-linux-gnueabihf&amp;lt;/tt&amp;gt;&lt;br /&gt;
is enough. Other option is to use &#039;&#039;debootstrap&#039;&#039; with correct parameters to install base Raspbian libraries and development files&lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/sys-root&amp;lt;/tt&amp;gt; directory. Some symbolic links has to be adapted to point correctly&lt;br /&gt;
to target files by changing paths to relative. Then &amp;lt;tt&amp;gt;libc.so&amp;lt;/tt&amp;gt; prepared for relative paths and cross-compilation needs&lt;br /&gt;
to be provided. Create file &amp;lt;tt&amp;gt;/usr/arm-rpi-linux-gnueabihf/lib/libc.so&amp;lt;tt&amp;gt; with next content&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
/* GNU ld script&lt;br /&gt;
   Use the shared library, but some functions are only in&lt;br /&gt;
   the static library, so try that secondarily.  */&lt;br /&gt;
OUTPUT_FORMAT(elf32-littlearm)&lt;br /&gt;
GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should be enough for environment for standard binutils and GCC build. &#039;&#039;binutils-2.24&#039;&#039; has been used without any changes.&lt;br /&gt;
&#039;&#039;gcc-4.9.1&#039;&#039; with statically included &#039;&#039;gmp-5.1.2&#039;&#039;, &#039;&#039;mpc-1.0.1&#039;&#039; and &#039;&#039;mpfr-3.1.2&#039;&#039; has been patched by subset&lt;br /&gt;
of Debian patches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
alpha-no-ev4-directive.diff&lt;br /&gt;
boehm-gc-getnprocs.diff&lt;br /&gt;
note-gnu-stack.diff&lt;br /&gt;
gcc-target-include-asm.diff&lt;br /&gt;
pr57653.diff&lt;br /&gt;
pr61046.diff&lt;br /&gt;
pr61336.diff&lt;br /&gt;
gcc-setmultilib-fix.diff&lt;br /&gt;
pr61841.diff&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then binutils and GCC has been compiled and installed with next configuration&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
../../../src/gcc-4.9/configure -v \&lt;br /&gt;
         --enable-languages=c,c++ \&lt;br /&gt;
         --prefix=/usr \&lt;br /&gt;
         --with-system-zlib \&lt;br /&gt;
         --without-included-gettext \&lt;br /&gt;
         --enable-threads=posix \&lt;br /&gt;
         --enable-shared \&lt;br /&gt;
         --disable-nls \&lt;br /&gt;
         --enable-clocale=gnu \&lt;br /&gt;
         --enable-objc-gc \&lt;br /&gt;
         --enable-mpfr \&lt;br /&gt;
         --enable-tls \&lt;br /&gt;
         --enable-secureplt \&lt;br /&gt;
         --enable-targets=arm-linux-gnu \&lt;br /&gt;
         --enable-symvers=gnu \&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=arm-rpi-linux-gnueabihf \&lt;br /&gt;
         --enable-version-specific-runtime-libs \&lt;br /&gt;
         --disable-libgomp \&lt;br /&gt;
         --with-headers=/usr/arm-rpi-linux-gnueabihf/sys-include \&lt;br /&gt;
         --with-sysroot=/usr/arm-rpi-linux-gnueabihf/sys-root \&lt;br /&gt;
         \&lt;br /&gt;
         --enable-linker-build-id \&lt;br /&gt;
         --enable-libstdcxx-time=yes \&lt;br /&gt;
         --enable-gnu-unique-object \&lt;br /&gt;
         --enable-plugin \&lt;br /&gt;
         --enable-multiarch \&lt;br /&gt;
         --disable-sjlj-exceptions \&lt;br /&gt;
         --with-arch=armv6 \&lt;br /&gt;
         --with-fpu=vfp \&lt;br /&gt;
         --with-float=hard&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The build binaries for x86_64/amd64 Debian based systems are provided in our [[Cross_compilers|DEB tool-chains collection]]&lt;br /&gt;
&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/b/binutils-2.24/binutils-arm-rpi-linux-gnueabihf_2.24-1_amd64.deb&lt;br /&gt;
 * http://rtime.felk.cvut.cz/debian/pool/main/g/gcc-4.9.1/gcc-arm-rpi-linux-gnueabihf_4.9.1-1_amd64.deb&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Template:Main_Page/Hardware&amp;diff=4202</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=4202"/>
		<updated>2014-10-16T09:42:19Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[A0B36APO Virtual Hardware]]&lt;br /&gt;
* [[Alpha PWS500a]]&lt;br /&gt;
* [[AT91SAM7X256]]&lt;br /&gt;
* [[Boa5200]]&lt;br /&gt;
* [[ColdFire_DEMO52233 | ColdFire DEMO52233 (Board from Freescale)]] &lt;br /&gt;
* [[ColdFire_MCF548x | ColdFire MCF548x (resources and experiments)]] &lt;br /&gt;
* [[Dell XPS12]]&lt;br /&gt;
* [[FPGA]]&lt;br /&gt;
* [[FTDI2232 JTAG]]&lt;br /&gt;
* [[H8S/2638]]&lt;br /&gt;
* [[HC12 | Motorola HC12]]&lt;br /&gt;
* [[Humusoft MF6xx]]&lt;br /&gt;
* [[LX CPU1]]&lt;br /&gt;
* [[LPC21xx]]&lt;br /&gt;
* [[MIDAM MPC5200 DB1]] (Mikroklima)&lt;br /&gt;
* [[ML403 | ML403 Xilinx Virtex-4]]&lt;br /&gt;
* [[MSP430F5529 Launchpad]]&lt;br /&gt;
* [[OJ10 - welding robot]]&lt;br /&gt;
* [[PiMX1]] i.MX1 processor based board&lt;br /&gt;
* [[Raspberry Pi]] (RPi, BCM2835)&lt;br /&gt;
* [[STM32 VLDISCOVERY]]&lt;br /&gt;
* [[TC1798|TC1798 - Infineon AUDO MAX]]&lt;br /&gt;
* [[TMS570LS3137]]&lt;br /&gt;
* [[Wireless_Sensor_Networks | Wireless Sensor Networks (WSNs)]]&lt;br /&gt;
* [[XC2S100-kit|Xilinx Spartan II XC2S100 Demo Board]]&lt;br /&gt;
* [[XC2V1000-kit|Xilinx Virtex II XC2V1000 Demo Board]]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Template:Main_Page/Hardware&amp;diff=4201</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=4201"/>
		<updated>2014-10-16T09:41:06Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[A0B36APO Virtual Hardware]]&lt;br /&gt;
* [[Alpha PWS500a]]&lt;br /&gt;
* [[AT91SAM7X256]]&lt;br /&gt;
* [[Boa5200]]&lt;br /&gt;
* [[ColdFire_DEMO52233 | ColdFire DEMO52233 (Board from Freescale)]] &lt;br /&gt;
* [[ColdFire_MCF548x | ColdFire MCF548x (resources and experiments)]] &lt;br /&gt;
* [[Dell XPS12]]&lt;br /&gt;
* [[FPGA]]&lt;br /&gt;
* [[FTDI2232 JTAG]]&lt;br /&gt;
* [[H8S/2638]]&lt;br /&gt;
* [[HC12 | Motorola HC12]]&lt;br /&gt;
* [[Humusoft MF6xx]]&lt;br /&gt;
* [[LX CPU1]]&lt;br /&gt;
* [[LPC21xx]]&lt;br /&gt;
* [[MIDAM MPC5200 DB1]] (Mikroklima)&lt;br /&gt;
* [[ML403 | ML403 Xilinx Virtex-4]]&lt;br /&gt;
* [[MSP430F5529 Launchpad]]&lt;br /&gt;
* [[OJ10 - welding robot]]&lt;br /&gt;
* [[PiMX1]] i.MX1 processor based board&lt;br /&gt;
* [[Raspberry Pi]] (RPi)&lt;br /&gt;
* [[STM32 VLDISCOVERY]]&lt;br /&gt;
* [[TC1798|TC1798 - Infineon AUDO MAX]]&lt;br /&gt;
* [[TMS570LS3137]]&lt;br /&gt;
* [[Wireless_Sensor_Networks | Wireless Sensor Networks (WSNs)]]&lt;br /&gt;
* [[XC2S100-kit|Xilinx Spartan II XC2S100 Demo Board]]&lt;br /&gt;
* [[XC2V1000-kit|Xilinx Virtex II XC2V1000 Demo Board]]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=Template:Main_Page/Hardware&amp;diff=4200</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=4200"/>
		<updated>2014-10-16T09:40:09Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[A0B36APO Virtual Hardware]]&lt;br /&gt;
* [[Alpha PWS500a]]&lt;br /&gt;
* [[AT91SAM7X256]]&lt;br /&gt;
* [[Boa5200]]&lt;br /&gt;
* [[ColdFire_DEMO52233 | ColdFire DEMO52233 (Board from Freescale)]] &lt;br /&gt;
* [[ColdFire_MCF548x | ColdFire MCF548x (resources and experiments)]] &lt;br /&gt;
* [[Dell XPS12]]&lt;br /&gt;
* [[FPGA]]&lt;br /&gt;
* [[FTDI2232 JTAG]]&lt;br /&gt;
* [[H8S/2638]]&lt;br /&gt;
* [[HC12 | Motorola HC12]]&lt;br /&gt;
* [[Humusoft MF6xx]]&lt;br /&gt;
* [[LX CPU1]]&lt;br /&gt;
* [[LPC21xx]]&lt;br /&gt;
* [[MIDAM MPC5200 DB1]] (Mikroklima)&lt;br /&gt;
* [[ML403 | ML403 Xilinx Virtex-4]]&lt;br /&gt;
* [[MSP430F5529 Launchpad]]&lt;br /&gt;
* [[OJ10 - welding robot]]&lt;br /&gt;
* [[PiMX1]] i.MX1 processor based board&lt;br /&gt;
* [[RaspberryPi]]&lt;br /&gt;
* [[STM32 VLDISCOVERY]]&lt;br /&gt;
* [[TC1798|TC1798 - Infineon AUDO MAX]]&lt;br /&gt;
* [[TMS570LS3137]]&lt;br /&gt;
* [[Wireless_Sensor_Networks | Wireless Sensor Networks (WSNs)]]&lt;br /&gt;
* [[XC2S100-kit|Xilinx Spartan II XC2S100 Demo Board]]&lt;br /&gt;
* [[XC2V1000-kit|Xilinx Virtex II XC2V1000 Demo Board]]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4199</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4199"/>
		<updated>2014-09-05T09:33:20Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* OpenOCD setup and Flashing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
Consult [[FTDI2232_JTAG]] page for generic OpenOCD setup for ARM targets debugging.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/ http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/ openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/ http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
&lt;br /&gt;
Program application starting at zero address&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00040000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
Program binary image starting at 256kB boundary and maximal length 1MB&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the area after the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00040000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.bin 0x00040000&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4198</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4198"/>
		<updated>2014-09-05T09:31:08Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Update TMS570 OpenOCD Flashing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
Consult [[FTDI2232_JTAG]] page for generic OpenOCD setup for ARM targets debugging.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/ http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/ openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/ http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
&lt;br /&gt;
Program application starting at zero address&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00040000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
Program binary image starting at 256kB boundary and maximal length 1MB&lt;br /&gt;
&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 # Erase the first 256kB of Flash &lt;br /&gt;
 flash erase_address 0x00040000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.bin 0x00040000&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4197</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4197"/>
		<updated>2014-08-27T14:34:21Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* OpenOCD setup and Flashing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
Consult [[FTDI2232_JTAG]] page for generic OpenOCD setup for ARM targets debugging.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/ http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/ openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/ http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 # Erase the first MB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4196</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4196"/>
		<updated>2014-08-27T14:18:49Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/ http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/ openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/ http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 # Erase the first MB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4195</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4195"/>
		<updated>2014-08-27T14:16:21Z</updated>

		<summary type="html">&lt;p&gt;Pisa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [[http://openocd.zylin.com/#/c/2214/|http://openocd.zylin.com/#/c/2214/]]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([[http://cmp.felk.cvut.cz/~pisa/tms570/|openocd-tms570-f021-wip.tar.gz]]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[[http://cmp.felk.cvut.cz/~pisa/tms570/|http://cmp.felk.cvut.cz/~pisa/tms570/]]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd|https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 # Erase the first MB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4194</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4194"/>
		<updated>2014-08-27T14:15:04Z</updated>

		<summary type="html">&lt;p&gt;Pisa: More about TMS570 flashing by OpenOCD&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found&lt;br /&gt;
in OpenOCD Gerrit [http://openocd.zylin.com/#/c/2214/|http://openocd.zylin.com/#/c/2214/]&lt;br /&gt;
&lt;br /&gt;
Patches with our corrections to the support have been sent to the OpenOCD&lt;br /&gt;
mailing-list. The complete OpenOCD sources with all required patches applied&lt;br /&gt;
([http://cmp.felk.cvut.cz/~pisa/tms570/|openocd-tms570-f021-wip.tar.gz]) can be found at temporal place &lt;br /&gt;
&lt;br /&gt;
[http://cmp.felk.cvut.cz/~pisa/tms570/|http://cmp.felk.cvut.cz/~pisa/tms570/]&lt;br /&gt;
&lt;br /&gt;
As a base for OpenOCD configuration for the TMS570 target can be used&lt;br /&gt;
&lt;br /&gt;
[https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd|https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd]&lt;br /&gt;
&lt;br /&gt;
The example of Flash erase and write OpenOCD commands&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 # probe bank/target for actual flash size&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 # updated information about banks&lt;br /&gt;
 flash banks&lt;br /&gt;
 &lt;br /&gt;
 # erase one 128kB sector starting at 1MB&lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 # test Flash write using fill pattern&lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
&lt;br /&gt;
 # Check memory content &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 # Erase the first MB of Flash &lt;br /&gt;
 flash erase_address 0x00000000 0x00100000&lt;br /&gt;
 &lt;br /&gt;
 # Program application&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4193</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4193"/>
		<updated>2014-08-27T13:17:47Z</updated>

		<summary type="html">&lt;p&gt;Pisa: OpenOCD programming of Flash on TMS570&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD setup and Flashing ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 flash banks&lt;br /&gt;
 flash list&lt;br /&gt;
 flash probe 0&lt;br /&gt;
 &lt;br /&gt;
 flash erase_address 0x00100000 0x00020000&lt;br /&gt;
 &lt;br /&gt;
 flash fillw 0x00100000 0xabcd1234 128&lt;br /&gt;
 &lt;br /&gt;
 mdw 0x00100000 256&lt;br /&gt;
 &lt;br /&gt;
 flash fillw 0x00101000 0xdeadbeef 128&lt;br /&gt;
 mdw 0x00101000 256&lt;br /&gt;
 &lt;br /&gt;
 flash erase_address 0x00000000 0x00100000&lt;br /&gt;
&lt;br /&gt;
 program application.elf&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4191</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4191"/>
		<updated>2014-08-14T14:37:07Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Link RTEMS TMS570 BSP page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
=== NHET Assembler ===&lt;br /&gt;
&lt;br /&gt;
http://www.ti.com/tool/nhet-assembler&lt;br /&gt;
&lt;br /&gt;
Installer doesn&#039;t work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: &amp;lt;tt&amp;gt;apt-get install p11-kit-modules:i386 gnome-keyring:i386&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is installed under windows, the resulting &#039;&#039;hetp.exe&#039;&#039; runs under Wine correctly.&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://www.rtems.org/wiki/index.php/Tms570&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4188</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4188"/>
		<updated>2014-07-08T08:39:53Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* SDRAM setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1??	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4187</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4187"/>
		<updated>2014-07-08T08:39:18Z</updated>

		<summary type="html">&lt;p&gt;Pisa: SDRAM setup for HDK corrections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| 160 / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| 80 / 80??	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 2-1 / 4-1	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 6-1 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 2-1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 2-1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 2-1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 4-1 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 6-1 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 2-1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 5 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 312 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 2 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 0 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4186</id>
		<title>FTDI2232 JTAG</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4186"/>
		<updated>2014-07-06T14:27:21Z</updated>

		<summary type="html">&lt;p&gt;Pisa: OpenOCD and DDD integration&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PiKRON&#039;s JTAG adapter ==&lt;br /&gt;
&lt;br /&gt;
Author: [http://volny.cz/porazil/ Petr Porazil]&lt;br /&gt;
&lt;br /&gt;
[[File:jt_usb5.pdf]]&lt;br /&gt;
&lt;br /&gt;
Adapter is compatible with standard 20 pin ARM JTAG connector as well as&lt;br /&gt;
provides reduced 10 pin connector used on [http://www.pikron.com/ PiKRON]&#039;s LPC17xx, LPC21xx,&lt;br /&gt;
i.MX and other boards.&lt;br /&gt;
&lt;br /&gt;
== Permit access to usb as non-root user ==&lt;br /&gt;
&lt;br /&gt;
in /etc/udev/rules.d add file 45-ftdi-libftdi.rules with following content:&lt;br /&gt;
&lt;br /&gt;
 ACTION!=&amp;quot;add&amp;quot;, SUBSYSTEM!=&amp;quot;usb_device&amp;quot;, GOTO=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
 ATTR(idProduct)==&amp;quot;bcd9&amp;quot;, ATTR(idVendor)==&amp;quot;0403&amp;quot;, MODE:=&amp;quot;666&amp;quot;&lt;br /&gt;
 LABEL=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Values are checked on Stellaris board and Ubuntu 10.10. Then reload rules&lt;br /&gt;
 :/# initctl reload-configuration udev&lt;br /&gt;
and reconnect your hardware.&lt;br /&gt;
&lt;br /&gt;
== Older setup for LCP2148 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#daemon configuration&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
# tell gdb our flash memory map&lt;br /&gt;
# and enable flash programming&lt;br /&gt;
#gdb_memory_map enable&lt;br /&gt;
#gdb_flash_program enable&lt;br /&gt;
&lt;br /&gt;
#interface&lt;br /&gt;
interface ft2232&lt;br /&gt;
#ft2232_device_desc &amp;quot;JTAG&amp;quot;&lt;br /&gt;
ft2232_layout usbjtag&lt;br /&gt;
ft2232_vid_pid 0x0403 0x6010&lt;br /&gt;
#jtag_speed 3&lt;br /&gt;
&lt;br /&gt;
# reset layout for ul_usb1 and jt_usb5 with ft2232&lt;br /&gt;
#               7     TRST      NTRST        IOL0&lt;br /&gt;
#               6     nHRST     RST          IOL2&lt;br /&gt;
#               4     RTCK      SRST         IOL1&lt;br /&gt;
&lt;br /&gt;
#use combined on interfaces or targets that can&#039;t set TRST/SRST separately&lt;br /&gt;
#            trst_and_srst&lt;br /&gt;
#reset_config trst_only srst_pulls_trst&lt;br /&gt;
reset_config trst_and_srst separate trst_open_drain srst_push_pull&lt;br /&gt;
&lt;br /&gt;
source [find target/lpc2148.cfg]&lt;br /&gt;
&lt;br /&gt;
init&lt;br /&gt;
reset halt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for STM3210C-EVAL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
#set CHIPNAME STM32F107VCT6&lt;br /&gt;
#set WORKAREASIZE 0x10000&lt;br /&gt;
interface ftdi&lt;br /&gt;
#ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
&lt;br /&gt;
ftdi_layout_init 0x05f8 0x0cfb&lt;br /&gt;
ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
&lt;br /&gt;
#source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find board/stm3210c_eval.cfg]&lt;br /&gt;
reset_config trst_and_srst&lt;br /&gt;
&lt;br /&gt;
init; &lt;br /&gt;
#ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
#stm32f1x.cpu arp_halt&lt;br /&gt;
#wait_halt&lt;br /&gt;
#stm32f1x.cpu curstate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
openocd -c &amp;quot;source [find load-jt_usb5.cfg]&amp;quot; -c &amp;quot;program STM3210C-EVAL_FW_V1.1.0.hex&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for TMS570LS3137 ==&lt;br /&gt;
&lt;br /&gt;
The OpenOCD setup for [[TMS570LS3137]] board.&lt;br /&gt;
Setup files for this target are part of [http://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd rtems-tms570-utils] repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
adapter_khz 1500&lt;br /&gt;
&lt;br /&gt;
source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find target/ti_tms570.cfg]&lt;br /&gt;
&lt;br /&gt;
reset_config trst_only&lt;br /&gt;
init; ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
reset halt&lt;br /&gt;
wait_halt&lt;br /&gt;
resume&lt;br /&gt;
sleep 1000&lt;br /&gt;
tms570.cpu arp_halt&lt;br /&gt;
wait_halt&lt;br /&gt;
&lt;br /&gt;
# reset and prepare target by running setup code from Flash when GDB is connected&lt;br /&gt;
tms570.cpu configure -event gdb-attach {&lt;br /&gt;
        cortex_r4 dbginit&lt;br /&gt;
        reset halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
        resume&lt;br /&gt;
        sleep 1000&lt;br /&gt;
        tms570.cpu arp_halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD and GDB Quirks ==&lt;br /&gt;
&lt;br /&gt;
GDB level initialization commands (&amp;quot;gdb-openocd.init&amp;quot; scripst)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#set debug remote 1&lt;br /&gt;
#set debug infrun 1&lt;br /&gt;
#set remotelogfile my_remote.log&lt;br /&gt;
&lt;br /&gt;
set endian big&lt;br /&gt;
target remote localhost:3333&lt;br /&gt;
&lt;br /&gt;
#set remote software-breakpoint-packet 0&lt;br /&gt;
#monitor gdb_breakpoint_override hard&lt;br /&gt;
load&lt;br /&gt;
&lt;br /&gt;
#source gdb_initial_commands&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wrapper to start and connect together GDB and OpenOCD and run DDD gui. The script starts OpenOCD&lt;br /&gt;
if needed. GDB is started then and &amp;quot;gdb-openocd.init&amp;quot; commands sequence ensures connection to OpenOCD,&lt;br /&gt;
loading of application image to the target (file name is the first script parameter).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
SCRIP_DIR=&amp;quot;$(dirname &amp;quot;$(readlink -f &amp;quot;$0&amp;quot;)&amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
nc -w 3 -z localhost 4444&lt;br /&gt;
if [ $? -ne 0 ]&lt;br /&gt;
then&lt;br /&gt;
  echo &amp;quot;Starting OpenOCD&amp;quot;&lt;br /&gt;
  # use next options for detailed operation log&lt;br /&gt;
  #   -d3 -l path_to_log/open_ocd.log&lt;br /&gt;
  openocd -f &amp;quot;$SCRIP_DIR/openocd.cfg&amp;quot; &amp;amp;&lt;br /&gt;
  OPENOCD_PID=$!&lt;br /&gt;
  nc -w 10 -z localhost 4444&lt;br /&gt;
  if [ $? -ne 0 ]&lt;br /&gt;
  then&lt;br /&gt;
    echo &amp;quot;OpenOCD start failed&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
ddd --debugger arm-rtems4.11-gdb -x &amp;quot;$SCRIP_DIR/gdb-openocd.init&amp;quot; &amp;quot;$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill $OPENOCD_PID&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== JT_USB5 pin assignment ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Bit !! Signal !! FT2232 !! JT_USB5 !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  Bit0    || TCK/SK || ADBUS0 || TCK     || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  Bit1    || TDI/DO || ADBUS1 || TDI     || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit2    || TDO/DI || ADBUS2 || TDO     || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  Bit3    || TMS/CS || ADBUS3 || TMS     || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit4    || GPIOL0 || ADBUS4 || nTRST   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit5    || GPIOL1 || ADBUS5 || RTCK    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit6    || GPIOL2 || ADBUS6 || RST     || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit7    || GPIOL3 || ADBUS7 || DBGRQ   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit8    || GPIOH0 || ACBUS0 || DBACK   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit9    || GPIOH1 || ACBUS1 ||  AC1    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit10    || GPIOH2 || ACBUS2 || RXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit11    || GPIOH3 || ACBUS3 || TXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4185</id>
		<title>FTDI2232 JTAG</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4185"/>
		<updated>2014-07-06T14:17:33Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* Setup for TMS570LS3137 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PiKRON&#039;s JTAG adapter ==&lt;br /&gt;
&lt;br /&gt;
Author: [http://volny.cz/porazil/ Petr Porazil]&lt;br /&gt;
&lt;br /&gt;
[[File:jt_usb5.pdf]]&lt;br /&gt;
&lt;br /&gt;
Adapter is compatible with standard 20 pin ARM JTAG connector as well as&lt;br /&gt;
provides reduced 10 pin connector used on [http://www.pikron.com/ PiKRON]&#039;s LPC17xx, LPC21xx,&lt;br /&gt;
i.MX and other boards.&lt;br /&gt;
&lt;br /&gt;
== Permit access to usb as non-root user ==&lt;br /&gt;
&lt;br /&gt;
in /etc/udev/rules.d add file 45-ftdi-libftdi.rules with following content:&lt;br /&gt;
&lt;br /&gt;
 ACTION!=&amp;quot;add&amp;quot;, SUBSYSTEM!=&amp;quot;usb_device&amp;quot;, GOTO=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
 ATTR(idProduct)==&amp;quot;bcd9&amp;quot;, ATTR(idVendor)==&amp;quot;0403&amp;quot;, MODE:=&amp;quot;666&amp;quot;&lt;br /&gt;
 LABEL=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Values are checked on Stellaris board and Ubuntu 10.10. Then reload rules&lt;br /&gt;
 :/# initctl reload-configuration udev&lt;br /&gt;
and reconnect your hardware.&lt;br /&gt;
&lt;br /&gt;
== Older setup for LCP2148 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#daemon configuration&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
# tell gdb our flash memory map&lt;br /&gt;
# and enable flash programming&lt;br /&gt;
#gdb_memory_map enable&lt;br /&gt;
#gdb_flash_program enable&lt;br /&gt;
&lt;br /&gt;
#interface&lt;br /&gt;
interface ft2232&lt;br /&gt;
#ft2232_device_desc &amp;quot;JTAG&amp;quot;&lt;br /&gt;
ft2232_layout usbjtag&lt;br /&gt;
ft2232_vid_pid 0x0403 0x6010&lt;br /&gt;
#jtag_speed 3&lt;br /&gt;
&lt;br /&gt;
# reset layout for ul_usb1 and jt_usb5 with ft2232&lt;br /&gt;
#               7     TRST      NTRST        IOL0&lt;br /&gt;
#               6     nHRST     RST          IOL2&lt;br /&gt;
#               4     RTCK      SRST         IOL1&lt;br /&gt;
&lt;br /&gt;
#use combined on interfaces or targets that can&#039;t set TRST/SRST separately&lt;br /&gt;
#            trst_and_srst&lt;br /&gt;
#reset_config trst_only srst_pulls_trst&lt;br /&gt;
reset_config trst_and_srst separate trst_open_drain srst_push_pull&lt;br /&gt;
&lt;br /&gt;
source [find target/lpc2148.cfg]&lt;br /&gt;
&lt;br /&gt;
init&lt;br /&gt;
reset halt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for STM3210C-EVAL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
#set CHIPNAME STM32F107VCT6&lt;br /&gt;
#set WORKAREASIZE 0x10000&lt;br /&gt;
interface ftdi&lt;br /&gt;
#ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
&lt;br /&gt;
ftdi_layout_init 0x05f8 0x0cfb&lt;br /&gt;
ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
&lt;br /&gt;
#source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find board/stm3210c_eval.cfg]&lt;br /&gt;
reset_config trst_and_srst&lt;br /&gt;
&lt;br /&gt;
init; &lt;br /&gt;
#ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
#stm32f1x.cpu arp_halt&lt;br /&gt;
#wait_halt&lt;br /&gt;
#stm32f1x.cpu curstate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
openocd -c &amp;quot;source [find load-jt_usb5.cfg]&amp;quot; -c &amp;quot;program STM3210C-EVAL_FW_V1.1.0.hex&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for TMS570LS3137 ==&lt;br /&gt;
&lt;br /&gt;
The OpenOCD setup for [[TMS570LS3137]] board.&lt;br /&gt;
Setup files for this target are part of [http://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd rtems-tms570-utils] repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
adapter_khz 1500&lt;br /&gt;
&lt;br /&gt;
source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find target/ti_tms570.cfg]&lt;br /&gt;
&lt;br /&gt;
reset_config trst_only&lt;br /&gt;
init; ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
reset halt&lt;br /&gt;
wait_halt&lt;br /&gt;
resume&lt;br /&gt;
sleep 1000&lt;br /&gt;
tms570.cpu arp_halt&lt;br /&gt;
wait_halt&lt;br /&gt;
&lt;br /&gt;
# reset and prepare target by running setup code from Flash when GDB is connected&lt;br /&gt;
tms570.cpu configure -event gdb-attach {&lt;br /&gt;
        cortex_r4 dbginit&lt;br /&gt;
        reset halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
        resume&lt;br /&gt;
        sleep 1000&lt;br /&gt;
        tms570.cpu arp_halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD and GDB Quirks ==&lt;br /&gt;
&lt;br /&gt;
GDB level initialization commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#set debug remote 1&lt;br /&gt;
#set debug infrun 1&lt;br /&gt;
#set remotelogfile my_remote.log&lt;br /&gt;
&lt;br /&gt;
set endian big&lt;br /&gt;
target remote localhost:3333&lt;br /&gt;
&lt;br /&gt;
#set remote software-breakpoint-packet 0&lt;br /&gt;
#monitor gdb_breakpoint_override hard&lt;br /&gt;
load&lt;br /&gt;
&lt;br /&gt;
#source gdb_initial_commands&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== JT_USB5 pin assignment ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Bit !! Signal !! FT2232 !! JT_USB5 !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  Bit0    || TCK/SK || ADBUS0 || TCK     || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  Bit1    || TDI/DO || ADBUS1 || TDI     || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit2    || TDO/DI || ADBUS2 || TDO     || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  Bit3    || TMS/CS || ADBUS3 || TMS     || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit4    || GPIOL0 || ADBUS4 || nTRST   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit5    || GPIOL1 || ADBUS5 || RTCK    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit6    || GPIOL2 || ADBUS6 || RST     || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit7    || GPIOL3 || ADBUS7 || DBGRQ   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit8    || GPIOH0 || ACBUS0 || DBACK   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit9    || GPIOH1 || ACBUS1 ||  AC1    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit10    || GPIOH2 || ACBUS2 || RXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit11    || GPIOH3 || ACBUS3 || TXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4184</id>
		<title>FTDI2232 JTAG</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4184"/>
		<updated>2014-07-06T14:17:10Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* Setup for TMS570LS3137 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PiKRON&#039;s JTAG adapter ==&lt;br /&gt;
&lt;br /&gt;
Author: [http://volny.cz/porazil/ Petr Porazil]&lt;br /&gt;
&lt;br /&gt;
[[File:jt_usb5.pdf]]&lt;br /&gt;
&lt;br /&gt;
Adapter is compatible with standard 20 pin ARM JTAG connector as well as&lt;br /&gt;
provides reduced 10 pin connector used on [http://www.pikron.com/ PiKRON]&#039;s LPC17xx, LPC21xx,&lt;br /&gt;
i.MX and other boards.&lt;br /&gt;
&lt;br /&gt;
== Permit access to usb as non-root user ==&lt;br /&gt;
&lt;br /&gt;
in /etc/udev/rules.d add file 45-ftdi-libftdi.rules with following content:&lt;br /&gt;
&lt;br /&gt;
 ACTION!=&amp;quot;add&amp;quot;, SUBSYSTEM!=&amp;quot;usb_device&amp;quot;, GOTO=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
 ATTR(idProduct)==&amp;quot;bcd9&amp;quot;, ATTR(idVendor)==&amp;quot;0403&amp;quot;, MODE:=&amp;quot;666&amp;quot;&lt;br /&gt;
 LABEL=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Values are checked on Stellaris board and Ubuntu 10.10. Then reload rules&lt;br /&gt;
 :/# initctl reload-configuration udev&lt;br /&gt;
and reconnect your hardware.&lt;br /&gt;
&lt;br /&gt;
== Older setup for LCP2148 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#daemon configuration&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
# tell gdb our flash memory map&lt;br /&gt;
# and enable flash programming&lt;br /&gt;
#gdb_memory_map enable&lt;br /&gt;
#gdb_flash_program enable&lt;br /&gt;
&lt;br /&gt;
#interface&lt;br /&gt;
interface ft2232&lt;br /&gt;
#ft2232_device_desc &amp;quot;JTAG&amp;quot;&lt;br /&gt;
ft2232_layout usbjtag&lt;br /&gt;
ft2232_vid_pid 0x0403 0x6010&lt;br /&gt;
#jtag_speed 3&lt;br /&gt;
&lt;br /&gt;
# reset layout for ul_usb1 and jt_usb5 with ft2232&lt;br /&gt;
#               7     TRST      NTRST        IOL0&lt;br /&gt;
#               6     nHRST     RST          IOL2&lt;br /&gt;
#               4     RTCK      SRST         IOL1&lt;br /&gt;
&lt;br /&gt;
#use combined on interfaces or targets that can&#039;t set TRST/SRST separately&lt;br /&gt;
#            trst_and_srst&lt;br /&gt;
#reset_config trst_only srst_pulls_trst&lt;br /&gt;
reset_config trst_and_srst separate trst_open_drain srst_push_pull&lt;br /&gt;
&lt;br /&gt;
source [find target/lpc2148.cfg]&lt;br /&gt;
&lt;br /&gt;
init&lt;br /&gt;
reset halt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for STM3210C-EVAL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
#set CHIPNAME STM32F107VCT6&lt;br /&gt;
#set WORKAREASIZE 0x10000&lt;br /&gt;
interface ftdi&lt;br /&gt;
#ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
&lt;br /&gt;
ftdi_layout_init 0x05f8 0x0cfb&lt;br /&gt;
ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
&lt;br /&gt;
#source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find board/stm3210c_eval.cfg]&lt;br /&gt;
reset_config trst_and_srst&lt;br /&gt;
&lt;br /&gt;
init; &lt;br /&gt;
#ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
#stm32f1x.cpu arp_halt&lt;br /&gt;
#wait_halt&lt;br /&gt;
#stm32f1x.cpu curstate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
openocd -c &amp;quot;source [find load-jt_usb5.cfg]&amp;quot; -c &amp;quot;program STM3210C-EVAL_FW_V1.1.0.hex&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for TMS570LS3137 ==&lt;br /&gt;
&lt;br /&gt;
The OpenOCD setup for [[TMS570LS3137]] board.&lt;br /&gt;
Setup files for this target are part of [https://github.com/AoLaD/rtems-tms570-utils/tree/master/openocd rtems-tms570-utils] repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
adapter_khz 1500&lt;br /&gt;
&lt;br /&gt;
source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find target/ti_tms570.cfg]&lt;br /&gt;
&lt;br /&gt;
reset_config trst_only&lt;br /&gt;
init; ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
reset halt&lt;br /&gt;
wait_halt&lt;br /&gt;
resume&lt;br /&gt;
sleep 1000&lt;br /&gt;
tms570.cpu arp_halt&lt;br /&gt;
wait_halt&lt;br /&gt;
&lt;br /&gt;
# reset and prepare target by running setup code from Flash when GDB is connected&lt;br /&gt;
tms570.cpu configure -event gdb-attach {&lt;br /&gt;
        cortex_r4 dbginit&lt;br /&gt;
        reset halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
        resume&lt;br /&gt;
        sleep 1000&lt;br /&gt;
        tms570.cpu arp_halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD and GDB Quirks ==&lt;br /&gt;
&lt;br /&gt;
GDB level initialization commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#set debug remote 1&lt;br /&gt;
#set debug infrun 1&lt;br /&gt;
#set remotelogfile my_remote.log&lt;br /&gt;
&lt;br /&gt;
set endian big&lt;br /&gt;
target remote localhost:3333&lt;br /&gt;
&lt;br /&gt;
#set remote software-breakpoint-packet 0&lt;br /&gt;
#monitor gdb_breakpoint_override hard&lt;br /&gt;
load&lt;br /&gt;
&lt;br /&gt;
#source gdb_initial_commands&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== JT_USB5 pin assignment ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Bit !! Signal !! FT2232 !! JT_USB5 !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  Bit0    || TCK/SK || ADBUS0 || TCK     || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  Bit1    || TDI/DO || ADBUS1 || TDI     || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit2    || TDO/DI || ADBUS2 || TDO     || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  Bit3    || TMS/CS || ADBUS3 || TMS     || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit4    || GPIOL0 || ADBUS4 || nTRST   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit5    || GPIOL1 || ADBUS5 || RTCK    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit6    || GPIOL2 || ADBUS6 || RST     || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit7    || GPIOL3 || ADBUS7 || DBGRQ   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit8    || GPIOH0 || ACBUS0 || DBACK   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit9    || GPIOH1 || ACBUS1 ||  AC1    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit10    || GPIOH2 || ACBUS2 || RXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit11    || GPIOH3 || ACBUS3 || TXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4183</id>
		<title>FTDI2232 JTAG</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=FTDI2232_JTAG&amp;diff=4183"/>
		<updated>2014-07-06T14:13:56Z</updated>

		<summary type="html">&lt;p&gt;Pisa: TMS570LS3137 OpenOCD configuration&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PiKRON&#039;s JTAG adapter ==&lt;br /&gt;
&lt;br /&gt;
Author: [http://volny.cz/porazil/ Petr Porazil]&lt;br /&gt;
&lt;br /&gt;
[[File:jt_usb5.pdf]]&lt;br /&gt;
&lt;br /&gt;
Adapter is compatible with standard 20 pin ARM JTAG connector as well as&lt;br /&gt;
provides reduced 10 pin connector used on [http://www.pikron.com/ PiKRON]&#039;s LPC17xx, LPC21xx,&lt;br /&gt;
i.MX and other boards.&lt;br /&gt;
&lt;br /&gt;
== Permit access to usb as non-root user ==&lt;br /&gt;
&lt;br /&gt;
in /etc/udev/rules.d add file 45-ftdi-libftdi.rules with following content:&lt;br /&gt;
&lt;br /&gt;
 ACTION!=&amp;quot;add&amp;quot;, SUBSYSTEM!=&amp;quot;usb_device&amp;quot;, GOTO=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
 ATTR(idProduct)==&amp;quot;bcd9&amp;quot;, ATTR(idVendor)==&amp;quot;0403&amp;quot;, MODE:=&amp;quot;666&amp;quot;&lt;br /&gt;
 LABEL=&amp;quot;kcontrol_rules_end&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Values are checked on Stellaris board and Ubuntu 10.10. Then reload rules&lt;br /&gt;
 :/# initctl reload-configuration udev&lt;br /&gt;
and reconnect your hardware.&lt;br /&gt;
&lt;br /&gt;
== Older setup for LCP2148 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#daemon configuration&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
# tell gdb our flash memory map&lt;br /&gt;
# and enable flash programming&lt;br /&gt;
#gdb_memory_map enable&lt;br /&gt;
#gdb_flash_program enable&lt;br /&gt;
&lt;br /&gt;
#interface&lt;br /&gt;
interface ft2232&lt;br /&gt;
#ft2232_device_desc &amp;quot;JTAG&amp;quot;&lt;br /&gt;
ft2232_layout usbjtag&lt;br /&gt;
ft2232_vid_pid 0x0403 0x6010&lt;br /&gt;
#jtag_speed 3&lt;br /&gt;
&lt;br /&gt;
# reset layout for ul_usb1 and jt_usb5 with ft2232&lt;br /&gt;
#               7     TRST      NTRST        IOL0&lt;br /&gt;
#               6     nHRST     RST          IOL2&lt;br /&gt;
#               4     RTCK      SRST         IOL1&lt;br /&gt;
&lt;br /&gt;
#use combined on interfaces or targets that can&#039;t set TRST/SRST separately&lt;br /&gt;
#            trst_and_srst&lt;br /&gt;
#reset_config trst_only srst_pulls_trst&lt;br /&gt;
reset_config trst_and_srst separate trst_open_drain srst_push_pull&lt;br /&gt;
&lt;br /&gt;
source [find target/lpc2148.cfg]&lt;br /&gt;
&lt;br /&gt;
init&lt;br /&gt;
reset halt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for STM3210C-EVAL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
#set CHIPNAME STM32F107VCT6&lt;br /&gt;
#set WORKAREASIZE 0x10000&lt;br /&gt;
interface ftdi&lt;br /&gt;
#ftdi_device_desc &amp;quot;Dual RS232&amp;quot;&lt;br /&gt;
ftdi_vid_pid 0x0403 0x6010&lt;br /&gt;
&lt;br /&gt;
ftdi_layout_init 0x05f8 0x0cfb&lt;br /&gt;
ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800&lt;br /&gt;
ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400&lt;br /&gt;
&lt;br /&gt;
#source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find board/stm3210c_eval.cfg]&lt;br /&gt;
reset_config trst_and_srst&lt;br /&gt;
&lt;br /&gt;
init; &lt;br /&gt;
#ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
#stm32f1x.cpu arp_halt&lt;br /&gt;
#wait_halt&lt;br /&gt;
#stm32f1x.cpu curstate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
openocd -c &amp;quot;source [find load-jt_usb5.cfg]&amp;quot; -c &amp;quot;program STM3210C-EVAL_FW_V1.1.0.hex&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup for TMS570LS3137 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
telnet_port 4444&lt;br /&gt;
gdb_port 3333&lt;br /&gt;
&lt;br /&gt;
adapter_khz 1500&lt;br /&gt;
&lt;br /&gt;
source [find interface/ftdi/xds100v2.cfg]&lt;br /&gt;
source [find target/ti_tms570.cfg]&lt;br /&gt;
&lt;br /&gt;
reset_config trst_only&lt;br /&gt;
init; ftdi_set_signal PWR_RST 1; jtag arp_init&lt;br /&gt;
&lt;br /&gt;
reset halt&lt;br /&gt;
wait_halt&lt;br /&gt;
resume&lt;br /&gt;
sleep 1000&lt;br /&gt;
tms570.cpu arp_halt&lt;br /&gt;
wait_halt&lt;br /&gt;
&lt;br /&gt;
# reset and prepare target by running setup code from Flash when GDB is connected&lt;br /&gt;
tms570.cpu configure -event gdb-attach {&lt;br /&gt;
        cortex_r4 dbginit&lt;br /&gt;
        reset halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
        resume&lt;br /&gt;
        sleep 1000&lt;br /&gt;
        tms570.cpu arp_halt&lt;br /&gt;
        wait_halt&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD and GDB Quirks ==&lt;br /&gt;
&lt;br /&gt;
GDB level initialization commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#set debug remote 1&lt;br /&gt;
#set debug infrun 1&lt;br /&gt;
#set remotelogfile my_remote.log&lt;br /&gt;
&lt;br /&gt;
set endian big&lt;br /&gt;
target remote localhost:3333&lt;br /&gt;
&lt;br /&gt;
#set remote software-breakpoint-packet 0&lt;br /&gt;
#monitor gdb_breakpoint_override hard&lt;br /&gt;
load&lt;br /&gt;
&lt;br /&gt;
#source gdb_initial_commands&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== JT_USB5 pin assignment ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data Bit !! Signal !! FT2232 !! JT_USB5 !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
|  Bit0    || TCK/SK || ADBUS0 || TCK     || Out    || Clock Signal Output&lt;br /&gt;
|-&lt;br /&gt;
|  Bit1    || TDI/DO || ADBUS1 || TDI     || Out    || Serial Data Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit2    || TDO/DI || ADBUS2 || TDO     || In     || Serial Data In&lt;br /&gt;
|-&lt;br /&gt;
|  Bit3    || TMS/CS || ADBUS3 || TMS     || Out    || Select Signal Out&lt;br /&gt;
|-&lt;br /&gt;
|  Bit4    || GPIOL0 || ADBUS4 || nTRST   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit5    || GPIOL1 || ADBUS5 || RTCK    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit6    || GPIOL2 || ADBUS6 || RST     || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit7    || GPIOL3 || ADBUS7 || DBGRQ   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit8    || GPIOH0 || ACBUS0 || DBACK   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
|  Bit9    || GPIOH1 || ACBUS1 ||  AC1    || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit10    || GPIOH2 || ACBUS2 || RXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|-&lt;br /&gt;
| Bit11    || GPIOH3 || ACBUS3 || TXLED   || In/Out || General Purpose I/O&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4182</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4182"/>
		<updated>2014-07-06T00:10:26Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* SDRAM setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| IS42S16400F-7BL	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 4 (2 bits)	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 4096 (12 bits)	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 256 (8 bit)	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 2/3	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| x / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| x / 80	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTRL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| - / 4-1	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 0 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4181</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4181"/>
		<updated>2014-07-05T23:31:25Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* SDRAM setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| 	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| x / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| x / 80	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTRL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| - / 4-1	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 0 / 6 	|| 5+3-1	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4180</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4180"/>
		<updated>2014-07-05T23:20:22Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* SDRAM setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| 	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| x / 160	|| 160	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| x / 80	|| 80	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTRL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| - / 4-1	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 0 / 6 	|| 5+3-1	|| configure refresh rate&lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4179</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4179"/>
		<updated>2014-07-05T23:17:21Z</updated>

		<summary type="html">&lt;p&gt;Pisa: /* SDRAM setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| 	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| x / 160	|| 	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| x / 80	|| 	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTRL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| - / 4-1	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 0 / 6 	|| 5+3-1	|| configure refresh rate&lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4178</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4178"/>
		<updated>2014-07-05T23:08:39Z</updated>

		<summary type="html">&lt;p&gt;Pisa: More clock data&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| 	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
| HCLK [MHz]	|| x / 160	|| 	|| &lt;br /&gt;
|-&lt;br /&gt;
| EMIF Clock / VCLK3	|| x / 80	|| 	|| &lt;br /&gt;
|-&lt;br /&gt;
! CLK2CNTRL	!! 	!! 	!!  Clock 2 Control Register&lt;br /&gt;
|-&lt;br /&gt;
| VCLK3R (3-0)	|| 	|| 2-1	|| HCKL to EMIF VCLK3 ration&lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 0 / 6 	|| 5+3-1	|| configure refresh rate&lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4177</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4177"/>
		<updated>2014-07-05T22:45:27Z</updated>

		<summary type="html">&lt;p&gt;Pisa: SDRAM setup clarification from manual&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| 	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! SDRAM Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! Self Refresh Exit Timing Register&lt;br /&gt;
|-&lt;br /&gt;
| T_XS	(XSR)	|| 0 / 6 	|| 5+3-1	|| configure refresh rate&lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!!  SDRAM Configuration Register&lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4176</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4176"/>
		<updated>2014-07-05T22:36:05Z</updated>

		<summary type="html">&lt;p&gt;Pisa: SDRAM values from HDK connectivity test added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK / Conn test !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| 	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5 / 6	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1 / 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1 / 1 	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1 / 2	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80 / 4	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5 / 3	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0 / 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1 / 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
!  XSR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| 	|| - / 6	||	||&lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| 	|| 0 / 	|| 5+3-1	|| configure refresh rate&lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000 / 1250	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0 / 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0 / 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0 / 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1 / 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3 / 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1 / 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2 / 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3 / 0	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
	<entry>
		<id>https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4175</id>
		<title>TMS570LS3137</title>
		<link rel="alternate" type="text/html" href="https://rtime.felk.cvut.cz/hw/index.php?title=TMS570LS3137&amp;diff=4175"/>
		<updated>2014-07-05T22:13:28Z</updated>

		<summary type="html">&lt;p&gt;Pisa: Fill in last HDK used setup (probably mess from HalCoGen). Requires checking.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TMS570LS31x HDK Kit.jpg|right|300px]]&lt;br /&gt;
[[File:Rpp.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [http://www.ti.com/product/tms570ls3137 Main TI page] containing datasheets.&lt;br /&gt;
* [http://e2e.ti.com/support/microcontrollers/hercules/f/312.aspx TI TMS570 related forum]&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:TMS570 TMS570 Wiki]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration LwIP integration]&lt;br /&gt;
&lt;br /&gt;
* [[Media:Studim_procesoru.pdf]] Notes from documentation (in Czech language)&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
&lt;br /&gt;
Tools recommended by TI for programming of this microcontroller:&lt;br /&gt;
&lt;br /&gt;
* [http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 Code Composer Studio] (runs on Win and Linux).&lt;br /&gt;
* [http://www.ti.com/tool/halcogen HalCoGen] (for Windows only, but also runs quite well in Wine).&lt;br /&gt;
** [[TMS570LS3137 HalCoGen Bugs|TMS570LS3137 HalCoGen Bugs]]&lt;br /&gt;
&lt;br /&gt;
=== CCS5.3.0.00090_linux in Ubuntu 12.04 64bits ===&lt;br /&gt;
&lt;br /&gt;
After installation the application can be run with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cd &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/&lt;br /&gt;
&lt;br /&gt;
./ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo apt-get install libgtk2.0-0:i386 libxtst6:i386  gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the application crashes with a segmentation fault do:&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;&amp;lt;install_dir&amp;gt;/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_&amp;lt;your version number&amp;gt;/plugin_customization.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And change key &amp;lt;code&amp;gt;org.eclipse.ui/showIntro&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;FREE License - for use with XDS100 JTAG Emulators&amp;quot; on the licensing options.&lt;br /&gt;
&lt;br /&gt;
You may create a symbolic link and a desktop entry:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo ln -s &amp;lt;install_dir&amp;gt;/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And put in &amp;lt;code&amp;gt;~/.local/share/applications/ccs5.desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Terminal=false&lt;br /&gt;
Exec=ccstudio&lt;br /&gt;
Name=Code Composer Studio&lt;br /&gt;
Icon=/usr/local/ti/ccsv5/eclipse/icon.xpm&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CCS5.5.0.00077_windows on Windows 7x64 ===&lt;br /&gt;
&lt;br /&gt;
Download ccs_setup_5.5.0.00077.exe from http://ti.com and run.&lt;br /&gt;
&lt;br /&gt;
Choose component:&lt;br /&gt;
* Safety MCUs&lt;br /&gt;
&lt;br /&gt;
Choose Compiler tools:&lt;br /&gt;
* TI ARM Compiler Tools&lt;br /&gt;
* TI Documentation&lt;br /&gt;
&lt;br /&gt;
Coose JTAG Emulator Support&lt;br /&gt;
* XDS100 Class Emulator Support&lt;br /&gt;
&lt;br /&gt;
== FreeRTOS ==&lt;br /&gt;
Installation is easy, simply create new project in HalCoGen &lt;br /&gt;
&lt;br /&gt;
* New -&amp;gt; Project&lt;br /&gt;
* Select Family:TMS570LS31x&lt;br /&gt;
* Select Device: TMS570LS3137ZWT_FREERTOS&lt;br /&gt;
&lt;br /&gt;
All necessary files will be added into project automaticaly.&lt;br /&gt;
&lt;br /&gt;
== Matlab/Simulink Embedded Coder target ==&lt;br /&gt;
We have implemented support for Matlab/Simulink which allows to use&lt;br /&gt;
designed peripherals support libraries from Simulink model design.&lt;br /&gt;
&lt;br /&gt;
For further information look at separate pages for the target&lt;br /&gt;
&lt;br /&gt;
http://rtime.felk.cvut.cz/rpp-tms570/&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
Developement board we are using: [http://processors.wiki.ti.com/index.php?title=TMS570LS31x_HDK_Kit TMS570LS31x_HDK_Kit]&lt;br /&gt;
&lt;br /&gt;
=== SDRAM setup ===&lt;br /&gt;
&lt;br /&gt;
* Simple code to setup SDRAM for use from OpenOCD and others code loaders&lt;br /&gt;
** https://github.com/hornmich/tms570ls3137-hdk-sdram&lt;br /&gt;
&lt;br /&gt;
Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected.&lt;br /&gt;
From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality&lt;br /&gt;
must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;systemREG1-&amp;gt;GPREG1 |= 0x80000000;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
! Parameter !! Value for HDK !! Value for RPP !! Notice&lt;br /&gt;
|-&lt;br /&gt;
| Chip	|| 	|| IS45S16320	|| &lt;br /&gt;
|-&lt;br /&gt;
| banks	|| 	|| 4 (2 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| rows	|| 	|| 1024 (10 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| columns	|| 	|| 8192 (13 bits)	|| &lt;br /&gt;
|-&lt;br /&gt;
| CL	|| 	|| 2/3	|| &lt;br /&gt;
|-&lt;br /&gt;
| refresh [ms]	|| 	|| 64 / 16 @ 80 °C || &lt;br /&gt;
|-&lt;br /&gt;
| self. ref. exit [ns]	|| 	|| 67	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDTIMR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| TRF_C (31-27)	|| 5	|| 9-1	|| REFR to REFR&lt;br /&gt;
|-&lt;br /&gt;
| T_RP (26-24)	|| 1	|| 3-1	|| PRE to ACTIV or REFR&lt;br /&gt;
|-&lt;br /&gt;
| (23)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RCD (22-20)	|| 1	|| 3-1	|| ACTIV to RD/WR&lt;br /&gt;
|-&lt;br /&gt;
| (19)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_WR (18-16)	|| 1	|| 2-1	|| WRITE to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RAS (15-12)	|| 80	|| 6-1	|| ACTIV to PRE&lt;br /&gt;
|-&lt;br /&gt;
| T_RC (11-8)	|| 5	|| 9-1	|| ACTIV to ACTIV&lt;br /&gt;
|-&lt;br /&gt;
| (7)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
| T_RRD (6-4)	|| 1	|| 2-1	|| ACTIV to ACTIV other bank&lt;br /&gt;
|-&lt;br /&gt;
| (3)	|| 0	|| 0	|| &lt;br /&gt;
|-&lt;br /&gt;
! SDSRETR 	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| 	|| 0	|| 5+3-1	|| configure refresh rate&lt;br /&gt;
|-&lt;br /&gt;
! SDRCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| RR (12-0)	|| 2000	|| 156	|| 80e6 * 16e-3 / 8192 =&amp;gt; less or equal to 156&lt;br /&gt;
|-&lt;br /&gt;
! SDCR	!! 	!! 	!! &lt;br /&gt;
|-&lt;br /&gt;
| SR (31)	|| 0	|| 0	|| self refresh mode&lt;br /&gt;
|-&lt;br /&gt;
| PD (30)	|| 0	|| 0	|| power down&lt;br /&gt;
|-&lt;br /&gt;
| PDWR (29)	|| 0	|| 0	|| refresh in PD&lt;br /&gt;
|-&lt;br /&gt;
| NM (14)	|| 1	|| 1	|| narrow mode&lt;br /&gt;
|-&lt;br /&gt;
| CL (11-9)	|| 3	|| 3	|| CAS latency&lt;br /&gt;
|-&lt;br /&gt;
| BIT11_9LOCK (8)	|| 1	|| 1	|| CAS latency lock&lt;br /&gt;
|-&lt;br /&gt;
| IBANK (6-4)	|| 2	|| 2 (4 banks)	|| banks&lt;br /&gt;
|-&lt;br /&gt;
| PAGESIZE (2-0)	|| 3	|| 2 (10 bit)	|| counted in elements&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===SCI port===&lt;br /&gt;
We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.&lt;br /&gt;
&lt;br /&gt;
When you want to use SCI, you have to set few things in HalCoGen.&lt;br /&gt;
* Enable driver SCI (not LIN or SCI2 driver)&lt;br /&gt;
* In tab PINMUX select SCI and check conflict with other drivers&lt;br /&gt;
* In tab SCI choose and set data format.&lt;br /&gt;
When you want use interrupts in adittion, do the following:&lt;br /&gt;
* In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt&lt;br /&gt;
* In SCI tab enable TX and/or RX interrupt and select High or Low.&lt;br /&gt;
* In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.&lt;br /&gt;
* Implement notification callback sciNotification() in notificatin.c&lt;br /&gt;
&lt;br /&gt;
In your code don&#039;t forget to initialize sci using sciInit() function.&lt;br /&gt;
&lt;br /&gt;
== Debug over JTAG ==&lt;br /&gt;
&lt;br /&gt;
=== XDS100v2 JTAG Interface from Ti ===&lt;br /&gt;
&lt;br /&gt;
The XDS100v2 is equipped with Ti specific 14-pin JTAG connector.&lt;br /&gt;
Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit&lt;br /&gt;
or other device with ARM JTAG pin placement.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 14 pin Ti&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;| 20 pin ARM&lt;br /&gt;
|-&lt;br /&gt;
| 1	|| TMS	|| TMS	|| 7&lt;br /&gt;
|-&lt;br /&gt;
| 2	|| TRST	|| NTRST	|| 3&lt;br /&gt;
|-&lt;br /&gt;
| 3	|| TDI	|| TDI	|| 5&lt;br /&gt;
|-&lt;br /&gt;
| 4	|| DIS	|| GND	|| 6&lt;br /&gt;
|-&lt;br /&gt;
| 5	|| VD	|| VREF	|| 1 (2)&lt;br /&gt;
|-&lt;br /&gt;
| 6	|| NC || || --&lt;br /&gt;
|-&lt;br /&gt;
| 7	|| TDO	|| TDO	|| 13&lt;br /&gt;
|-&lt;br /&gt;
| 8	|| GND	|| GND	|| (4)&lt;br /&gt;
|-&lt;br /&gt;
| 9	|| RTCK	|| RTCK	|| 11&lt;br /&gt;
|-&lt;br /&gt;
| 10	|| GND	|| GND	|| 8 (12)&lt;br /&gt;
|-&lt;br /&gt;
| 11	|| TCK	|| TCK	|| 9&lt;br /&gt;
|-&lt;br /&gt;
| 12	|| GND	|| GND	|| 10 (14)&lt;br /&gt;
|-&lt;br /&gt;
| 13	|| EMU0	|| 	||&lt;br /&gt;
|-&lt;br /&gt;
| 14	|| EMU1	|| 	|| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Setup XDS100v2 on Linux ===&lt;br /&gt;
&lt;br /&gt;
By default the device (if nothing more connected then &amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;) is added with permissions 664 with &lt;br /&gt;
&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; as user and group. You access the device we need write access for current user. To do so we need &lt;br /&gt;
to create a new udev rules:&lt;br /&gt;
&lt;br /&gt;
 sudo nano /etc/udev/rules.d/45-pes-rpp.rules&lt;br /&gt;
&lt;br /&gt;
And add line:&lt;br /&gt;
&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb&amp;quot;, ATTR{idVendor}==&amp;quot;0403&amp;quot;, ATTR{idProduct}==&amp;quot;a6d0&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then reload udev rules with:&lt;br /&gt;
&lt;br /&gt;
 sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
You can check device properties like &amp;lt;code&amp;gt;idVendor&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;idProduct&amp;lt;/code&amp;gt; with the following command:&lt;br /&gt;
&lt;br /&gt;
 udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)&lt;br /&gt;
&lt;br /&gt;
== RS232 communication setup ==&lt;br /&gt;
&lt;br /&gt;
Connect serial communication pins to computer&#039;s RS232 port or to USB through a FTDI adapter. If using RS232 port the&lt;br /&gt;
device should be &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;, if using FTDI it should be something like &amp;lt;code&amp;gt;/dev/ttyUSBx&amp;lt;/code&amp;gt; &lt;br /&gt;
(check &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; for details).&lt;br /&gt;
&lt;br /&gt;
Make sure minicom or similar terminal program is installed:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install minicom&lt;br /&gt;
&lt;br /&gt;
Then configure minicon:&lt;br /&gt;
&lt;br /&gt;
 sudo minicom -s&lt;br /&gt;
&lt;br /&gt;
And use the following configuration &amp;quot;9600 81N&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Serial Device         : /dev/ttyS0&lt;br /&gt;
 Lockfile Location     : /var/lock&lt;br /&gt;
 Callin Program        :&lt;br /&gt;
 Callout Program       :&lt;br /&gt;
 Bps/Par/Bits          : 9600 8N1&lt;br /&gt;
 Hardware Flow Control : No&lt;br /&gt;
 Software Flow Control : No&lt;br /&gt;
&lt;br /&gt;
Start terminal session and type &amp;lt;code&amp;gt;HELP&amp;lt;/code&amp;gt; command to test communication.&lt;br /&gt;
&lt;br /&gt;
== GCC build for Cortex-R4 Big-Endian ==&lt;br /&gt;
&lt;br /&gt;
GCC options &amp;lt;pre&amp;gt;-mbig-endian -march=armv7-r -mthumb&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC options with hard float &amp;lt;pre&amp;gt;-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GCC multilib options&lt;br /&gt;
&lt;br /&gt;
 armv7-r/thumb2/be;@mbig-endian@mthumb@march=armv7-r&lt;br /&gt;
 armv7-r/thumb2/vfpv3/be;@mbig-endian@mthumb@mfloat-abi=hard@march=armv7-r@mfpu=vfpv3-d16&lt;br /&gt;
&lt;br /&gt;
* https://answers.launchpad.net/gcc-arm-embedded/+question/189066&lt;br /&gt;
&lt;br /&gt;
* Patch to enable GCC and Newlib with big-endian support for RTEMS proposal&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-June/007232.html&lt;br /&gt;
** Toolchain for RTEMS port to Cortex-R4F big-endian (TMS570LS3137)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Huber&#039;s version to push upstream &lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007244.html&lt;br /&gt;
** RTEMS: Add multilibs for ARM&lt;br /&gt;
&lt;br /&gt;
* Newlib correction&lt;br /&gt;
** http://lists.rtems.org/pipermail/devel/2014-July/007251.html&lt;br /&gt;
** Remaining arch issue in Newlib optimized ARM ASM memchr for Cortex-R&lt;br /&gt;
&lt;br /&gt;
== RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project) ==&lt;br /&gt;
&lt;br /&gt;
* http://wiki.rtems.org/wiki/index.php/RTEMSPortToCortexR4&lt;br /&gt;
* http://github.com/AoLaD/rtems/tree/tms570-bsp&lt;br /&gt;
* http://github.com/AoLaD/rtems-tms570-utils&lt;br /&gt;
&lt;br /&gt;
== Contacts ==&lt;br /&gt;
&lt;br /&gt;
* Management: [http://dce.felk.cvut.cz/hanzalek/ Prof. Zdeněk Hanzálek]&lt;br /&gt;
* Technical: [http://cmp.felk.cvut.cz/~pisa/ Pavel Píša, Ph.D.]&lt;/div&gt;</summary>
		<author><name>Pisa</name></author>
	</entry>
</feed>