I'm using S12G and S12VR series MCU and I wrote an own bootloder for these device.
Everything works smootly, but I don't want to build all the time separately for different memory sized device.
Currently I determine the real P-Flash size by initiate a Section erase from Global address 0x0_8000 to 0x3_F7FF in 16 KBytes step.(Boot loader part is not erased !)
After issuing the command I check the ACCERR bit in FSTAT to detemine the validity of the address.
This method is failed on the S9S12G48 device because the command is accepted without error for address range 0x3_0000-0x3_3FFF which is valid for S9S12G64+ device.
Any other tip for determine the memory size at runtime ?