I have a home brewed BF592 board with a standard M25P16 flash, which I can boot from and read and write as I please.
I use it in the firmware for calibration storage and I have full access to the flash, which is the boot flash on SPI1 and SPI1_SSEL5 (PG11).
This is apparently the standard boot mode and the program comes up perfectly and runs.
In the program, I have an option for booting into an alternate calibration software, which resides in sector 1 of the flash,
from 0x10000. For that purpose, I have attempted an experiment, rebooting the same program using the bfrom_SpiBoot call.
I am calling thus:
|bfrom_SpiBoot(0x00000000,BFLAG_PERIPHERAL | BFLAG_FASTREAD | BFLAG_TYPE3 | 6,0,NULL);|
I have tried BFLAG_TYPE4, slower speed, verified EVT1 is pointing where it should be, that all devices are powered up.
I have tried issuing CLI before the call.
I have tried
*pUART0_IER=0; *pSIC_IMASK0=0; *pDMA7_CONFIG=0; *pDMA8_CONFIG=0;
I have verified that FER registers are good for SPI1, but that SPI1_SSEL5 (PG11) is set as GPIO
I am using DMA7 and 8 with the UART in the app, everything else is bitbanged with no interrupts
enabled. I use bfrom_SysControl to set the PLL.
I can access the flash perfectly from my program, exactly as it is used by the bootloader.
If I execute from the IDE, I get
|Target halted due to software breakpoint but no breakpoint found at address: 0xef0005fa|
Possible reasons are:
1.An embedded breakpoint (EMUEXCPT instruction) in the code
2.A breakpoint is placed at the last instruction of a do() loop
So I load the program into the flash and power cycle. It starts up.
I send the command over the UART that calls bfrom_SpiBoot() - and the program crashes.
Why does my program crash?
Also, is there a way to boot into UART mode? I suspect a combination of SYSCR and SWRST writes ought to do it.
Any recipes out there to boot from UART?