writing bank flash 8051

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

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
//--------------------------------------------------------------------------
---
//
// This routine erases the all banks, but preserves 0-0C00h because
// that is where this bootloader lives.
//
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline