always can't remember this: STM8 STVD under
Near equals 51 xdata.
tiny equals 51 of Idata
http://www.waveshare.net/article/STM8-3-1-10.htm
How to assign a variable to a specified address
Example:
unsigned char temp_a@0x00; Defines an unsigned variable temp_a, forcing its address to 0x00
unsigned char temp_b@0x100; Defines an unsigned variable temp_b, forcing its address to be 0x100
@tiny unsigned char temp_c; Defines an unsigned variable temp_c, which is automatically assigned an address by the compiler in RAM with an address less than 0x100
@near unsigned char temp_d; Defines the unsigned variable temp_d, which is automatically assigned an address by the compiler in RAM with an address greater than 0xFF
Alternatively, a pseudo-directive "pragma" can be used to define a function or variable into a specified section, for example:
#pragma section [name]//define the uninitialized variable defined below into the. Name
Unsigned Char data1;
Unsigned int data2;
...... (any variable that needs to be defined in the. Name section)
......
#pragma section []//Return to the normal section.
Note: pragma pseudo-directives can be used to locate functions, initialize variables, or uninitialized variables. The three are distinguished by different parentheses.
(name): Code
[Name]: Uninitialized variable
{Name}: Initialize variable