<?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>Problem with own bootloader / its application startup</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/23837/problem-with-own-bootloader-its-application-startup</link><description> 
Hi all 

 
I am having problems with application startup. My USB based
bootloader needs to start the &amp;quot;real&amp;quot; application if no USB is
present. So I got two separate programs in flash residing on
different locations. Bootloader starting at 0 (with flash</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/142246?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2009 08:55:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a7d1dea5-214b-4280-8091-63a01d9eb624</guid><dc:creator>Uli Behrenbeck</dc:creator><description>&lt;p&gt;&lt;p&gt;
Forgot: this &amp;quot;effect&amp;quot; does NOT happen if in debugger;)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/139080?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2009 08:54:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2c11577c-2cb7-4df8-95ae-ab39e46c55f4</guid><dc:creator>Uli Behrenbeck</dc:creator><description>&lt;p&gt;&lt;p&gt;
COOL - I finally got it.&lt;/p&gt;

&lt;p&gt;
Decided to go the hard way and walk the entire startup (assembler
ad my own &amp;#39;C&amp;#39; stuff) along with the debugger&lt;/p&gt;

&lt;p&gt;
1) USB Bootcode sets all PINSELS to 0 except for the few needed
for USB&lt;/p&gt;

&lt;p&gt;
2) Target application resets all PINSELS to 0 to start with &amp;quot;a
clean CPU&amp;quot; and then adjusts all values as needed. (USB is only used
for firmware upgrades, so appliations doesn&amp;#39;t need it)&lt;/p&gt;

&lt;p&gt;
the bad statement is&lt;/p&gt;

&lt;p&gt;
PINSEL1 = 0; (this would reset some USB/port pins)&lt;/p&gt;

&lt;p&gt;
replaced it by&lt;/p&gt;

&lt;p&gt;
PINSEL = 0x14000000; (thus keeping the USB fxns of the pins) and
the app runs as expected.&lt;/p&gt;

&lt;p&gt;
damn crazy !&lt;/p&gt;

&lt;p&gt;
is that &amp;quot;feature&amp;quot; documented somewhere ?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/135706?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2009 08:05:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:928f3f32-f50a-49fa-9f64-3b9264d58959</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
provide details please: when does it crash, and how.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/125322?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2009 08:03:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:22e27e4b-e609-46ae-99dd-3cb31d8fa3fd</guid><dc:creator>Uli Behrenbeck</dc:creator><description>&lt;p&gt;&lt;p&gt;
hey all again ..&lt;/p&gt;

&lt;p&gt;
NO IDEAS ? PLEASE ...&lt;/p&gt;

&lt;p&gt;
the job seems so simple but my target crashes and crashes.&lt;/p&gt;

&lt;p&gt;
Double-checked several times without result:&lt;/p&gt;

&lt;p&gt;
Bootloader leaves its code in supervisor mode, interrupts off, all
VIC IRQ disabled&lt;br /&gt;
jumping to 0x4000 (where target was loaded to properly)&lt;/p&gt;

&lt;p&gt;
target code is really there and operation starts in the usual way
by executing the target startup code INCLUDING copying and remapping
of the 64 b vector area.&lt;/p&gt;

&lt;p&gt;
the SAME target code works fine if started by debugger. what else
might be wrong ?&lt;/p&gt;

&lt;p&gt;
many thanks in advance&lt;br /&gt;
Uli B.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/118951?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2009 02:12:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1cca9ec3-a4e9-49ee-900c-fb4c0a0fba3f</guid><dc:creator>Uli Behrenbeck</dc:creator><description>&lt;p&gt;&lt;p&gt;
If I manually (by debugger) set PC to 0x4000, the main application
runs well, so I think my remapping stuff should be fine ;)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/101722?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2009 01:56:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5827d39b-085b-4053-ab1b-19ed3509b159</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
Ulrich,&lt;br /&gt;
the latest keil startup file for the LPC2400 family supports
remapping of the vector table. have a look at the files provided by
MDK 3.40, for example. either way you can always copy the vectors
your self (64 bytes to address 0x40000000), not forgetting to set
MEMMAP to 2 and disabling interrupts.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/77282?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2009 01:13:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6ca9081c-dc81-4d07-907d-7d1990068b0f</guid><dc:creator>Uli Behrenbeck</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks Tamir, but ..&lt;/p&gt;

&lt;p&gt;
if you read the OP , I stated there that the applications works
well, if started directly, thus the remapping should be OK and yes,
supervisor mode is set&lt;/p&gt;

&lt;p&gt;
So the only thing left is that IRQS are left turned on. Will try
that and turn them off&lt;/p&gt;

&lt;p&gt;
btw, does the Keil startup code really work for remapping? I can
neither see how the original vector set is being copied to RAM and
how the first 64 bytes are being held free from normal program usage
only by setting REMAP etc.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/55659?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2009 00:27:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:83995d18-d8bc-43cb-849b-75ab45356b29</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
and don&amp;#39;t forget to switch your processor to supervisor mode
before jumping to application, so that your stacks are be set
correctly, here using a SWI function:&lt;/p&gt;

&lt;pre&gt;
void __swi(0) execute_user_code(void);
void __SWI_0                               (void)
{
        void             (*user_code_entry)(void);
        unsigned int l_interrupts = VICIntEnable ;

        // disable interurpts as the firmware is going to remap interrupts
        disable_interrupts(l_interrupts) ;

        // vector to firmware code
    user_code_entry = (void (*)(void))USER_FLASH_START;
    user_code_entry();
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/55657?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2009 00:26:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:574aaa6f-f333-481c-ad4d-d0b46ba19175</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
paste this into your ASM tab (&amp;quot;Define&amp;quot; text box) or the
application:&lt;/p&gt;

&lt;pre&gt;
RAM_INTVEC REMAP RAM_MODE
&lt;/pre&gt;

&lt;p&gt;
and you should be ok!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with own bootloader / its application startup</title><link>https://community.arm.com/thread/55656?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2009 00:24:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9abb8f8b-4f01-47ad-89e5-7d411ffaf7ef</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
did you remap your interrupt vectors...?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>