Limit image size we try to flash to memory size

This is important as without this check, the VLA in the
next scope can try to allocate a massive area for a big
file and will overrun the stack.
Add configuration to gpios (interrupt enable, in/out, etc)
Add WFI support; fix some bugs in 373/vectors.s