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

compile two assembly func

Hi all,
I am stuck up with an issue in Keil uvision 3

I am trying to create a project with combination of C source and assembly source files.

I am trying to write all the basic functions like delay, lcd driver etc, in different assembly files eg. delay.a51 ,lcd.a51

I include these A51 file in project and call these functions in Main.c file. Now the problem is I am successfully calling delay function, but i am not able to call lcd functions, rather gives me a warning saying

assembling lcd_driver.a51...
linking...
*** WARNING L7: MODULE NAME NOT UNIQUE
    MODULE:  lcd_driver.obj (ASM_COD)
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  _LCD_INTIALISE
    MODULE:  SPI_Protocol_v2.obj (SPI_PROTOCOL_V2)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  _LCD_INTIALISE
    MODULE:  SPI_Protocol_v2.obj (SPI_PROTOCOL_V2)
    ADDRESS: 019AH

0 Error(s), 3 Warning(s).

The M51 file says

BL51 BANKED LINKER/LOCATER V6.11, INVOKED BY:
G:\KEIL\C51\BIN\BL51.EXE SPI_Protocol_v2.obj, delay_ms.obj, lcd_driver.obj TO SPI_Protocol RAMSIZE (256)


MEMORY MODEL: SMALL


INPUT MODULES INCLUDED:
  SPI_Protocol_v2.obj (SPI_PROTOCOL_V2)
  delay_ms.obj (ASM_COD)
  G:\KEIL\C51\LIB\C51S.LIB (?C_STARTUP)
  G:\KEIL\C51\LIB\C51S.LIB (?C?SIDIV)
  G:\KEIL\C51\LIB\C51S.LIB (?C?LLDIDATA)
  G:\KEIL\C51\LIB\C51S.LIB (?C?LLDIDATA0)
  G:\KEIL\C51\LIB\C51S.LIB (?C?LSTIDATA)
  G:\KEIL\C51\LIB\C51S.LIB (?C?LSTKIDATA)
  G:\KEIL\C51\LIB\C51S.LIB (?C?LROL)
  G:\KEIL\C51\LIB\C51S.LIB (?C?UIDIV)

It looks like it is ignoring lcd_driver.obj

What am i doing wrong ??

Parents
  • I assume,I would save some memory, by writing these drivers in assembly. Moreover I feel comfortable handling the ports in Assembly than in C.

    OK For *** WARNING L7: MODULE NAME NOT UNIQUE, the manual recommends to rename the file. I did, I renamed it from lcd.a51 to lcd_driver.a51. But no luck.

    can you please tell me How can i assemble two assembly files in one Project.. do i need to have some extra setting for that ?

    regards,
    Kume

Reply
  • I assume,I would save some memory, by writing these drivers in assembly. Moreover I feel comfortable handling the ports in Assembly than in C.

    OK For *** WARNING L7: MODULE NAME NOT UNIQUE, the manual recommends to rename the file. I did, I renamed it from lcd.a51 to lcd_driver.a51. But no luck.

    can you please tell me How can i assemble two assembly files in one Project.. do i need to have some extra setting for that ?

    regards,
    Kume

Children
  • I got it, My mistake again.

    I have been using the same Module name ASM_COD for both assembly files. a Typical example of a copy paste error.

    Thanks Andrew !! Your suggestion worked, it resolved other issues

    But now i need one more suggestion. I would like to call the delay subroutine in my LCD assembly file, I can only think of Including the delay.a51 in lcd.a51.

    Is there any other smart method for doing the same ?

  • but why have the LCD driver in assembler?

    That is either a poor attempt at a troll or an indication of poor imagination or both.

    There are numerous reasons why one might consider writing an LCD driver in assembler; especially if the facilities to be provided by that driver extend beyond the basic boring static text that many developers seem to be satisfied with.

  • Thanks for your concern.

    I would like to call delay subroutine in LCD_driver.a51, which is defined in delay.a51

    Can you please tell me how can I get this one working, though it is boring and not so cool stuff?

  • I would like to call delay subroutine in LCD_driver.a51, which is defined in delay.a51

    Can you please tell me how can I get this one working,

    If you can't figure that out by yourself, you should re-think your expectation that you can beat the C compiler on code efficiency ... that would take considerably better assembly programming skills than you've exhibited so far.

  • There are numerous reasons why one might consider writing an LCD driver in assembler; especially if the facilities to be provided by that driver extend beyond the basic boring static text that many developers seem to be satisfied with.

    You got that backwards. To the negligibly small extent that the boringness, staticness or textness of the display has any relation to whether an LCD driver should be written in C or assembler, it's actually such simple applications that would be feasible in asm. It's the additional complexity of a more fully featured, general-purpose driver that will make the case for choosing C.

  • When writing more complex programs, it is common to only translate more critical loops into assembler - if it can be shown that an assembler loop can give any real gain that actually matters.

  • You got that backwards.

    Really. I wouldn't waste any time discussing such a matter with an idiot and therefore I won't waste any time discussing such a matter with you. Goodbye.