ST Visual Develop只是ST 8bit单片机的通用集成开发环境,仅自带汇编编译器。COSMIC是其支持外部扩展的C编译器的一种。
上面我说的是绝对地址的一种申明方式,其实你已经在使用这种方式,不过是没注意而已。在COSMIC的C Language Manual文档里有这样的说明的。
Absolute Addressing
The COSMIC compiler allows an object to be declared along with its
address when it is known at compile time (I/O registers). The address is
specified just after the declaration and is replacing the initialization
part. It is prefixed by the @ character:
volatile char PORTB @0x10;
Such a declaration is in fact equivalent to an extern declaration so it is
not possible to initialize such a variable. This can also be applied to a
function declaration if such a function already exists at a known address
in the application. This cannot be used to locate a function defined in
the application at a predefined address.
A bit variable can also be declared at an absolute location by defining
its byte address followed by a colon character and the bit position:
_Bool PB3 @0x10:3
or, if the variable PORTB has been previously declared as before:
_Bool PB3 @PORTB:3