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

How to compile a code which was originally compiled by Archimedes C-51 compiler V4.23?

My code was compiled using the Archimedes C-51 compiler V4.23. I want to use Keil uVersion2 to compile it. But Keil only support those codes using at least Archimedes C-51 compiler Version 5.

Does anybody have any idea for compiling my codes?

Thanks

  • Maggie,

    You can't compile it directly, but I've ported some fairly large projects from an old version of archimedes and it really only took about a day. You have to convert all the port references from archimedes-style PX.Y to Keil's PX^Y. You also have to change all the interrupt function definitions. Also, you can no longer use a port-bit as an lvalue. That is, in archimedes you could do P3.2 = 1, but in Keil, you'll need to define an sbit for that.

    Anyhow... it should be no problem for anyone familiar with the 8051 to port over your code.

  • Jay:

    Thank you so much. Actually I am not very familiar with 8051.

    You are right, most of the problems are about the definition of interrupt. There is another problem with:
    #if sizeof(float)==sizeof(double)
    Keil said "Invalid integer const expression"
    Do you have any idea or any instructions you recommend me to read?

    Thanks again.

  • Maggie,

    Knowing why that line is a problem will require a bit of learning that doesn't have much to do with the 8051 or Keil tools in particular. That's basically a 'C' programming question. The "sizeof" macro that you use is something implemented by the compiler, whereas the directives that start with a '#' are pre-processor directives. Since the preprocessor runs BEFORE the compiler (hence, the "pre"), the compiler cannot evaluate that sizeof expression and the preprocessor doesn't know what you're talking about.

    Assuming that you brush up a bit on your C skills, I would recommend reading both the 8051 programmers guide and the Keil C51 manual. You can probably skip the linker / assembler manual as a first pass if you're using uVision, but then again, if you're porting code, you might run into problems that require you to know the intricacies of the linker as well.

  • #if sizeof(float)==sizeof(double)

    You can't do that. The compiler can deal with sizeof, not the preprocessor.

    Take a look at this thread.

    http://www.keil.com/forum/docs/thread5888.asp

  • I think it's worth pointing out that sizeof is an operator, not a macro, particularly given the context.

  • Good point... please excuse my often "semantically challenged" phraseology. :)