Hello,
I am using Keil for development with my FRDM-LKL03Z board. It has the PKL03Z32VFK4 on-board. I would like to segment the flash memory into 3 parts:
1. For storing application(user) data. 2. For storing incoming FW binary for FOTA update. 3. For a custom bootloader. 4. For the running code.
Could you please help me with a template scatter file with these 4 segments defined? I will then modify the bounds of each section to suit my needs.
Thanks very much!
If you enter two separte flash address ranges using the IDE, then the IDE can generate a scatter file with two regions. Then follow the pattern and add two more regions.
You'd want to create this as multiple projects, defining the region used by each and not allowing the linker to overlap them. Unless you have a lot of skill, I wouldn't tackle this as a single scatter file for all the above listed uses.
You can use the IROMx areas in the Target configuration to create multiple LOAD REGIONS
I think they have to co-exist as one project. Only the application and bootloader can be different projects but the other two have to co-exist, at-least with the application code.
The application data doesn't need a separate partition, unless you have some logic to reconfiguring individual data values.
So one region for boot loader. One region for application. And maybe a third region for a downloaded copy. But this doesn't need to be a separate region in the Scatter file unless you plan to build your application in two versions for running at 2 different load addresses.
If all you need is a region for temporary storage of a new application, then it's enough to use the settings in the dialog to "hide" a large enough part of the flash. Then the application can use direct IAP commands to store the downloaded binary to this region. And then set a flag and reboot to request the boot loader to copy the fully retrieved new application image into the normal application flash region.
But as noted - boot loader and application should be built as individual projects or at least as individual targets, to make sure they are independent.