how to do linker setup

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to do linker setup

604 Views
sudhakarp
Contributor V

hi,

i am using FRDMk64, KDS 2.0 and KSDK 1.1.0 example.

     actually my code should work following method.

just assume 2 example code( hello word and timer example code).

this both code will have separate linker file setting, i want to jumb from hello word example to timer example code.

so for that which type of linker file setting i want to do..?

i tried following setting but its not working..

hello example linker setting:

MEMORY

{

  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400

  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010

  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0000FBF0

  m_data                (RW)  : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000

  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00030000

}

timer example linker setting:

MEMORY

{

  m_interrupts          (RX)  : ORIGIN = 0x0000FBF0, LENGTH = 0x00000400

  m_flash_config        (RX)  : ORIGIN = 0x0000FFF0, LENGTH = 0x00000010

  m_text                (RX)  : ORIGIN = 0x00010000, LENGTH = 0x000EFBF0

  m_data                (RW)  : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000

  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00030000

}

in hello example code i am calling following function for jump into timer ex.code

static void (*appl_ptr)( void ) = 0xFBF0;        

i am caling appl_ptr();

i am loading both code throught PE multilink device. but nothing was working. hello example also not working.

can you give some idea.

regards,

sudhakar p

0 Kudos
1 Reply

343 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Sudhakar,

I did something similar in CW10. I configured linker files as below:

MEMORY

{

  m_interrupts    (rx) : ORIGIN = 0x00000000, LENGTH = 0x1E0

  m_cfmprotrom     (rx) : ORIGIN = 0x00000400, LENGTH = 0x10

  m_text         (rx) : ORIGIN = 0x00000800, LENGTH = 0xA000 - 0x800        /*Bootloader space*/

  my_text         (rx) : ORIGIN = 0x0000A000, LENGTH = 0x7F800 - 0xA000    /*Application space */

  m_data        (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 64K                /* Lower SRAM */

  m_data2       (rwx) : ORIGIN = 0x20000000, LENGTH = 64K                /* Upper SRAM */

}

MEMORY

{

  m_interrupts    (rx) : ORIGIN = 0x0000A000, LENGTH = 0x1E0

  m_cfmprotrom     (rx) : ORIGIN = 0x0000A400, LENGTH = 0x10

  m_text         (rx) : ORIGIN = 0x0000A800, LENGTH = 512K - 0x800 - 0xA000

  m_data        (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 64K                /* Lower SRAM */

  m_data2       (rwx) : ORIGIN = 0x20000000, LENGTH = 64K                /* Upper SRAM */

}

Then I looked for the entry point address of application 2 in .map file.

.text.__thumb_startup

                0x0000a87c       0x30 ./Project_Settings/Startup_Code/__arm_start.o

                0x0000a87c                __thumb_startup

Finally I used the instruction below to jump to the second application.

asm("bl 0x0000a87c"); //Jump to entry point in application 2

I hope this helps,.

Regards,

Carlos

0 Kudos