you don`t have to write any special code for in-circuit-serial programming. BUT if you want to do in-circuit-serial-debug you probably have to. I don't know about icd-2 but if you do a search in this forum, you'll find at least.

here

here

here's a Melabs link for ICSP