LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   GCC Compiler..... (https://www.linuxquestions.org/questions/linux-newbie-8/gcc-compiler-350644/)

mani_iips 08-06-2005 03:35 PM

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?

Mara 08-06-2005 04:40 PM

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).

mani_iips 08-07-2005 03:46 AM

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


Mara 08-08-2005 03:31 PM

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.

sundialsvcs 08-08-2005 08:55 PM

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.


All times are GMT -5. The time now is 12:49 PM.