FILE: flash_kernel_ex3_ldfu.c This file contains the functionality of the Live Device Firmware Update (Live DFU or LDFU) Command and bank selection logic. The command functionality has 1 build configuration for each bank: BANK0_LDFU, BANK1_LDFU, and BANK2_LDFU
For
the BANK0 build configurations, the following steps are taken when the
kernel receives the Live DFU command:
- Read an SCI Boot hex formatted file until
information related to
each block of data remains
- Read and store the revision values of banks
2, 1 and 0 from flash
(B1_REV_ADD: 0x92006, B2_REV_ADD:
0xA2006)
- Erase sectors 2-15 of bank 1 or 2 depending
on the revision number
- Write 64 bits of 'START' value to
B1_START_ADD/B2_START_ADD to indicate
that erasing is done and
programming/verifying is about to start
- Program and verify bank 1/2 by receiving
the SCI boot hex formatted
file one block of data at a time, writing
each byte to flash, and verifying
each byte (the data must not be linked to
an address that is less
than 0x92008/0xA2008
(B1_RESERVED/B2_RESERVED))
- Decrement the revision value of bank 1 or
2
- Write the 'KEY' value to 0x92004/0xA2004
(B1_KEY_ADD/B2_KEY_ADD) and the
revision value of bank 1 to 0x92006
(B1_REV_ADD) or of bank 2 to
0xA2006 (B2_REV_ADD)
- Configure the watchdog for a reset and
enable the watchdog in order
for a reset to occur
For
the BANK1 build configurations, the following steps are taken when the
kernel receives the Live DFU command:
- Read an SCI Boot hex formatted file until
information related to
each block of data remains
- Read and store the revision value of bank
0, 1 and 2 from flash
(B0_REV_ADD: 0x82006, B2_REV_ADD:
0xA2006)
- Erase sectors 2-15 of bank 0 or 2 depending
on the revision number
- Write 64 bits of 'START' value to
B0_START_ADD/B2_START_ADD to indicate that
erasing is done and programming/verifying
is about to start
- Program and verify bank 0/2 by receiving
the SCI boot hex formatted
file one block of data at a time, writing
each byte to flash, and verifying
each byte (the data must not be linked to
an address that is less
than 0x82008/0xA2008
(B0_RESERVED/B2_RESERVED))
- Decrement the revision value of bank 0 or
2
- Write the 'KEY' value to 0x82004/0xA2004
(B0_KEY_ADD/B2_KEY_ADD) and the
revision value of bank 0 to 0x82006
(B0_REV_ADD)or of bank 2 to
0xA2006 (B2_REV_ADD)
- Configure the watchdog for a reset and
enable the watchdog in order
for a reset to occur
For
the BANK2 build configurations, the following steps are taken when the
kernel receives the Live DFU command:
- Read an SCI Boot hex formatted file until
information related to
each block of data remains
- Read and store the revision value of bank
0, 1 and 2 from flash
(B1_REV_ADD: 0x92006)
- Erase sectors 2-15 of bank 0 or 1 depending
on the revision number
- Write 64 bits of 'START' value to
B0_START_ADD/B1_START_ADD to indicate that
erasing is done and programming/verifying
is about to start
- Program and verify bank 0/1 by receiving
the SCI boot hex formatted
file one block of data at a time, writing
each byte to flash, and verifying
each byte (the data must not be linked to
an address that is less
than 0x92008/0xA2008
(B1_RESERVED/B2_RESERVED))
- Decrement the revision value of bank 1 or
2
- Write the 'KEY' value to 0x82004/0xA2004
(B0_KEY_ADD/B2_KEY_ADD) and the
revision value of bank 0 to 0x82006
(B0_REV_ADD)or of bank 2 to
0xA2006 (B2_REV_ADD)
- Configure the watchdog for a reset and
enable the watchdog in order
for a reset to occur
Bank selection logic (bankSelect) is the entry point for the BANK0 build configurations; it is also the first thing to run after a reset occurs. Bank selection logic branches to the most recently programmed bank or to the kernel setup when no banks have been programmed using the Live DFU command. When no banks have been programmed using the Live DFU command, a program must be loaded to bank 1 by using the Live DFU command.
Bank selection logic is located at 0x80000; therefore the device must be configured to boot to flash at 0x80000 for correct functionality.
When running BANK0 configurations, a breakpoint may need to be placed
at the beginning of bankSelect if CCS debug
tools are needed. The breakpoint
may be removed afterwards to prevent the
program from stopping after each update.