Hi,
I'm try to erase the flash sector with the address 0x1F000.
I call the function:
FlashProtectionSet(0x1F000, FLASH_NO_PROTECT);
and after this:
res = FlashProtectionGet(addr);
and this return FLASH_WRITE_PROTECT.
What I do wrong?
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,
I'm try to erase the flash sector with the address 0x1F000.
I call the function:
FlashProtectionSet(0x1F000, FLASH_NO_PROTECT);
and after this:
res = FlashProtectionGet(addr);
and this return FLASH_WRITE_PROTECT.
What I do wrong?
I see I need to discribe my task more in details. I'm need two non-volotile memory areas in my project that runs on cc1310f128. I've choice two last page in the flash that starts from addresses 0x1e000 and 0x1f000 respectivelly. I've change rfcm_CC1310DK_7XD.icf file this way
define symbol __ICFEDIT_region_ROM_end__ = 0x0001DFFF;// instead 0x0001FFFF
adn left unchanged
place at end of FLASH_region { readonly section .ccfg };
keep { section .ccfg };
And I've really watch in IAR Debugger in memory view at addresss 0x1dfa8 the CCFG section looks just as at address 0x1ffa8 in the end of last page.
I run this code in my project:
for(addr = 0; addr < 0x1FFFF; addr += 4096){
res = FlashProtectionGet(addr);
if(res)
break;
}
And I've watch that this loop stops when the address achives 0x1e000 value.
The question: Wich way cun I to disable write protection on two last pages in flash?
Thanks for sugesstion.
Hi,
the last bytes in the last flash page are reserved for the Customer Configuration (CCFG). This area contains also flash protection configuration. You must ensure that the CCFG area is not overwritten by your application. Otherwise you may lock yourself out of the chip by disabling JTAG and enabling erase and write protect on all pages.
In order to control flash write protection, you may set SET_CCFG_CCFG_PROT_XXX to 0:
/* * ======== ccfg.c ======== * Customer Configuration for CC26xx and CC13xx devices. This file is used to * configure Boot ROM, start-up code, and SW radio behaviour. * * By default, driverlib startup_files/ccfg.c settings are used. However, if * changes are required there are two means to do so: * * 1. Remove this file and copy driverlib's startup_files/ccfg.c file in * its place. Make all changes to the file. Changes made are local to * the project and will not affect other projects. * * 2. Perform changes to driverlib startup_files/ccfg.c file. Changes * made to this file will be applied to all projects. This file must * remain unmodified. */ // Set one of the bits to low to enable write protection on these flash pages. #define SET_CCFG_CCFG_PROT_127_96 0xFFFFFFFF #include <ti/devices/DeviceFamily.h> #include DeviceFamily_constructPath(startup_files/ccfg.c)
In the IAR linker script file, the ccfg section is linked to the end of flash:
/* Place the CCA area at the end of flash */
place at end of FLASH_region { readonly section .ccfg };
keep { section .ccfg };
Flash_region is defined as follows:
/* Define a region for the on-chip flash */ define region FLASH_region = mem:[from ROM_start__ to ROM_end__];
Changing ROM_end__ will also cause the ccfg section being linked to a wrong address. Therefore, you cannot just change ROM_end__, but you have to introduce a new section for ccfg. For instance:
define symbol CCFG_start__ = 0x0001FFA8;
define symbol CCFG_end__ = 0x0001FFFF;
/* Define a region for the ccfg */
define region CCFG_region = mem:[from CCFG_start__ to CCFG_end__];
/* Place the CCA area at the end of flash */
place at end of CCFG_region { readonly section .ccfg };
keep { section .ccfg };
I hope this makes things clear.
Hi,
wording:
I do not recommend to use the last 4 KiB page as a non-volatile data storage, but a page before. Although only few bytes are occupied by the CCFG, you cannot erase the whole page without losing CCFG information. Therefore,