Sorry I have not looked at your code at all, but I remember back on getting teensy_loader_cli to work with T4,
we ran into memory issues as well, as the code starts at a very high address...
From...