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

I have a problem trying update my old version software developed in c51

I have an old version of c51 where I develop an application. I want to use a newer version of this compiler (c51), I want my old version to compile in the new version of c51. How can I make this work?
Thanks!

Parents
  • I have an old version of c51 where I develop an application. I want to use a newer version of this compiler (c51), I want my old version to compile in the new version of c51. How can I make this work?

    literally you say that you want your old compiler to be compiled by a new compiler.

    Since I can not believe that that is waht you mean let me answer what I think is your question: "can I compile source the I compiled with an old C51 with a new one?".

    The answer is yes if you recompile EVERYTHING

    If you find any glitches that will not be the compilers fault e.g. delays erroneously coded in C (no delay routine should ever be in C) or "critical timing that happen to work" such will be fault in the code rather than compiler faults.

    I do final test compiling with two versions and testing both results to try to catch such possibilities and can thus answer absolutely "If the code is good there is no problem updating the compiler"

    Erik

Reply
  • I have an old version of c51 where I develop an application. I want to use a newer version of this compiler (c51), I want my old version to compile in the new version of c51. How can I make this work?

    literally you say that you want your old compiler to be compiled by a new compiler.

    Since I can not believe that that is waht you mean let me answer what I think is your question: "can I compile source the I compiled with an old C51 with a new one?".

    The answer is yes if you recompile EVERYTHING

    If you find any glitches that will not be the compilers fault e.g. delays erroneously coded in C (no delay routine should ever be in C) or "critical timing that happen to work" such will be fault in the code rather than compiler faults.

    I do final test compiling with two versions and testing both results to try to catch such possibilities and can thus answer absolutely "If the code is good there is no problem updating the compiler"

    Erik

Children
  • Hi Erik, thanks for the cuestion, sorry for my english, but I'm form Mexico and I nedd a little more practice to speak english.

    I recompiled de software, but I have some errors, like:

    *** ERROR C231 IN LINE 537 OF C:\FSI\INC\MATH.H: '_abs': redefinition
    *** ERROR C231 IN LINE 538 OF C:\FSI\INC\MATH.H: '_labs': redefinition

    What means that error? do you have any idea?

  • "What means that error?"

    It means exactly what it says, but I guess that doesn't help so much when English isn't your native language.

    In 'C', everything must be defined exactly once - no more, no less.

    "Redefinition" just means that something already defined is being defined again - this is not allowed!

    In your particular case, the messages are telling you that '_abs' is already defined, when line 537 of MATH.H attempts to define it again; similarly, line 538 is attmepting to define '_labs' when it is already defined.

    This could mean that you are including MATH.H twice, or possibly two different versions of MATH.H - both of which attempt to define these symbols.

    You will need to search through your source files & headers to check this.

  • Thanks a lot, I checked de code and in fact it has twice the same declaration.

    I remember that a had another problem, this software is going to work in a EPROM 8051. I need to create the ".HEX" file. But the .BAT file I use to do that isn't work, I read that some commands has changed and I modify this, but is still not working.

    See the ".BAT"

    L51 avion3.OBJ,lft.OBJ,clk.obj,ram.OBJ TO avion3 CO(?C_C51STARTUP(2000h),2000h) XD(?XD?lft(0),?XD?clk(7FF8h),?XD?ram(8000h))
    OH51 avion3

    Where "Avion" is the name of the program in C

    The errors are:

    I used de command OHS51 and with that command the compiler say that isn't a valid command, so I changed for OH51

    This is the error that show

    OBJECT TO HEX FILE CONVERTER OH51 V2.6
    COPYRIGHT KEIL ELEKTRONIK GmbH 1991 - 2001

    *** ERROR: CAN'T OPEN FILE 'avion3'

    and with the command L51 say that isn't a valid command, so I changed for BL51 and now the program enter in a never end loop

    I don't know how to rewrite the ".bat", any idea?

  • "The answer is yes if you recompile EVERYTHING"

    You also need to check what changed between the two versions.

    If features were removed or changed, and your code relies upon those features, you will have to change your code.

    You also need to check the defaults for compiler features - these may have changed, and this could affect your code.

    You will almost certainly find that the generated machine code is different; your code should not rely upon this but, if it does, you will have to modify it accordingly - software delay loops, as Erik mentioned, are a case in point

  • "*** ERROR: CAN'T OPEN FILE 'avion3'"

    This probably means that the file either doesn't exist at all, or is not in the location specified or assumed.

    Given that you are also having problems with your Linker command line, probably the file doesn't exist at all because you haven't managed to get the Linker to create it yet!

    "I used de command OHS51 and with that command the compiler say that isn't a valid command"

    It wouldn't be the Compiler that said that - it would be your operating system.

    "so I changed for BL51"

    Yes, that is the correct name for the current Linker.

    "the program enter in a never end loop"

    You need to check that the complete command line is valid for BL51.
    Here is the Manual:
    http://www.keil.com/support/man/docs/bl51/

    "I don't know how to rewrite the ".bat", any idea?"

    BAT files are pretty simple things - basically just a sequence of commnd lines.
    See a standard PC reference book.