How to put bootloader in D-flash, meanwhile in booloader configure eeprom?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to put bootloader in D-flash, meanwhile in booloader configure eeprom?

260 Views
459021854
Contributor II

Hi @all experts,

I have a question, please do me a favor.

I want to put my Bootloader code in D-flash(starting adress is 0x1000 0000), Application code in P-flash(starting adress is 0x0000 1000) as in https://www.nxp.com/docs/en/application-note/AN12218.pdf 

pastedImage_6.png

Bootloader's liner file, my MCU is S32k142.

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x10000000, LENGTH = 0x00008000
/* reserve 256-4 = 252KB P-Flash for application*/
App_flash (RX) : ORIGIN = 0x00001000, LENGTH = 0x0003F000
/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFFC000, LENGTH = 0x00004000

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

  Additionally, I also need eeprom function to record some parameters, so I split the D-flash 32k in BOOTLOADER using  FLASH_DRV_DEFlashPartition(&pSSDConfig, 0x02u, 0x0Bu, 0x0u, false, true) in BootLoader. however, when  program flow executes the  FLASH_DRV_DEFlashPartition(&pSSDConfig, 0x02u, 0x0Bu, 0x0u, false, true) . whole D-flash is erased  so  the m_text (RX) : ORIGIN = 0x10000000, LENGTH = 0x00008000  is erased.  bootloader is doomed.

https://www.nxp.com/docs/en/application-note/AN12218.pdfpastedImage_8.pngpastedImage_9.png

so I want to ask how to execute the  FLASH_DRV_DEFlashPartition(&pSSDConfig, 0x02u, 0x0Bu, 0x0u, false, true)  to configure EEPROM without erase bootloader's  m_text (RX) : ORIGIN = 0x10000000, LENGTH = 0x00008000 sector?

thanks.

@#bootloader

0 Kudos
1 Reply

209 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

You can configure partitioning right from the PE Micro debugger in debug configuration. However, it may vary for other programmers/debuggers.

pastedImage_2.png

Or you can use another project which does the partitioning and after that use the Preserve Partitioning for the device option in your bootloader project.

Also, I would like to mention that the partitioning should only be done once during the application lifetime. 

I hope it helps.

Best regards,

Diana

0 Kudos