Fix signedness on counters that cause infinite loops, and added mspgcc interrupt attributes to ISRs.

Please verify that the __attribute__() parts don't interfere with CSS/IAR, as I don't have them and can't verify.