
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
25
Ver.1.0.0
By default, the size of stack used by SDK library does not exceed 256 bytes.
However, since the size of used stack depends on the deepest stack address, the
stack’s final size is related to users’ upper-layer program design. Any case which
causes deep stack, e.g. a complex recursive function is called, or a large local array
variable is used in a function, will increase the final size of the stack.
When large area of SRAM is used, users need to know the size of the stack used by
program. This cannot be obtained by analyzing list files. Users can only run actual
product application with all of the code which may use deep stack being executed,
then reset MCU and read SRAM space to determine the size of used stack.
“unused area” in SRAM is the space left from deepest stack address and bss ending
address. This area should exist to ensure non-overlap between stack and bss;
otherwise it indicates SRAM size is not enough.
“bss” ending address can be obtained via the list file, thus the maximum size for
stack is determined. Users need to analyze whether this space is enough for stack
usage. Please refer to section 2.1.2.2 for analysis method.
5) text
“text” is a part of Flash firmware. Functions with “_attribute_ram_code_” in firmware
will be compiled as “ram_code”, while other functions without this keyword will be
compiled as “text”.
“text” occupies the maximum space of Firmware, which largely exceeds SRAM size
generally. Therefore, the code needs to be executed after it is loaded into cache by
cache buffer function.
6) rodata/data init value
In Firmware except
“vector”, “ram_code” and “text”, there are “rodata” and “data
initial value”.
“rodata” is read-only data in firmware, i.e. variables with keyword “const”, such as
ATT table in Slave:
const
attribute_t
my_Attributes[] = ……
Users can see the
“my_Attributes” is within the “rodata” by checking the
corresponding list file.
As introduced above,
“data” is initialized global variables in Firmware, e.g.:
int testValue = 0x1234;
The compiler will store the initial value
“0x1234” in “data initial value”. When the
bootloader (cstartup_826x.s) is executed, this initial value will be copied to memory
address corresponding to “testValue”.
2.1.2.2 list File Analysis Demo
“5316_ble_remote” is taken as an example to illustrate SRAM and Flash address space
allocation (please refer to
). Based on the understanding of this demo, users
can analyze SRAM and Flash space allocation of their own programs.
The bin file and list file of this demo are
available under the directory “SDK” -> “Demo” ->
“list file analyze”. Information of SRAM space allocation can be analyzed from the
“5316_ble_remote.lst” file.