My code works fine when I run it freely but I see some odd behavior whenever I connect Lauterbach.
BAM is executed every time the micro is reset. Only exception is when you flash the code using debugger. Lauterbach places you on entry point for the first time. But if you reset micro when lauterbach is connected, BAM is executed.
Address 0xFFFF_FFF8 is last executed instruction. The BAM exits to user code at 0xFFFF_FFF8. The last instruction the BAM executes is a BLR. The link register is pre-loaded with the user application start address.
Please look at the chapter 51 System boot in reference manual.
Retrieving data ...