Fix crash for SAMD and add support for SAMD21J18A.

This fork request is supposed to fix two issues:
1) Add support for SAMD21J18A chips with revision=0x1
2) Fix a crash when an applet is attempted to be written to address 0x804000, which lies in flash memory space. To my understanding the user space address should be in SRAM.