News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

XML based compilers

Started by Alpha, June 15, 2012, 01:00:36 PM

Previous topic - Next topic

Alpha

Some questions.
Here (compilerKeilC51.cpp):

        wxRegKey key;   // defaults to HKCR
        key.SetName(wxT("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Keil \265Vision3"));
        if (key.Exists() && key.Open(wxRegKey::Read)) // found; read it
            key.QueryValue(wxT("LastInstallDir"), m_MasterPath);

did you mean:

        key.SetName(wxT("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Keil\\265Vision3"));


Here (options_keilcx51.xml):

    <if platform="windows">
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>

did you intend to have:

    <if platform="windows">
        <Program name="CPP"       value="CX51.exe"/>
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="CPP"       value="CX51"/>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>

Alpha

#181
Attached is a modified version of your patch.  [[Edit: use the version in the later post.]]  There are some changes to formatting, removal of sections that appeared to have no purpose, and tweaks/fixes.  Could you please test and let me know if it still works as intended?

Quote from: tomjnx on December 27, 2012, 05:26:43 AM
I don't think it ever has changed or become irrelevant. The SDCC manual
http://sdcc.sourceforge.net/doc/sdccman.pdf states on p.24 that the object file extension is .rel.

Looking at the sourceforge SVN source code of SDCC, it's slightly more complicated. AVR, DS390, HC08, MCS51, XA51 and Z80 ports use .rel as object extension, only the PIC14 and PIC16 backends use .o as object extension (see sdcc/src/*/main.c, the PORT structs). I'd consider the PIC backends as of the lesser stable/mature backends - so it seems strange to break the stable backends because of a few unstable ones...

So it seems the correct fix would be (apart from convincing SDCC developers to use the same extension for all backends) to select the object file extension based on which architecture switch was selected...
According to PM with user squalyl, PIC port produces *.o because it uses gpasm and gplink.  The easier solution would be to duplicate SDCC to create SDCC-PIC, however, I would prefer to instead detect the correct option.  Do you have a list of the specific flags that switch it to PIC (is it -mpic14 and -mpic16)?  (I plan to revert the default to *.rel.)

[attachment deleted by admin]

tomjnx

Thanks for your effort!

Quote from: Alpha on December 28, 2012, 06:23:10 AM
did you mean:

        key.SetName(wxT("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Keil\\265Vision3"));


Um, no, I meant the lowercase greek letter mu, µ. So the directory component should be "Keil µVision3" (µVision being the name of their IDE)

Quote from: Alpha on December 28, 2012, 06:23:10 AM
Here (options_keilcx51.xml):

    <if platform="windows">
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>

did you intend to have:

    <if platform="windows">
        <Program name="CPP"       value="CX51.exe"/>
        <Program name="LD"        value="LX51.exe"/>
        <Program name="LIB"       value="LIBX51.exe"/>
    </if>
    <else>
        <Program name="CPP"       value="CX51"/>
        <Program name="LD"        value="LX51"/>
        <Program name="LIB"       value="LIBX51"/>
    </else>


Yes. Thanks for the fix. On second thought, the conditional could be removed and only the windows version be retained, as keil doesn't offer their tools for anything other than windows, and apparently the have absolutely no plans to change this.

tomjnx

Quote from: Alpha on December 28, 2012, 10:08:05 PM
Attached is a modified version of your patch.  There are some changes to formatting, removal of sections that appeared to have no purpose, and tweaks/fixes.  Could you please test and let me know if it still works as intended?
I will do that, but it will most likely be after new year.

Quote from: Alpha on December 28, 2012, 10:08:05 PM
Do you have a list of the specific flags that switch it to PIC (is it -mpic14 and -mpic16)?  (I plan to revert the default to *.rel.)
Yes, exactly.

Alpha

Quote from: tomjnx on December 29, 2012, 12:20:16 AM
Um, no, I meant the lowercase greek letter mu, µ. So the directory component should be "Keil µVision3" (µVision being the name of their IDE)
Ah, okay.
Quote from: tomjnx on December 29, 2012, 12:26:31 AM
I will do that, but it will most likely be after new year.
Sure; when you do, use the version attached here (it formats a little more, and reverts my change to mu).

tomjnx

Quote from: Alpha on December 29, 2012, 01:14:50 AM
Sure; when you do, use the version attached here (it formats a little more, and reverts my change to mu).

I've now reviewed and tested this patch. It looks good. You've made some nice improvements!

The only thing I forgot: DBGconfig should be set to the empty string in options_keilc51.xml and options_iar8051.xml; axs_debugger is not yet merged.

Alpha

Quote from: tomjnx on January 04, 2013, 08:39:38 PM
The only thing I forgot: DBGconfig should be set to the empty string in options_keilc51.xml and options_iar8051.xml; axs_debugger is not yet merged.
Okay.

tomjnx

Thanks for merging!

Now that these compilers are in, I've posted a patch (#3400 on the berlios queue) to the scripted wizard MCS51 project generator to allow the user to choose IAR or Keil in addition to SDCC.

darmar

I have had few problems with 'xml based compilers' when I have tried to port Intel Fortran compiler:

1) I can specify, that compiler will run only on 'windows', or on 'linux', or on 'macosx'. But how to say 'non-windows'? Or 'linux and macosx'?

2) In an options file, I can specify, that one option 'supersedes' another. But some of Intel's options are from two separate words (e.g. "-check bounds"). It seems, that C::B can't handle such options in 'supersedes' list.  Have I missed something?

Alpha

Currently, the format does not support those options.  If you have a recommendation on how to extend the format, I will see what I can come up with (when I have time).  Or you could prepare a patch; I would be happy to review it.

gd_on

Before the introduction of xml based compilers, it was possible to obtain localized strings for each compiler options. Now, with xml compilers, they only appear in english, even if I force the correct chain and it's translation to be in the .po (and .mo) file. May be the "name" parameter in the xml file should be treated somewhere with a _(...) and not with a _T(...) (or wxT(...)).
Is it possible to reintroduce this localization possibility?
Thanks

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Alpha

Does this patch enable translation?

Index: src/plugins/compilergcc/compilerXML.cpp
===================================================================
--- src/plugins/compilergcc/compilerXML.cpp (revision 9423)
+++ src/plugins/compilergcc/compilerXML.cpp (working copy)
@@ -15,7 +15,7 @@
#include "compilerXML.h"

CompilerXML::CompilerXML(const wxString& name, const wxString& ID, const wxString& file)
-    : Compiler(name, ID), m_fileName(file)
+    : Compiler(_(name), ID), m_fileName(file)
{
    wxXmlDocument compiler;
    compiler.Load(m_fileName);

gd_on

I tried your patch but I obtain a compilation error :
Quote
||=== Build: Compiler in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\plugins\compilergcc\compilerXML.cpp||In constructor 'CompilerXML::CompilerXML(const wxString&, const wxString&, const wxString&)':|
C:\wxWidgets-2.8.12\include\wx\wxchar.h|235|error: 'Lname' was not declared in this scope|
C:\wxWidgets-2.8.12\include\wx\cpp.h|17|note: in definition of macro 'wxCONCAT_HELPER'|
C:\wxWidgets-2.8.12\include\wx\intl.h|48|note: in expansion of macro 'wxT'|
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\plugins\compilergcc\compilerXML.cpp|18|note: in expansion of macro '_'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 4 second(s)) ===|

error at line 235 in wchar.h :

233 #if wxUSE_UNICODE
234      /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */
235     #define wxT(x) wxCONCAT_HELPER(L, x)
236 #else /* !Unicode */
237     #define wxT(x) x
238 #endif /* Unicode/!Unicode */


maybe a missing header.

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

osdt

Quote from: gd_on on October 28, 2013, 10:39:07 AM
I tried your patch but I obtain a compilation error :
Quote
...
C:\wxWidgets-2.8.12\include\wx\wxchar.h|235|error: 'Lname' was not declared in this scope|
...

The macro '_(name)' expands to 'Lname' for unicode builds. It's designed for quoted strings ("translate me") only.

@gd_on: do you really want to translate compiler names like 'GCC' ?

- osdt


gd_on

Quotedo you really want to translate compiler names like 'GCC' ?
No, I don't.
I simply want to translate options as they appear in compiler options, and more precisely in window "Global compiler settings", Compiler settings, Compiler flags tabs.
For example:
the string: Produce debugging symbols (displayed as Produce debugging symbols [-g])
will become in french: Produire des symboles de débogage (displayed as Produire des symboles de débogage [-g])

gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).