On 21. 12. 2012 11:02, feqin fan wrote:
I have found the file, but how the compiler automatically insert into the ASM file?

It doesn't. The idata.o, included in sdcc.lib, is linked with your program by gplink during the linking phase.
Compiling the c program is actually done is several steps:
- preprocessing by sdcpp (input: c source code, output: preprocessed c code; sdcc -E) - code generation by sdcc (input: preprocessed c code, output: asm file; sdcc -S)
- assebling by gpasm (input: asm file, output: object file; sdcc -c)
- linking by gplink (input: object files, output: binary (hex) file)

All steps are performed by the sdcc front end. You can see the steps if you invoke sdcc with -V option.

Borut

I compiled the sdcc in the VS10.0 by myself.
I have read a lot of the source code. So please tell me more details..
And how can I get a right version that can generate the load code(using the idata.c) before startup.

Thank you, very much.


2012/12/21 Borut Ražem <borut.ra...@gmail.com <mailto:borut.ra...@gmail.com>>

    > if have Where is the source code doing this LOAD?
    > if not ,How can i do this?

    See device/lib/pic14/libsdcc/idata.c


    > Another, in SDCC PIC14 the *pic16f887.lib* doing what?
    > and how it come from? how can i compile to get it by myself?
    > What does it contain?

    See device/non-free/lib/pic14/libdev/pic16f887.c

    Borut


    On 21. 12. 2012 08:03, feqin fan wrote:
    Hello,everyone.
    just like the title.
    I write C code like this:
    
------------------------------------------------------------------------------------------
        #include<pic16f887.h>
        unsigned char a[4] = {0x12, 0x13, 0x14, 0x15};

        int main() {
            PORTA = a[2];
            return 0;
        }
    
-------------------------------------------------------------------------------------------
    the generated asmbler file is:
    
-------------------------------------------------------------------------------------------
    ID_a_0    idata
    _a
        db    0x12
        db    0x13
        db    0x14
        db    0x15

    STARTUP    code 0x0000
        nop
        pagesel __sdcc_gsinit_startup
        goto    __sdcc_gsinit_startup

    code_a    code

    _main
        BANKSEL    _a
        MOVF    (_a + 2),W
        BANKSEL    _PORTA
        MOVWF    _PORTA
    ;    .line    1806; "a.c"    return 0;
        MOVLW    0x00
        MOVWF    STK00
        MOVLW    0x00
        RETURN
    ; exit point of _main

        end
    
-------------------------------------------------------------------------------
    in the manual of gputils for the directive IDATA have this "Data
    memory is alllocated and the initialization data is placed in ROM,
        The user must provide the code to load the data into memory"
    so , just like the title can sdcc generate code which can load
    value from ROM(placed for idata directive) to RAM in startup?

    if have Where is the source code doing this LOAD?
    if not ,How can i do this?

    Another, in SDCC PIC14 the *pic16f887.lib* doing what?
    and how it come from? how can i compile to get it by myself?
    What does it contain?

    Thanks, guys..

-- *live long and prosper..*


    
------------------------------------------------------------------------------
    LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
    Remotely access PCs and mobile devices and provide instant support
    Improve your efficiency, and focus on delivering more value-add services
    Discover what IT Professionals Know. Rescue delivers
    http://p.sf.net/sfu/logmein_12329d2d


    _______________________________________________
    Sdcc-user mailing list
    Sdcc-user@lists.sourceforge.net  <mailto:Sdcc-user@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/sdcc-user


    
------------------------------------------------------------------------------
    LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
    Remotely access PCs and mobile devices and provide instant support
    Improve your efficiency, and focus on delivering more value-add
    services
    Discover what IT Professionals Know. Rescue delivers
    http://p.sf.net/sfu/logmein_12329d2d
    _______________________________________________
    Sdcc-user mailing list
    Sdcc-user@lists.sourceforge.net
    <mailto:Sdcc-user@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/sdcc-user




--
*live long and prosper..*


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to