Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Concerto ARM Application Start from Bootloader

$
0
0

Hello,

since I'm able now to program my application to FLASH from an bootloader project I want to know how to start the application from it.

The bootloader resides in different sections than the application and will be started after Boot ROM reset: the reset vector 0x200030 will jump to the_c_int00 of the bootloader application. This checks if new software has to be flashed and so on...

Finally I want to start my application. Which is the best way? After searching the forum and scanning app notes I figured out that it should be done with a jump rather than a SW-reset and branch. How should such a jump look like? What do I have to take care of?

I already modified the linke cmd file of the application

MEMORY
{
/* FLASH */
    CSM_ECSL_Z1     : origin = 0x00200000, length = 0x0024
    CSM_RSVD_Z1     : origin = 0x00200024, length = 0x000C
    INTVECS (RX)    : origin = 0x00220000, length = 0x01B0
    STARTCODE (RX)  : origin = 0x00220200, length = 0x0008
    FLASH (RX)      : origin = 0x00220210, length = 0x50000
    CSM_RSVD_Z2     : origin = 0x0027FF00, length = 0x00DC
    CSM_ECSL_Z2     : origin = 0x0027FFDC, length = 0x0024
...
}

SECTIONS
{
    .startcode: >> STARTCODE
    .intvecs:   >  INTVECS
    .text   :   >> FLASH
...
}

and moved the startup routine to the .startcode section in the file 'startup_ccs.c':

#pragma CODE_SECTION(ResetISR, ".startcode")
//#pragma CODE_SECTION(ResetISR, ".resetisr")
void
ResetISR(void)
{
  // Jump to the CCS C Initialization Routine.
  __asm("    .global _c_int00\n"
        "    b.w     _c_int00");
}

In my bootlader I call a function StartApplication() which jumps to this startcode.

static void JumpStackPointerToAddress(UINT32 address)
{
__asm(" mov sp, r0\n"   // sp is now *address
      " bx r0\n" );     // jump to *address
}

static void StartApplication(void)
{
  IntMasterDisable(); // disable interrupts
  HWREG(NVIC_VTABLE) = 0x220000; // redirect the vector table
  JumpStackPointerToAddress(0x220200); // jump to startup code of application
}

The jump works but the program hangs in a while loop (the map file of the application tells me that the PC is somewhere within the memcpy function).

My questions:

  1. Where can I find the startup code (_c_int00), is it the correct entry point for starting the application?
  2. Should other CPU registers be set to default values?

Maybe there is a better way to handle this?

Best regards,
Stefan


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>