receiving different results with devmem.c under gcc and g++

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

romank@randrlabs.com
Location: Oregon
Posts: 12
Joined: Tue Dec 13, 2005 6:50 pm

receiving different results with devmem.c under gcc and g++

Tue Jan 17, 2006 6:21 am

Hi Everyone,
I am stuck. I tried to use mmap to map memory and access such from the userspace. I started getting segmentation faults with g++ compiler. I need to use classes, and I am trying to gain access to the outter memory with the use of mmap.

To try out developed code, I tried to compile devmem2.c with g++.
I end up with a different pointer than with devmem2.c compiled with gcc. I get the result directly from mmap, and the result is different:

silverbeast devmem2 # ./devmem2_native_gcc_c_no_opt_no_volatile 0xfffff600
/dev/mem opened.
Memory mapped at address 0xb7f20000.
Value at address 0xFFFFF600 (0xb7f21800): 0x0
silverbeast devmem2 # ./devmem2_native_gpp_cpp_no_opt_no_volatile 0xfffff600
/dev/mem opened.
Memory mapped at address 0xb7f92000.
Value at address 0xFFFFF600 (0xb7f93800): 0x0


Please help. I already tried volatile and casting my pointers to unsigned long. Right now I am confused.
Roman

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 1 guest