The understanding of the memory addressing is in understanding of the range of the address and instruction used for addressing. Please look into attached memory map to better understand.
If the offset of the address is between 8000~BFFF the FLASH is accessed for code reading. Address is created by PPAGE_offset. This addressing mode can be used also for data access in the paged flash but it requires more complicated approach so it is better to use global addressing GPAGE_offset for data addressing in the flash. If global addressing instruction is used then offset does not have sense and address is GPAGE_offset offset is from range 0000~FFFF. If you look into the mentioned excel sheet you will recognize offset windows for page mode addressing (column J)
XGATE is visible on short (16bit) addresses in the internal ram. However, there is a part of flash covered by XGATE. What XGATE sees at 800~3FFF, 4000~7FFF the CPU sees at E0B800~E0BFF, E1_8000~E1BFFF using PPAGE_OFFSET addressing mode or 78_0800~78_3FFF, 78_4000~78_7FFF using global addressing mode and instructions.
I have put here a few examples which can help you. Some more can be found at https://community.freescale.com/docs/DOC-95116
Sharing pointers between CPU and XGATE:
In order to share data between XGATE and CPU you have to either use shared variables or you have to perform correct conversions between pointers. We are not allowed to share the pointers between S12CPU and XGATE directly but we can use this workaround:
The 16bit offset of far (global) address on S12CPU is the same as 16bit address on XGATE. So, we can share long int variable that is re-typed to far pointer when used on S12CPU and then we can take the lower part of this variable and re-type it to standard “near” pointer on XGATE core.
A simple example program XET256 - Shared pointers - CW51.zip can be found in attachment.
I hope this helps.
If you see this answer as correct answer please mark it as correct and helpful to help others to find good answers faster. Thank you in advance.
Best Regards, Ladislav