EasyManua.ls Logo

TELINK SEMICONDUCTOR TLSR8232 - SDK Flash Space Allocation

Default Icon
211 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1 32 Ver.1.0.0
static inline void blc_app_loadCustomizedParameters(void);
Flash can be read by using function flash_read_page or pointer, but it can be written via
function flash_write_page” only. Pointer does not support Flash writing operation.
Please note that when Flash is read by pointer, since data read by system bus will be
buffered in cache, MCU may directly use the buffered data as the result of the new
reading operation if the data is not covered by other data and new request of accessing
the data is received. If a user’s code is shown as below:
u8 result;
result = *(volatile u16*)0x40000; // read Flash via pointer
u8 data = 0x5A;
flash_write_page(0x40000, 1, &data );
result = *(volatile u16*)0x40000; // read Flash via pointer
if(result != 0x5A){ ..... }
The original data in Flash 0x40000 is 0xff; the result of the first reading is 0xff; then 0x5A
is written into Flash 0x40000 by the following writing; in theory, the result of the second
reading should be the new value “0x5A”, but the actual result is still the old data buffered
in the cache, i.e. “0xff”. Therefore, in the case of multiple reading of the same address, if
its value will be modified, use the API flash_read_page” rather than pointer to ensure the
result of reading is the new value written into this address rather than the old value in the
cache.
u8 result;
flash_read_page(0x40000, 1, &result ); // read Flash via API
u8 data = 0x5A;
flash_write_page(0x40000, 1, &data );
flash_read_page(0x40000, 1, &result ); // read Flash via API
if(result != 0x5A){ ..... }
2.1.4 SDK Flash Space Allocation
Flash uses a sector (4K bytes) as the basic unit to store information as Flash erases
information based on a sector. (Erase function “flash_erase_sector”). In theory,
information of the same type should be stored in a sector, and information of different
types should be stored in different sectors to avoid unexpected erasing. It’s
recommended to follow this rule to store customized information in Flash.
Two allocation methods of Flash space are supported according to actual Flash sizes:
one is for 512kB Flash (TLSR8232F512), the other is for 128kB Flash (TLSR8232F128).

Table of Contents