LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-06-2005, 03:35 PM   #1
mani_iips
LQ Newbie
 
Registered: Jul 2005
Location: Indore, India
Posts: 20

Rep: Reputation: 0
GCC Compiler.....


i have tried to work on some hardware related programms on C using gcc... but FAR * is not working there.. its giving some error.
can anyone suggest how to find out the bug and to run that kinda programs?
 
Old 08-06-2005, 04:40 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,533

Rep: Reputation: 148Reputation: 148
When using gcc on Linux you have flat address space and don't need far directive, because any address value is accessible (well...if it exists in your process virtual memory and you have permissions).
 
Old 08-07-2005, 03:46 AM   #3
mani_iips
LQ Newbie
 
Registered: Jul 2005
Location: Indore, India
Posts: 20

Original Poster
Rep: Reputation: 0
thxs for ur reply Mod. but have tried removing "far" too... its not working
i am leaving the peace of code, please let me know whats going wrong in that..

Code:
/*just trying to print alphabet 'A' on screen getting access to video memory directly.*/
//hw_screen.c
main(){
        int i;
        char *vidmem = 0xB8000000;
        for(i=0;i<2999; i =i+2)
                *(vidmem +i) = 'A';
}

on compiling am getting this error...
hw_screen.c: In function `main':
hw_screen.c:3: warning: initialization makes pointer from integer without a cast
 
Old 08-08-2005, 03:31 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,533

Rep: Reputation: 148Reputation: 148
Code:
main(){
    int i;
    char *vidmem = (char *)0xB8000000;
    for(i=0;i<2999; i =i+2)
        *(vidmem +i) = 'A';
}
The cast added removed the warning.

Edit: Probably I don't have to write about it, but you need to check if you're writing to the right address, that you have the right hardware memory etc mapped at that address and so on.

Last edited by Mara; 08-08-2005 at 03:33 PM.
 
Old 08-08-2005, 08:55 PM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,230

Rep: Reputation: 1070Reputation: 1070Reputation: 1070Reputation: 1070Reputation: 1070Reputation: 1070Reputation: 1070Reputation: 1070
Well, these warnings are just that ... a "poor, dumb ol' compiler's" attempt to warn you about what might be a mistake in, or unanticipated consequence of, your code. Like most warnings they are usually incomprehensible in how they are worded, but they're usually prescient.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GCC Compiler rr_rr_29 Linux - Software 2 10-17-2005 04:14 AM
GCC compiler .. pashupathinath Programming 1 10-21-2004 12:20 PM
GCC Compiler HELP Otaking Linux - Newbie 5 04-08-2004 06:17 PM
GCC compiler? Forezt Linux - Newbie 2 11-23-2003 02:07 PM
GCC compiler...? ph0tik Linux - Newbie 4 04-22-2003 03:22 PM


All times are GMT -5. The time now is 10:47 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration