Power up vs /RESET pin reset can be distinguished using PORF bit ( CRGFLG register, CRG module). Power up makes PORF this bit. And you clear it. So immediately after reset
1) you read PORF bit value. '1' means power up reset, '0' - not power up reset.
2) you have to clear PORF bit by writing '1' to it.
COP reset , CME reset and all other resets (/RESET pin reset and power on reset) use 3 different reset vectors. So to make it different, all these 3 vectors should point do different entry points. If you are coding in C then you could write 3 functions (entry points) that could pass different value of reset type to common startup function. Somethink like this:
enum { PONRESET, EXTERNRESET, COPRESET, CMERESET };
mainreset()
{
init_stack_pointer;
// is PORF set?
if(CRGFLG & 0x40) startup(PONRESET);
else startup(EXTERNRESET);
}
copreset()
{
init_stack_pointer;
startup(COPRESET);
}
cmereset()
{
init_stack_pointer;
startup(CMERESET);
}
startup(int resettype)
{
CRGFLG &= 0x40;
...
}
Note that to make CME and COP reset vectors working you should have proper circuit on /RESET pin. See chapter CRG Block User Guide, 5.2 Description of Reset Operation for details. In short, on reset MCU drives /RESET pin low, then, after few cycles, MCU samples /RESET pin to make sure was it external reset or internal reset. So you can't have large cap on /RESET pin. Also you shouldn't use something like DS1813 for brown-out protection. If you do so then MCU will be sort of unable to fetch COP or CME vectors.