writing bank flash 8051

I'm having a hard time writing to flash in different banks. The part I am using is a Cygnal c8051F120 part and the Keil compiler. I have three intel HEX files that I created, for each bank:

MYAPP.H01 (common + bank1) MYAPP.H02 (common + bank2) MYAPP.H03 (common + bank3)

When I download these files using the Cygnal IDE my app runs great. When I download these files into my bootloader via the UART and my bootloader writes the files to flash, the app does not run correctly. So I'm either not erasing banked flash correctly or not writing to banked flash correctly. My bootloader was able to erase and write to flash no problem before I had to implement "banking." Now it isn't working.

I must first erase flash then write each of those files. Below is my erase flash routine. Is this correct? Is it erasing all the banks correctly?

#define APP_LOCATION 0x0C00 #define CODE_PAGE_SIZE 1024 #define NUM_CODE_PAGES 61

//--------------------------------------------------------------------------

--
// erase_flash
//--------------------------------------------------------------------------
Reply to
Steve Connet
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.