I have two pieces of software: the boot code and the application. The boot code executes first. If the application code is present in flash, it loads executes it using a call to bfrom_SpiBoot(). If my application receives a command to restart, it once again calls bfrom_SpiBoot(). I can do that over and over and it works.
If the application receives a command to return execution to the boot code, it issues a software reset and the boot code once again runs (and since it sees that a software reset occurred, it does not execute the application code like it did during a cold boot). I can send the boot code a command to reset (once again using a software reset) over and over and it behaves as I would expect.
However, if I send the application code a command to return to boot code (via software reset), and then send the boot code a command to return to application, which it does using a call to bfrom_SpiBoot(), the application will load and begin to execute, but will completely hang after about 100 us.
Boot --(bfrom_SpiBoot()--> Application --(bfrom_SpiBoot()--> Application ... works
Boot --(bfrom_SpiBoot()--> Application --(SW reset)--> Boot --(SW reset)--> Boot ... works
Boot --(bfrom_SpiBoot()--> Application --(SW reset)--> Boot --(bfrom_SpiBoot()--> Application loads but hangs soon after it starts.
Before the application hangs, I have been able to read the SWRST register -- it is 0, and I also ensure that the watchdog is disabled, although I don't suspect it's a watchdog issue because if it were it would have reset and started the boot code again.
This project uses code built for the BF547 and is running on a BF548 EZ-kit.