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
Bootloader's liner file, my MCU is S32k142.
/* 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.
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?
You can configure partitioning right from the PE Micro debugger in debug configuration. However, it may vary for other programmers/debuggers.
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.