<?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>direct the code to main{} in address 0x0000</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/35489/direct-the-code-to-main-in-address-0x0000</link><description> 
Hi 
i use SW reset command in my code. 
after reset, PC is set to address 0x0000. 
unfortunately at this address i can&amp;#39;t find nor main{} neither JMP to
main. 
which are the tools i can use (startup.a51 or others) in order to
direct the program on address</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/141055?ContentTypeID=1</link><pubDate>Sun, 17 Dec 2017 01:00:11 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:981b68e1-c4dc-4f00-9738-3bb43e498e08</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;the problem with the watchdog mechanism is one can&amp;#39;t make any
action prior the watchdog reset.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Doing other actions in the watchdog ISR is wrong on two counts:
first of all, doing time-consuming things or calling other functions
from inside an 8051 ISR is a fat big no-no. Second, those particular
things you&amp;#39;re talking about are a bad idea to do once a watchdog has
timed out.&lt;/p&gt;

&lt;p&gt;
If the watchdog has to bite, that&amp;#39;s your last and only sign that
your application, and all of its state variables, are seriously
corrupted already. Saving that corrupt state to flash will only make
matters worse, not better. Don&amp;#39;t do that.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/131666?ContentTypeID=1</link><pubDate>Sat, 16 Dec 2017 19:30:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:dd59bb24-c3f5-4e3d-9b72-6950e7835522</guid><dc:creator>M. Sure</dc:creator><description>&lt;p&gt;&lt;p&gt;
thanks for your input.&lt;br /&gt;
when i wrote &amp;quot;i use SW reset command&amp;quot; i set the SW reset bit.&lt;br /&gt;
the problem with the watchdog mechanism is one can&amp;#39;t make any action
prior the watchdog reset.&lt;br /&gt;
in my case i&amp;#39;d like to save some parameters to FLASH prior reset.
that&amp;#39;s why i don&amp;#39;t use it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/129482?ContentTypeID=1</link><pubDate>Sat, 16 Dec 2017 12:08:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:107e27fd-ad66-4510-ae6f-90aac8fd1939</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
SILAB C8051F931 has a software reset bit &lt;b&gt;use it&lt;/b&gt;&lt;br /&gt;
also the chip has a watchdog&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/121242?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 19:05:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d9f70e15-a628-4973-bdb5-d5d30828ec3c</guid><dc:creator>M. Sure</dc:creator><description>&lt;p&gt;&lt;p&gt;
OK&lt;br /&gt;
i got it. i&amp;#39;ll take your advice and try another way around.&lt;br /&gt;
thanks.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/109375?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 13:18:27 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c53b5596-0f53-490c-ac96-810e7029a7b8</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;i use a watchdog, but a tailored one.&lt;/i&gt;&lt;br /&gt;
No, you don&amp;#39;t. That mechanism you describe is not a watchdog. It&amp;#39;s
just timer ISR that does some work. A watchdog is a timer (internal
or external), that upon running out does exactly one thing: cause a
bona fide reset of the CPU.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;from inside the watchdog ISR i call to save to FLASH memory
function (which calls some other functions).&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Do &lt;b&gt;not&lt;/b&gt; call complicated functions from inside an 8051 CPU&amp;#39;s
ISR. That&amp;#39;s almost worse than trying to emulate a reset in SW. If you
have to do it, you still have to be &lt;b&gt;extremely&lt;/b&gt; careful about
how you handle register banks around this.&lt;/p&gt;

&lt;p&gt;
And you really can&amp;#39;t &amp;quot;return&amp;quot; out of an ISR into any kind of SW
reset. You&amp;#39;ll still have the &amp;quot;currently inside interrupt&amp;quot; flag of the
CPU core active. That&amp;#39;s one of those differences between the actual
reset state and what you can reach just by jumping to zero which I
warned you about. One down, countless many to go...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/121237?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 12:32:13 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6df585a9-c8e4-4ef3-b1cc-a2dc15ef3f2c</guid><dc:creator>M. Sure</dc:creator><description>&lt;p&gt;&lt;p&gt;
SILAB C8051F931&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/109373?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 08:05:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:29d285cd-9b50-4d8d-a271-776592cfea2c</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
WHICH CHIP?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/94269?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 19:59:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:14de9dad-4b78-4f5b-b214-50baf677a3b0</guid><dc:creator>M. Sure</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank you Eric and Hans-Bernhard for your replies&lt;br /&gt;
I continued on with my investigation and the issue is a bit more
complicated. Both of you indeed directed to my findings.&lt;br /&gt;
i use a watchdog, but a tailored one. by reaching the time limit of
the watchdog (PCA ISR) i use the watchdog ISR to save RAM data to the
FLASH memory and invoke the SW reset.&lt;br /&gt;
from inside the watchdog ISR i call to save to FLASH memory function
(which calls some other functions).&lt;br /&gt;
when i call this function, for some reason, the SW reset brings the
PC to address 0x0003. if i omit the call to save to FLASH memory
function the SW reset is done properly and brings the PC to address
0x0000.&lt;br /&gt;
i assume this is due to the fact i use different register banks in
the function (and the other functions it calls) and in the ISR.
although i&amp;#39;m not sure why this should afect the SW reset i&amp;#39;ll try to
turn memory save function to be &amp;quot;reentrent&amp;quot;.&lt;br /&gt;
Hans-Bernhard, you mentioned something about differences between SW
reset and HW reset. do you have some tips on that?&lt;br /&gt;
thanks&lt;br /&gt;
M.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/85613?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 12:49:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d0c64e55-fd2c-40ea-809f-75d3af596091</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;i use SW reset command in my code.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
That&amp;#39;s a very common idea, and just as commonly a really bad
one.&lt;/p&gt;

&lt;p&gt;
If you need a reset, do yourself a favour and perform the
&lt;b&gt;real&lt;/b&gt; one, not some cheap knock-off. Jumping to start-of-code
is not a reset; it often doesn&amp;#39;t even come usefully close.&lt;/p&gt;

&lt;p&gt;
The state of just about everything will be different from what it
is when the hardware comes up out of an actual, proper HW reset.
You&amp;#39;ll likely spend more on finding and cleaning up all those
differences than you would on just getting a proper reset to be
executed. Traditionally one just lets the watchdog starve on purpose.
If you don&amp;#39;t have a watchdog, maybe you let this be the lesson that
teaches why that&amp;#39;s a bad idea.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct the code to main{} in address 0x0000</title><link>https://community.arm.com/thread/85612?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 07:11:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b1bc6070-cfec-487c-9b4b-e25122fd0135</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;direct the code to main{} in address 0x0000&lt;/i&gt; makes me assune
you are using &amp;#39;C&amp;#39;&lt;/p&gt;

&lt;p&gt;
startup jumps to autogenerated code that &amp;quot;stuff all variables with
initial values specified&amp;quot; which then jumps to main()&lt;/p&gt;

&lt;p&gt;
if you do not muck around deleting files and stuff this just
works&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>