Sometimes you want to update code on a UCD3138 family device in a board which has already been calibrated and configured. You want to reprogram part of the data flash, but leave some of the data flash alone. You can define multiple blocks in data flash with defined addresses by changing only one file.
The file you want is the cyclone (or cyclone_64).cmd file.
Normally, we just put everything into a single DFLASH, like this:
-
Define a DFLASH memory space covering the entire DFLASH:
-
DFLASH (RX) : org = 0x00068800, len = 0x00000800
-
-
Set up several spaces in that DFLASH for different things:
-
.dflash : {} > (DFLASH align(32)) //data flash
-
.CONFIG : {} > (DFLASH align(32))
-
.CONFIG_B : {} > (DFLASH align(32))
-
.PASSW : {} > (DFLASH align(32))
-
-
Use pragmas to put values into the proper areas:
-
pragma DATA_SECTION(filter0_pmbus_regs_constants, ".CONFIG")
-
volatile const FILTER_PMBUS_REGS filter0_pmbus_regs_constants = DEFAULT_FILTER_0_PMBUS_REGS;
-
We use volatile to make sure the code reads the constants. Otherwise, the compiler may optimize out the reading of the constants
-
To put the segments in definite spaces, make more DFLASH areas and use them. Suppose you wanted to put the config (calibration) stuff at the beginning of the DFLASH, and needed 2 pages for each (64 bytes)
-
Define 3 DFLASH memory spaces
-
DFLASH_CONFIG (RX):org = 0x00068800, len = 0x00000040
-
DFLASH_CONFIG_B (RX):org = 0x00068840, len = 0x00000040
-
DFLASH (RX) : org = 0x00068800, len = 0x00000800
-
-
Change the statements which define the segments for the compiler:
-
.dflash : {} > (DFLASH align(32)) //data flash
-
.CONFIG : {} > (DFLASH_CONFIG align(32))
-
.CONFIG_B : {} > (DFLASH_CONFIG_B align(32))
-
.PASSW : {} > (DFLASH align(32))
-
The align(32) isn’t really necessary for the config blocks, because they’re already aligned by the start of the blocks
-
-
It’s not necessary to change the pragmas – they are still the same.
-
In the GUI, to avoid changing the calibration (CONFIG) data, use the partial programming to exclude the pages used by the data
-