<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Executing code from RAM (without LX51)</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/21248/executing-code-from-ram-without-lx51</link><description> 
Hi All, 

 
Working with a uPSD33xx. 

 
I am writing a bootloader which performs IAP. Once I have
downloaded an app, each time I reset the device I need to be able to
1) determine that an application is actually present before trying to
execute it</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/98942?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2007 09:01:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1c6dd0fe-b4b7-4773-9a41-782468cb29a3</guid><dc:creator>Jason Daniel</dc:creator><description>&lt;p&gt;&lt;p&gt;
Andy,&lt;/p&gt;

&lt;p&gt;
The title of your original post was &amp;quot;Executing code from RAM
(without LX51).&amp;quot; This might have led to Drew&amp;#39;s suspicions. :)&lt;/p&gt;

&lt;p&gt;
-Jay D.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/112678?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2007 08:58:22 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3d355943-d6fe-4009-8ee0-7f16489a71ee</guid><dc:creator>Jason Daniel</dc:creator><description>&lt;p&gt;&lt;p&gt;
Erik,&lt;/p&gt;

&lt;p&gt;
I&amp;#39;ve used the uPSD family of products from ST quite a bit and
they&amp;#39;re not equivalent to anything resembling an NXP chip. They, in
fact, DO NOT have a bootloader masked into ROM somewhere for you. The
don&amp;#39;t even have really solid information on how to get IAP done
except for a one-page whitepaper.&lt;/p&gt;

&lt;p&gt;
Having done it already myself, I&amp;#39;m not surprised that Andy&amp;#39;s
having trouble. There are about 20 different ways to setup IAP for
this chip and each have their strengths and weaknesses.&lt;/p&gt;

&lt;p&gt;
-Jay D.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/98951?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2007 08:17:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e71b2b05-59c1-44c6-8e58-3c5b418d6f0f</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
Andy,&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;uPSD33xx.&lt;/i&gt; is not a chip I use, but reading the above and
having heard rumors that his chip is a NXP &amp;#39;equivalent&amp;#39; I would
presume that ST provides a bootloader.&lt;/p&gt;

&lt;p&gt;
Thus, in fact you are reinventing the wheel.&lt;/p&gt;

&lt;p&gt;
What I have done in the Ph ARGH!!! NXP area is creating the
NoTouch (can be found at &lt;a href="http://www.esacademy.com"&gt;http://www.esacademy.com&lt;/a&gt;) which is a
very simple way of invoking the &amp;#39;factory provided&amp;#39; bootloader from
serial data, keypress or whatever.&lt;/p&gt;

&lt;p&gt;
Have a look and, maybe, just maybe, such a method may be possible
with your chip and be what you are looking for while not seeing the
forest for the trees.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/74842?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2007 16:57:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4e44ea2f-e168-409f-b31f-46821a82bc7d</guid><dc:creator>Andy Atkinson</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Drew,&lt;/p&gt;

&lt;p&gt;
Your reply didn&amp;#39;t really make sense to me. Why do you think I am
copying code from flash to RAM?&lt;/p&gt;

&lt;p&gt;
The way I am intending to acheive IAP is to run the bootloader
from boot flash, use it to download an application into main flash,
validate the app and then switch the VM register and &amp;#39;reset&amp;#39; to begin
execution from main flash thereby running the main app. I have read
about this technique being used by a number of people - some of which
are regulars this forum.&lt;/p&gt;

&lt;p&gt;
It sounds to me like you have an alternative and perhaps more
flexible solution. What is your design and how does it cope with IAP?
Are you saying that you copy your enire main application into RAM and
execute from there?&lt;/p&gt;

&lt;p&gt;
Cheers&lt;/p&gt;

&lt;p&gt;
Andy&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/74841?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2007 16:39:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:02555ba7-640d-40f7-82e4-5ce00605d6da</guid><dc:creator>Andy Atkinson</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hans-Bernhard&lt;/p&gt;

&lt;p&gt;
Is this really so crazy? This idea has been used successfully in
the RedHat RedBoot bootloader where a table is maintained in the boot
area if what images are loaded and at what addresses. The user can
then configure RedBoot to boot a particular application. The checksum
informaiton stored is used to validate that application prior to
executing it.&lt;/p&gt;

&lt;p&gt;
Now as it turns out I only want a bootloader and a single app at
this stage, but that may not always be the case.&lt;/p&gt;

&lt;p&gt;
Andy&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/47841?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2007 13:13:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a5252330-11c4-449e-bb20-eceaed993d14</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;I want to use a block of boot flash to act as NV storage for
details about the image&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Now what on earth would you want to go and do &lt;b&gt;that&lt;/b&gt; for?&lt;/p&gt;

&lt;p&gt;
Why put pieces of information that naturally belong together,
since they would only ever be changed simultaneously, into separate
places like that?&lt;/p&gt;

&lt;p&gt;
It&amp;#39;s quite a lot easier to keep that information as a header block
directly in front of the application&amp;#39;s image.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/47842?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2007 12:28:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6519e0ce-c3a1-48d2-a37a-013939ed4d3d</guid><dc:creator>Jason Daniel</dc:creator><description>&lt;p&gt;&lt;p&gt;
Andy,&lt;/p&gt;

&lt;p&gt;
What you do here depends a bit on how big your main application is
going to be. If it just consumes a single main flash bank (32kB),
then you can actually have MORE than one application programmed and
just use some technique to mark which one is valid.&lt;/p&gt;

&lt;p&gt;
What I&amp;#39;d recommend is this: Within your application, make a C code
constant named, say, statusbyte that is initialized to 0xFF. Put this
in its own module and have the linker locate it to a known address.
Use the LSB to indicate whether the application has been programmed
(that is, if it is &amp;quot;0&amp;quot; the application exists, or if it is 1 it does
not). When a flash is blank and all 0xFF&amp;#39;s your startup code will
know that there&amp;#39;s no app there. Have another bit (maybe the MSB)
represent &amp;quot;image bad.&amp;quot; It&amp;#39;s important to have this distinct from the
&amp;quot;image good&amp;quot; bit since without erasing flash, all you can do is set
bits to zero, not back to 1.&lt;/p&gt;

&lt;p&gt;
When you program a flash bank, do your checksums right then and
there and if everything looks ok, program the &amp;quot;application exists&amp;quot;
bit of your statusbyte to a 0 to indicate that the application
exists. If you previously had an application in another bank, then
program ITS statusbyte&amp;#39;s &amp;quot;application bad&amp;quot; bit to 0. This way your
startup code can do the following: 1. Check application area 1&amp;#39;s
&amp;quot;application bad&amp;quot; bit. If it&amp;#39;s zero, check application area 2&amp;#39;s
&amp;quot;application bad bit. If it&amp;#39;s also zero, just stay in the bootloader
and wait for a download.&lt;/p&gt;

&lt;p&gt;
2. If one or more of the areas has an &amp;quot;application bad&amp;quot; bit set to
one (meaning the application might be ok), check the &amp;quot;application
exists&amp;quot; bit to make sure it&amp;#39;s zero. Just run the first image that has
this bit set to zero.&lt;/p&gt;

&lt;p&gt;
I don&amp;#39;t know if that makes any sense, but it&amp;#39;s one way to make
sure that A.)If your IAP fails, the previous version will still be
runnable. B.)You can always recognize the latest successfully
programmed application C.) You won&amp;#39;t be messing around with the boot
area and rendering your system unusable.&lt;/p&gt;

&lt;p&gt;
-Jay D.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/88196?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2007 11:59:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ab2517cf-e40a-4c37-8ee7-8da41bcb5a19</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
the best bootloader schemes of mice and men do make sure that ANY
power glitch at ANY time during upload will not leave a dead
device.&lt;/p&gt;

&lt;p&gt;
The more you include in the boot procedure, the greater the risk /
the more careful you have to code - your choice.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Executing code from RAM (without LX51)</title><link>https://community.arm.com/thread/50461?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2007 11:49:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bf3858d9-fa69-4826-95d1-d4894ce333d5</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;&lt;p&gt;
The app header doesn&amp;#39;t need an entire sector of flash to itself.
Why not just put your header at the start (or end) of the app flash
area? Your boot loader is copying the code from flash to RAM anyway,
so the app code doesn&amp;#39;t have to start at any particular place in
flash; that&amp;#39;s up to your boot loader. The app will be located for its
final address in RAM; its address in flash is irrelevant.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>