<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.ethernut.de/nutwiki/index.php?action=history&amp;feed=atom&amp;title=Hardware%2FEIR%2FOpenOCD%2FNutOs</id>
		<title>Hardware/EIR/OpenOCD/NutOs - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.ethernut.de/nutwiki/index.php?action=history&amp;feed=atom&amp;title=Hardware%2FEIR%2FOpenOCD%2FNutOs"/>
		<link rel="alternate" type="text/html" href="http://www.ethernut.de/nutwiki/index.php?title=Hardware/EIR/OpenOCD/NutOs&amp;action=history"/>
		<updated>2026-04-28T22:52:27Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://www.ethernut.de/nutwiki/index.php?title=Hardware/EIR/OpenOCD/NutOs&amp;diff=401&amp;oldid=prev</id>
		<title>Harald: Created page with &quot;&lt;div id=&quot;content&quot;&gt;  = OpenOCD for AT91SAM7SE - Part 9 =  This is the last part of our OpenOCD for AT91SAM7SE tutorial.  == Nut/OS Integration ==  OpenOCD can...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.ethernut.de/nutwiki/index.php?title=Hardware/EIR/OpenOCD/NutOs&amp;diff=401&amp;oldid=prev"/>
				<updated>2017-07-13T09:06:50Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;div id=&amp;quot;content&amp;quot;&amp;gt;  = OpenOCD for AT91SAM7SE - Part 9 =  This is the last part of our &lt;a href=&quot;/nutwiki/index.php?title=Openocd.html&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Openocd.html (page does not exist)&quot;&gt;OpenOCD for AT91SAM7SE tutorial&lt;/a&gt;.  == Nut/OS Integration ==  OpenOCD can...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div id=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= OpenOCD for AT91SAM7SE - Part 9 =&lt;br /&gt;
&lt;br /&gt;
This is the last part of our [[openocd.html|OpenOCD for AT91SAM7SE tutorial]].&lt;br /&gt;
&lt;br /&gt;
== Nut/OS Integration ==&lt;br /&gt;
&lt;br /&gt;
OpenOCD can be easily installed on Linux from the source code package. As this requires several Unix-like tools, which in turn rely on certain capabilities of the underlying OS, building OpenOCD on Windows is quite difficult and will most likely fail many times before you succeed, if ever.&lt;br /&gt;
&lt;br /&gt;
For general use, I'd recommend Freddie Chopin's binary distribution for Windows, available at [http://www.freddiechopin.info/ www.freddiechopin.info]. If you want to use the EIR with Nut/OS, the Turtelizer support package is probably the better choice. The installation detects an existing Nut/OS installation, and places the OpenOCD executable into nut\tools\win32, which needs to be in your PATH environment anyway. Configuration scripts are stored in nut\tools\turtelizer2, for which Makefiles exist to allow using &amp;lt;code&amp;gt;make burn&amp;lt;/code&amp;gt; to build and upload your application binary in one go without hassle.&lt;br /&gt;
&lt;br /&gt;
=== OpenOCD Command Line ===&lt;br /&gt;
&lt;br /&gt;
Throughout this tutorial we simply started OpenOCD without any command line options. All required configuration was included in a local file openocd.cfg, either directly or by include external configuration files.&lt;br /&gt;
&lt;br /&gt;
This will become inconvenient, if you are working on several different project, because each time you need to create a local openocd.cfg and over the time, some of them may become outdated when upgrading OpenOCD or Nut/OS and must be updated manually. If you stick to configurations files supplied by OpenOCD or Nut/OS, this can be avoided. Even if they won't fit, you only need to apply changes at one place to make all your projects work again.&lt;br /&gt;
&lt;br /&gt;
Without a local configuration file, we need to tell OpenOCD, where to find them. This can be done in the same way as in our local configuration. More precisely, instead of reading commands from a file, you can provide commands on the command line, using the command line option &amp;lt;code&amp;gt;-c&amp;lt;/code&amp;gt;. Instead of using openocd.cfg with the follwoing lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;add_script_search_dir [../../nut/tools/turtelizer2]&lt;br /&gt;
source [find interface/turtelizer2.cfg]&lt;br /&gt;
source [find board/eir.cfg]&amp;lt;/pre&amp;gt;&lt;br /&gt;
we can call OpenOCD with the following options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;openocd -s ../../nut/tools/turtelizer2 -c &amp;amp;quot;source [find interface/turtelizer2.cfg]&amp;amp;quot; -c &amp;amp;quot;source [find board/eir.cfg]&amp;amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Nut/OS Makeburn ===&lt;br /&gt;
&lt;br /&gt;
Nut/OS provides several Makefiles, which will automatically launch OpenOCD with the right command line options, when requested to build the &amp;lt;code&amp;gt;burn&amp;lt;/code&amp;gt; target. For example, entering&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;make burn&amp;lt;/pre&amp;gt;&lt;br /&gt;
while in the directory of a sample application, configured for building applications running in external RAM, will build the binary image and finally call OpenOCD with the following options:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Option&lt;br /&gt;
! Function&lt;br /&gt;
|-&lt;br /&gt;
| -s ../../nut/tools/turtelizer2&lt;br /&gt;
| Specifies the OpenOCD search path, which is located in the Nut/OS source tree.&lt;br /&gt;
|-&lt;br /&gt;
| -c &amp;amp;quot;source [find interface/turtelizer2.cfg]&amp;amp;quot;&lt;br /&gt;
| Loads the JTAG programmer configuration, that had been selected by the programmer selection in the Nut/OS Configurator.&lt;br /&gt;
|-&lt;br /&gt;
| -c &amp;amp;quot;source [find board/eir.cfg]&amp;amp;quot;&lt;br /&gt;
| Loads the board configuration of the EIR.&lt;br /&gt;
|-&lt;br /&gt;
| -c init&lt;br /&gt;
| Switches OpenOCD from configuration stage to run stage.&lt;br /&gt;
|-&lt;br /&gt;
| -c &amp;amp;quot;reset init&amp;amp;quot;&lt;br /&gt;
| Calls the reset init handler to initialize the hardware.&lt;br /&gt;
|-&lt;br /&gt;
| -c &amp;amp;quot;load_image firmware.bin 0x20000000&amp;amp;quot;&lt;br /&gt;
| Transfers the firmware image to the SDRAM on the EIR.&lt;br /&gt;
|-&lt;br /&gt;
| -c &amp;amp;quot;verify_image webradio.bin 0x20000000&amp;amp;quot;&lt;br /&gt;
| Verifies the firmware image with the contents of the SDRAM. This is optionally, but fast enough to allow this extra safety.&lt;br /&gt;
|-&lt;br /&gt;
| -c &amp;amp;quot;resume 0x20000000&amp;amp;quot;&lt;br /&gt;
| Starts the uploaded firmware on the target.&lt;br /&gt;
|-&lt;br /&gt;
| -c shutdown&lt;br /&gt;
| Shuts down OpenOCD, so the command line becomes available again for the next command.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The result is, that your application starts running on your target with a snap. An even more interesting feature is, that if you configured Nut/OS be build applications that shall run in flash memory, the binaries will be programmed into flash instead. Magic, isn't it? How can this work?&lt;br /&gt;
&lt;br /&gt;
When requested to build the target &amp;lt;code&amp;gt;burn&amp;lt;/code&amp;gt;, the Nut/OS Makefiles will figure out the Makeburn file with the configured extension. For OpenOCD, this is &amp;lt;code&amp;gt;nut/app/Makeburn.arm-oocd&amp;lt;/code&amp;gt;. Among other things, this file contains the following fragment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;ifeq ($(PLATFORM), ELEKTOR_IR1)&lt;br /&gt;
BURNBOARD = eir&lt;br /&gt;
# Initialize clocks and SDRAM.&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;reset init&amp;amp;quot;&lt;br /&gt;
ifeq ($(LDNAME), at91sam7se512_xram)&lt;br /&gt;
# Load image into external SDRAM.&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;load_image $(ITARG) 0x20000000&amp;amp;quot;&lt;br /&gt;
# Verify image in external SDRAM.&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;verify_image $(ITARG) 0x20000000&amp;amp;quot;&lt;br /&gt;
# Start image in external SDRAM.&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;resume 0x20000000&amp;amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
ifeq ($(LDNAME), at91sam7se512_rom)&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;flash write_image erase $(ITARG) 0x100000 bin&amp;amp;quot;&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;verify_image $(ITARG) 0x100000 bin&amp;amp;quot;&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;at91sam7 gpnvm 2 set&amp;amp;quot;&lt;br /&gt;
BURNCMDS += -c &amp;amp;quot;reset run&amp;amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
This part is executed when building for the EIR, in which case PLATFORM is set to ELEKTOR_IR by the Nut/OS Configurator. Now the base name of the linker script is examined. If it has been configured as &amp;lt;code&amp;gt;at91sam7se512_xram&amp;lt;/code&amp;gt; BURNCMD will be loaded with the options we listed in the table above. If it's configured as &amp;lt;code&amp;gt;at91sam7se512_rom&amp;lt;/code&amp;gt;, then BURNCMD will be loaded with the command line options required to program the binary image into flash memory.&lt;br /&gt;
&lt;br /&gt;
=== The End? ===&lt;br /&gt;
&lt;br /&gt;
Not really. I'm sure there are many open questions and even bugs, as this is the first version. Watch out for updates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Harald</name></author>	</entry>

	</feed>