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

Problem about access variables from assembler in large mode

I define a public variable as pointer array like 'unsigned char idata * OSTsakStackBotton[OS_MAX_TASKS+1];'
And I declare it in asm file as 'EXTRN DATA (OSTsakStackBotton)' and access it in this file.
Everything is all right in the small model.But when I select the large mode without any modification,I get a lot of errors.
*** ERROR L102: EXTERNAL ATTRIBUTE MISMATCH
SYMBOL: OSTSAKSTACKBOTTON
MODULE: .\Os_cpu_a.obj (OS_CPU_A_ASM)
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: OSTSAKSTACKBOTTON
MODULE: .\Os_cpu_a.obj (OS_CPU_A_ASM)
ADDRESS: 04BEH
What is the problem?

  • Everything is all right in the small model.But when I select the large mode without any modification,I get a lot of errors.

    That's because the default memory space for variables in SMALL model is DATA and in LARGE is XDATA.

    Since you declare the variable in assembly as:

    EXTRN DATA (OSTsakStackBotton)

    The linker is generating warnings that the object you are accessing in assembly is not stored at the global variable with the same name created in the C file. And, that's correct because in C OSTsakStackBotton is stored in XDATA but you are accessing it as thought it were in DATA in your assembly routine.

    Jon