试图从指针读取硬件内存? [英] Trying to read hardware memory from pointer?

查看:57
本文介绍了试图从指针读取硬件内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我试图在嵌入式系统中读取位置0xFFF0 000E处的一个字节。


我将指针转换为int ,然后尝试填写上面的地址,然后

参考什么位置?不会编译,尝试了许多不同的

变种;任何想法都赞赏。

Hi,

Am trying to read one byte at location 0xFFF0 000E in an embedded system.

I cast a pointer to int, then try to stuff the above address in, then
reference whats at the location? wont compile, tried many different
variations of this; any ideas appreciated.

推荐答案

Brad写道:


我试图阅读嵌入式系统中位置0xFFF0 000E处的一个字节。

我将指针转换为int,然后尝试将上述地址填入,然后
引用该位置的什么内容?不会编译,尝试过许多不同的变化;任何想法都赞赏。
Hi,

Am trying to read one byte at location 0xFFF0 000E in an embedded system.

I cast a pointer to int, then try to stuff the above address in, then
reference whats at the location? wont compile, tried many different
variations of this; any ideas appreciated.



向我们展示你的尝试,你的意思是什么?把指针指向int?

-

Ian Collins。


Show us what you have tried, what do you mean by "cast a pointer to int"?
--
Ian Collins.


" Brad" < RO ********* @ verizon.net>写道:
"Brad" <ro*********@verizon.net> writes:


我试图在嵌入式系统中的0xFFF0 000E处读取一个字节。

我投了一个指向int的指针,然后尝试将上面的地址填入,然后
参考什么位置?不会编译,尝试过许多不同的变化;任何想法都赞赏。
Hi,

Am trying to read one byte at location 0xFFF0 000E in an embedded system.

I cast a pointer to int, then try to stuff the above address in, then
reference whats at the location? wont compile, tried many different
variations of this; any ideas appreciated.




unsigned char data = *((unsigned char *)0xFFF0000E);


-


John Devereux



unsigned char data = *((unsigned char*)0xFFF0000E);

--

John Devereux


John Devereux写道:
John Devereux wrote:
" Brad" < RO ********* @ verizon.net>写道:
"Brad" <ro*********@verizon.net> writes:


我试图在嵌入式系统中的0xFFF0 000E处读取一个字节。

我投了一个指向int的指针,然后尝试将上面的地址填入,然后
参考什么位置?不会编译,尝试过许多不同的变化;任何想法都赞赏。
Hi,

Am trying to read one byte at location 0xFFF0 000E in an embedded system.

I cast a pointer to int, then try to stuff the above address in, then
reference whats at the location? wont compile, tried many different
variations of this; any ideas appreciated.



unsigned char data = *((unsigned char *)0xFFF0000E);



unsigned char data = *((unsigned char*)0xFFF0000E);




我不喜欢看到此代码中的任何编译错误。它是否在全球范围内

任何机会?

发布完整的(最少可编辑的)代码。


考虑添加volatile到类型转换。这可能无法解决您当前的问题。



I don''t see any compilation error in this code. Is it in global scope
by any chance?
Post the complete (minimal compilable) code.

Consider adding volatile to the typecast. This may not solve your
current problem though.


这篇关于试图从指针读取硬件内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆