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

Can't compile ASM generated with SRC option

Hi,

I'm trying to compile a library of rom functions for the DS80C400. The Most of the files compile without a problem.

The ones I do have difficulties with all have inline assembler. Obviously these are all bracketed with the appropriate #pragma.

Now I understand I can generate a .src assembler file with the SRC option.

Thus far I have not been able to assemble one of these generated files. The reason for failure always being :
xxx.SRC(x): error A45: UNDEFINED SYMBOL

The .lst file is telling me what is undefined but beyond be able to add extern declarations which I've tried and don't work I don't know what to do next.

I feel I should have to edit automatically generated files to get them to work - I have done to see how to get things to work, but its a bad way of working and everytime I change the any C and have to regenerate the file I have to start again.

I have to admit this does sound like its going to be one check box somewhere to solve this but I haven't found it in any of the documention so far.

So 1) do I need to go down to generating assembler files?

2) If so how do I resolve the scoping issues?

Cheers

Bernard

  • The .lst file is telling me what is undefined

    But it's not telling us, because you forgot to quote the full error message you found in there, with all the details. Leaving out such potentially crucial details makes it next to impossible to help you.

  • "The ones I do have difficulties with all have inline assembler."

    Very simple answer: Don't use in-line Assembler!
    If you need to write assembly code, then do it directly in an assembler source file - don't bastardise your 'C'!

    "Now I understand I can generate a .src assembler file with the SRC option."

    When using inline assembler, you must convert to .SRC and then assemble the result.
    This means that you lose all your 'C' symbol & debug info - as far as the assembler & linker are concerned, it's just another assembler file.
    Another reason why I say Don't use in-line Assembler!

    "do I need to go down to generating assembler files?"

    Yes - if you insist on doing inline assembler.
    But I say, Don't use in-line Assembler!

  • Don't use inline assembler

    I wish! No choice I'm afraid, the whole point of this library is so it is one place. Basically an interface to the Tini ROM on the DS80C400

  • I managed to sort out one of the problems, not using the SRC option directly, rather just using the generate and compile options from the file dialogs for the particular files - can you tell I'm new to the compiler??

    I thought it was a general problem, hence not including them before. Looks like some/most are SDCC symbols, so I need the Keil equivalents for
    bpx
    _DPS
    _PSW
    _ESP
    _SP
    if anyone happens to know....

    I am having a problem with a couple of user functions which are being called from asm code in a different file to the fn.

  • I wish! No choice I'm afraid, the whole point of this library is so it is one place.
    If your C call the assembly and both are in the same libary the user will not know the difference. He will just link to the C.

    Erik

  • "No choice I'm afraid, the whole point of this library is so it is one place."

    There should be no problem in building a sinlge library from multiple source files?

  • Managed to solve most of the issues other than how to get hold of the sizes of the memory blocks at compilation time. i.e. does the linker provide any symbols for this ?

  • LX51 (part of the PK51 package) provides such symbols. See: A51.PDF (Assembler/Utilities User's Guide), Chapter 9, Tips and Tricks for Program Locating, Segment and Class Information.