This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

including assembler file into C project

Hi all,
I have to include an ASM file into my C project, this ASM file cannot be modified since it is also a part of another project using this same file.

the ASM file is asm_inc.h and contains only some defines :

FW_VERSION EQU 0
FW_SUB_VERSION EQU 9
HW_VERSION EQU 1

I need to use these defines into a C table, defined as follow :

unsigned char code identity[] = {
FW_VERSION,FW_SUB_VERSION,HW_VERSION };

The problem is that I cannot see these defines from my C file :

error C202: 'FW_VERSION': undefined identifier
error C202: 'FW_SUB_VERSION': undefined identifier
error C202: 'HW_VERSION': undefined identifier

I've tried to include this asm file directly into my C file with no success

How can I include this ASM definitions into my C file ?

thanks to all
J

Parents
  • When declaring the array in assembler I get memory overlap issues :

    C declaration using the BL51 locate directive doenst produce these memory overlaps :

    EXEMPLE 1 : C DECLARATION
    *************************

    header file is :
    ----------------

    #define FW_VERSION 0
    #define FW_SUB_VERSION 9

    C file is :
    -----------

    unsigned char code identity[] = {
    FW_VERSION,FW_SUB_VERSION};

    then I use ?CO?IDENTITY(00080h)
    in project -> OPTION -> BL51 LOCATE -> CODE
    in order to compile identity[] at fixed code address 0x0080

    >> This doesnt produce any memory overlap and works fine

    EXEMPLE 2 : ASM DECLARATION
    ***************************

    ASM file is :
    -------------
    FW_VERSION EQU 0
    FW_SUB_VERSION EQU 9

    public identity
    ORG 80H
    identity: DB FW_VERSION,FW_SUB_VERSION
    END

    C file is :
    -----------

    extern unsigned char code identity[];

    This second example results in memory overlaps, this is what I do not understand since the BL51 locate directive used with the 'C' declarartion method doesnt produce this overlaps and should do the same thing ...

    Any idea greatly appreciated
    thanks

Reply
  • When declaring the array in assembler I get memory overlap issues :

    C declaration using the BL51 locate directive doenst produce these memory overlaps :

    EXEMPLE 1 : C DECLARATION
    *************************

    header file is :
    ----------------

    #define FW_VERSION 0
    #define FW_SUB_VERSION 9

    C file is :
    -----------

    unsigned char code identity[] = {
    FW_VERSION,FW_SUB_VERSION};

    then I use ?CO?IDENTITY(00080h)
    in project -> OPTION -> BL51 LOCATE -> CODE
    in order to compile identity[] at fixed code address 0x0080

    >> This doesnt produce any memory overlap and works fine

    EXEMPLE 2 : ASM DECLARATION
    ***************************

    ASM file is :
    -------------
    FW_VERSION EQU 0
    FW_SUB_VERSION EQU 9

    public identity
    ORG 80H
    identity: DB FW_VERSION,FW_SUB_VERSION
    END

    C file is :
    -----------

    extern unsigned char code identity[];

    This second example results in memory overlaps, this is what I do not understand since the BL51 locate directive used with the 'C' declarartion method doesnt produce this overlaps and should do the same thing ...

    Any idea greatly appreciated
    thanks

Children