Hello! I have a project of 8bit Atmel Microcontroller. I want this project to be compiled in Keil for Cortex M3 Microcontroller. But I have some issues.
1. I have an error "SFR undefined identifier". The compiler does not understand what SFR means .
2. There are 2 files with assembler code. The compiler displays a lot of mistakes in all these files.
How to compile this project?
I don't know where you got the idea that this should be possible - but it isn't.
Embedded microcontroller code tends to be very target specific, especially at the lower end - such as 8-bit.
You cannot just take code written for one microcontroller and expect it to "just work" on another entirely different microcontroller.
Sorry.
"The compiler does not understand what SFR means"
Generically, "SFR" means "Special Function Register" - which refers to the registers which directly control the special hardware functions of the chip. It should come as no surprise that these are not portable.
Specifically, the Keil C51 compiler has "sfr" as a proprietary language extension - so that is clearly not going to be portable.
http://www.keil.com/support/man/docs/c51/c51_le_sfrs.htm
"There are 2 files with assembler code. The compiler displays a lot of mistakes in all these files"
Of course it does - Assembler is inherently target-specific and, thus, not portable
Note that Atmel have (or, rather, had - prior to their acquisition by Microchip) two entirely different 8-bit microcontroller ranges.
So which one are you actually talking about?
Thank you for your assisstance. As I understood this task is not solvable and impossible.
As I understood this task is not solvable and impossible.
It is likely to be both solvable and possible. It will just take sufficient understanding and time to port the code across from one platform to another. So the real questions are whether you have the necessary tools to accomplish the task and whether it is worth the effort.
No, I didn't say that.
What I said was that it is not a simple matter of just taking the code from one microcontroller & toolset and simply dropping it into another.
What you need to do is to port the code from its original target & toolset to the new target & toolset.
This is, in fact, a common exercise.
en.wikipedia.org/.../Porting
As already noted, it requires that you have a good understanding of the original target & toolset and a good understanding of the new target & toolset. You will also need an understanding of the application itself.
If the original code is well written and structured to be portable, then the process of porting can be (relatively) straightforward.
en.wikipedia.org/.../Software_portability
As previously noted, assembler is inherently non-portable.