Hi,
I am trying to upload application firmware to flash memory using bootloader application. I am having MC9S12XEP100CVL controller.
We have bootloader and application to place in flash memory blocks. Memory mapping of the XEP100 in terms of blocks are mentioned below
Global Address | Logical Address | Block | Size |
0x70_0000 - 0x73_FFFF | C08000 - CFBFFF | B3 | 256K |
0x74_0000 - 0x77_FFFF | D08000 - DFBFFF | B2 | 256K |
0x78_0000 - 0x79_FFFF | E08000 - E7BFFF | B1S | 128K |
0x7A_0000 - 0x7B_FFFF | E88000 - EFBFFF | B1N | 128K |
0x7C_0000 - 0x7F_FFFF | F08000 - FFFF | B0 | 256K |
We want to arrange the memory as shown below. The bootloader code is around 18KB, and user application is around 700KB.
Application Type | Global Address | Logical Address | Description |
User application Start | 0x7FC000 | C000 | ROM_C000 address range assignment for user application |
User application End | 0x7FD7FF | D7FF | ROM_C000 address range assignment for user application |
User application vector Table[Start] | 0x7F7F10 | 7F10 | User application vector table range assignment |
User application vector Table[End] | 0x7F7FFF | 7FFF | User application vector table range assignment |
Bootloader Date Start | 0x7FD800 | D800 | Verification Data Range assignment |
Bootloader Date End | 0x7FD805 | D805 | Verification Data Range assignment |
Bootloader Code start | 0x7FDF00 | DF00 | ROM_C000 address range assignment for bootloader application |
Bootloader code end | 0x7FFEFF | FEFF | ROM_C000 address range assignment for bootloader application |
Bootloader vector Table[Start] | 0x7FFF10 | FF10 | Bootloader vector table Range assignment |
Bootloader vector Table [End] | 0x7FFFFF | FFFF | Bootloader vector table Range assignment |
Memory Arrangement:
Currently Our bootloader application is running in block 0 which performs following application
The code snippets of the .prm file for bootloader which defines the memory assignment is added below.
ROM_4000 = READ_ONLY 0x4000 TO 0x7F0F;
ROM_C000 = READ_ONLY 0xDF00 TO 0xFEFF; [Bootloader Code]
BL_DATA = READ_ONLY 0xD800 TO 0xD805; [Bootloader - Application Verification section]
The Bootloader is running in block 0 [bottom few sectors]. It uses address range [0x7FDF00 - 0x7FFFE0].
The code snippets of the .prm file for user application which defines the memory assignment is added below
/* Non-banked FLASH */
/* Leave space for Vector table from 0x7F10 to 0x7FFF; */
ROM_4000 = READ_ONLY 0x4000 TO 0x7F0F;
/* Leave space for Bootloader from 0xD800 to 0xFFFF */
/* Note: D800 to DBFF reserved for Application Verification info written by bootloader */
ROM_C000 = READ_ONLY 0xC000 TO 0xD7FF;
The S19 file of application includes few of the remaining addresses from the block 0.
Limitation: The issue is XEP100 does not allow to perform any operation like erase and write on the unused flash addresses of particular Block where the code is running.
In our case we are using Block 0[256KB] for bootloader application which uses around 12 sectors [code and verification data] so we are not able to use remaining sectors of block 0 because of above mentioned limitation.
So, one way is to place the user application code in other blocks.
Questions:
1. What all changes we need in prm file for placing bootloader and user application?
2. Using other blocks for running the user application code.
- Can you please share any example code or what all things we need to take care for running user application from different blocks?
3. finding a way to use the remaining block of the block 0.
- Is there any way we can write to unused sectors of block 0 where my bootloader application is running?
Can you please suggest any way to fix these issues?
Please find attached parameter [.prm] files of bootloader and user application
Hi,
As I have writen, the AN4258 can be taken as a development platform where it is explained. Also prinicple when RAM is used and critical part of the flash routine is explained in attached example. Extension of the last principle is explained as a DoOnStack routine. It is up to you which of them you will implement and use.
More was presented in your original question...
Best regards,
Ladislav