Hi,
In the Example_Flash2833x_API.c t states: "Sectors A and D have the example code", but it's not clear which functions are in Section A and which in Section D. Could you please explane where that selection is done? Copy of the code is attached.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
In the Example_Flash2833x_API.c t states: "Sectors A and D have the example code", but it's not clear which functions are in Section A and which in Section D. Could you please explane where that selection is done? Copy of the code is attached.
Arsen N. said:In the Example_Flash2833x_API.c t states: "Sectors A and D have the example code", but it's not clear which functions are in Section A and which in Section D. Could you please explane where that selection is done? Copy of the code is attached.
Allocation is done in the linker command file - Example_Flash28335_API.cmd
In the copy of the example I have, the flash API is in sector D, functions that are copied to RAM (in the ramfuncs section) are in sector D, and the rest of the code is in sector A.
For more information on the linker .cmd file - please see this wiki article:
http://processors.wiki.ti.com/index.php/C28x_Compiler_-_Understanding_Linking
SECTIONS
{
/* Allocate program areas: */
/* The Flash API functions can be grouped together as shown below.
The defined symbols _Flash28_API_LoadStart, _Flash28_API_LoadEnd
and _Flash28_API_RunStart are used to copy the API functions out
of flash memory and into SARAM */
Flash28_API:
{
-lFlash28335_API_V210.lib(.econst)
-lFlash28335_API_V210.lib(.text)
} LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_Flash28_API_LoadStart),
LOAD_END(_Flash28_API_LoadEnd),
RUN_START(_Flash28_API_RunStart),
PAGE = 0
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
csmpasswds : > CSM_PWL PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0
/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.ebss : > RAML4 PAGE = 1
.esysmem : > RAMM1 PAGE = 1
/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHA PAGE = 0
.switch : > FLASHA PAGE = 0
Hi,
In the same sample code the SECTOR directive divides the the memory to 8 equal sections 32KByte each. Is this an arbitrary size and numbet of sections?
Which document describes what section is used for what.
Can I divide the memory to UNEQUAL portions, or have less than 8 sections?
My preference is a small section, <8K, for the code, even smaller one , <1K, for configuration values and the rest dedicated to a large storage area.
here is the SECTOR directive from the example code:
SECTOR Sector[8] = {
(Uint16 *)0x338000,(Uint16 *)0x33FFFF,
(Uint16 *)0x330000,(Uint16 *)0x337FFF,
(Uint16 *)0x328000,(Uint16 *)0x32FFFF,
(Uint16 *)0x320000,(Uint16 *)0x327FFF,
(Uint16 *)0x318000,(Uint16 *)0x31FFFF,
(Uint16 *)0x310000,(Uint16 *)0x317FFF,
(Uint16 *)0x308000,(Uint16 *)0x30FFFF,
(Uint16 *)0x300000,(Uint16 *)0x307FFF
};
Arsen N. said:Hi,
In the same sample code the SECTOR directive divides the the memory to 8 equal sections 32KByte each. Is this an arbitrary size and numbet of sections?
Which document describes what section is used for what.
Can I divide the memory to UNEQUAL portions, or have less than 8 sections?
My preference is a small section, <8K, for the code, even smaller one , <1K, for configuration values and the rest dedicated to a large storage area.
here is the SECTOR directive from the example code:
SECTOR Sector[8] = {
(Uint16 *)0x338000,(Uint16 *)0x33FFFF,
(Uint16 *)0x330000,(Uint16 *)0x337FFF,
(Uint16 *)0x328000,(Uint16 *)0x32FFFF,
(Uint16 *)0x320000,(Uint16 *)0x327FFF,
(Uint16 *)0x318000,(Uint16 *)0x31FFFF,
(Uint16 *)0x310000,(Uint16 *)0x317FFF,
(Uint16 *)0x308000,(Uint16 *)0x30FFFF,
(Uint16 *)0x300000,(Uint16 *)0x307FFF
};
A sector is the smallest amount of flash that can be erased. You can combine sectors in the linker .cmd file to create a larger .text section, for example. But this will not change the physical characteristics.
The sectors and their corresponding memory location is documented in the "flash" section of the data manual for your particular device.
Regards,
Lori
I've created a flash terminology wiki page to capture this information: http://processors.wiki.ti.com/index.php/Flash_101_for_C2000
Regards,
-Lori