Developer forums (C::B DEVELOPMENT STRICTLY!) > Compiler Framework Redesign

Add Keil C51/CX51 compiler

(1/2) > >>

tomjnx:
Keil C51/CX51 is a fairly popular commercial compiler for MCS51 microcontrollers.

Two flavours are available; AFAIK the difference of CX51 versus C51 is:
- different object file format (especially debug information)
- linker (whole program) optimizations
- even more $$$

Compared to pretty much all other compilers, they have a very peculiar command line syntax:
- include files must be specified as INCDIR(inc1;inc2) instead of -Iinc1 -Iinc2
- there is no way to specify library directories
- objects (and libraries) must be given in the command line as obj1.obj,obj2.obj,lib1.lib,lib2.lib (i.e. commas and no -llib)
- return value can be zero (no warnings/errors) and one (warnings present/no errors) for a successful compilation

I extended the compiler framework as follows:
- when (pathname) option strings end with "(", the pathnames are grouped together and closed with ")"
- separators are configurable
- the highest return value to be considered successful is configurable
- there are new "variables" to handle the object case
- in the absence of a switch for specifying library directories (empty string), C::B walks the library paths itself and finds the libs for the linker

oBFusCATed:
Hi,

Thank you for you contribution.
I've some remarks about the patch:
1. Generate the patch with "svn diff -x '-u -b' > name.patch", because there are many newline character changes
2. Post the patch in the project page on berlios.de, attachments in the forum are deleted, when there is no empty space on disk.
3. Is this absolutely necessary? As far as I know, there is a policy in C::B to no do anything automatically and surprise the user.
    (I've not checked the code because of 1)

--- Quote from: tomjnx on May 06, 2011, 01:41:17 pm ---- in the absence of a switch for specifying library directories (empty string), C::B walks the library paths itself and finds the libs for the linker

--- End quote ---

tomjnx:
I've uploaded a whitespace change less version of the patch to berlios.


--- Quote from: oBFusCATed on May 06, 2011, 02:10:39 pm ---3. Is this absolutely necessary? As far as I know, there is a policy in C::B to no do anything automatically and surprise the user.
    (I've not checked the code because of 1)

--- Quote from: tomjnx on May 06, 2011, 01:41:17 pm ---- in the absence of a switch for specifying library directories (empty string), C::B walks the library paths itself and finds the libs for the linker

--- End quote ---

--- End quote ---

Bad/confusing wording, sorry.

What I meant was when m_Switches.libDirs is empty, it is taken as an indication that the linker does not support library directories and C::B walks the paths for the linker.

Now libDirs is something the user cannot set AFAIK, only the developer of the compiler plugin. So there's little chance for confusing the user, only the compiler plugin developer.

This method could be a problem for DMC and DMD under windows though - they do not define libDirs. The question now is is it desirable to do the path walk in C::B for these compilers too, or not.

Tom

oBFusCATed:
Keep in mind that you should not change the behaviour of all the other compilers, because people depend on it!
Also if you can show full log from the compiler to see what is required.

tomjnx:

--- Quote from: oBFusCATed on May 06, 2011, 06:05:41 pm ---Keep in mind that you should not change the behaviour of all the other compilers, because people depend on it!

--- End quote ---
That was an accident. I fixed this by introducing a dedicated flag to request C::B pathwalk


--- Quote from: oBFusCATed on May 06, 2011, 06:05:41 pm ---Also if you can show full log from the compiler to see what is required.

--- End quote ---

-------------- Clean: Debug in lcd-keil ---------------

Cleaned "lcd-keil - Debug"

-------------- Build: Debug in lcd-keil ---------------

C51.exe lcd.c OBJECT(obj\Debug\lcd.obj) WARNINGLEVEL(2) OBJECTEXTEND SMALL  DEBUG    INCDIR(C:\eda\Keil\C51\inc;"C:\Program Files\AXSEM\AXSDB\examples\libmf\include")
C51 COMPILER V8.02 - SN: XXXXX-XXXXXX
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2006
C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
BL51.exe "obj\Debug\lcd.obj,\"C:\Program Files\AXSEM\AXSDB\examples\libmf\keil\libmf.lib\"" TO bin\Debug\lcd-keil.omf DW(6) RAMSIZE(256) XDATA(0x0-0x1FFF) CODE(0x0-0xFFFF)
BL51 BANKED LINKER/LOCATER V6.00 - SN: XXXXX-XXXXXX
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2005
Program Size: data=14.0 xdata=438 code=313
LINK/LOCATE RUN COMPLETE.  0 WARNING(S),  0 ERROR(S)
Output size is 12.59 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)

Navigation

[0] Message Index

[#] Next page

Go to full version