Bootloader addresses in Linker File

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

Bootloader addresses in Linker File

Jump to solution
3,150 Views
lakshmi_s
Contributor I

#How does PC fetches Bootloader starting Address

I am creating separate linker file for UDS bootloader and Application code purpose in S32 DS environment.

I am using S32K144 MCU, I wanted to configure my bootloder and application code in P-flash, so i assigned 32kb for bootloader and remaining kb for appplication..

If i assign bootloader memory starting address as 0x00000410 and length = 0x00008410 .After MCU reset the Bootloader firmware should be execute, so how PC can fetch the Bootloader starting address.(Where can i mention the starting address of bootloader?).

boot memory configuration

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00008410

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

app memory configuration

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x0000C410, LENGTH = 0x00020000

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
}khumphriMandarmarc.paquetteRChapman

Tags (1)
0 Kudos
1 Solution
2,872 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

You can look at the serial bootloader AN12218

https://www.nxp.com/docs/en/application-note/AN12218.pdf

https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip

At first about bootloader:

Your boot memory configuration is correct. The bootloader will start right after reset.

The stack pointer and reset vector are expected always at the address 0x0 and 0x4. So, if you didn't move the m_interrupts section you don't need to jump anywhere.

Application:

If we need to place application somewhere into memory we should, also, move the m_interrupts section.

For example:

m_interrupts (RX) : ORIGIN = 0x0000C000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x0000C410, LENGTH = 0x00020000

After that, if we want to run an application we jump to application PC.

You can use the JumpToUserApplication() function located in the main.c of the AN12218.

I believe it helps.

Best regards,

Diana

View solution in original post

0 Kudos
4 Replies
2,873 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

You can look at the serial bootloader AN12218

https://www.nxp.com/docs/en/application-note/AN12218.pdf

https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip

At first about bootloader:

Your boot memory configuration is correct. The bootloader will start right after reset.

The stack pointer and reset vector are expected always at the address 0x0 and 0x4. So, if you didn't move the m_interrupts section you don't need to jump anywhere.

Application:

If we need to place application somewhere into memory we should, also, move the m_interrupts section.

For example:

m_interrupts (RX) : ORIGIN = 0x0000C000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x0000C410, LENGTH = 0x00020000

After that, if we want to run an application we jump to application PC.

You can use the JumpToUserApplication() function located in the main.c of the AN12218.

I believe it helps.

Best regards,

Diana

0 Kudos
2,872 Views
lakshmi_s
Contributor I

Hii

Thank you for your reply ..  It helps me lot.  i have one more doubt do i need give different address for m_data and m_data2 sections in boot memory and application memory

for ex:

boot memory configuration

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00008410

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00008000      <---------------------------

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

 

 

app memory configuration

 

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x0000C000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x0000C400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x0000C410, LENGTH = 0x00020000

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000       <-----------------

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20007000, LENGTH = 0x00007000
}

0 Kudos
2,872 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi,

It depends on your application requirements. For example, if you jump into the application after reset (which is my recommendation) the RAM will be initialized, so, you do not need to have a different address of RAM sections for the bootloader and application.

Best regards, 

Diana

0 Kudos
2,872 Views
lakshmi_s
Contributor I

Hii Diana

I understood your code. I will create linker file according to that. If I get any doubt I will ask your support please help me at that time.

Thank you

0 Kudos