我这样定义设备访问
volatile struct mydevice * const dev = (struct mydevice *)MY_DEVICE_ADDRESS;
我已经使用
@ volatile dev->somereg reads somereg_read writes somereg_write;
现在的问题是,当我启用 RTE 检查时,无法证明生成的有效性检查
/*@ assert rte: mem_access: \valid(dev->somereg); */
有什么方法可以注释我的代码,以使 MY_DEVICE_ADDRESS 到 MY_DEVICE_ADDRESS+sizeof(struct mydevice) 被认为是有效的?
编辑:这是一个不起作用的尝试
#include <stdint.h>
#define MY_DEVICE_ADDRESS (0x80000000)
struct mydevice {
uint32_t somereg;
uint32_t someotherreg;
};
volatile struct mydevice * const dev = (struct mydevice *)MY_DEVICE_ADDRESS;
/*@ axiomatic Physical_Memory {
axiom Dev: \valid((struct mydevice*)MY_DEVICE_ADDRESS);
} */
int main(int argc, const char *argv[]) {
//@ assert \valid(dev);
//@ assert \false;
return 0;
}
运行
frama-c-wp -wp-rte -wp-init-const -wp-model 类型化 test.c