Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-03

Public access of FPC features and settings

13 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alfred

Hello,

As a follow-up on a Lazarus feature request.

Among other applications, Lazarus uses some hard-coded list that represent FPC features. Like supported MCU and boards. It would be (much) more convenient to parse the FPC output itself to supply this info. And that could be made easy by using XML as FPC output.

Besides the above, I would welcome more features to be available through FPC itself.
FPC uses system files, located in "compiler/systems". With all kinds of settings. Like alignment and calling convention and linker to use. FPC uses search-paths. Some user defined through fpc.cfg, some build-in. See all -F... compiler settings.
It would be nice to be able to get info through FPC itself about these settings and paths.
As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by hand. Or look into a file like fpmkunit.pp to find the valid FPC targets. Or parse the Makefile to find all available subarchs when building a cross-compiler.

For a start, I would favor a XML/JSON output of fpc -i. Would be very nice to use its output.

Thanks.

Reply by email

Florian Klämpfl
to Alfred
Alfred wrote 24 lines
Hello, As a follow-up on a Lazarus feature request. Among other applications, Lazarus uses some hard-coded list that represent FPC features. Like supported MCU and boards. It would be (much) more convenient to parse the FPC output itself to supply this info. And that could be made easy by using XML as FPC output. Besides the above, I would welcome more features to be available through FPC itself. FPC uses system files, located in "compiler/systems". With all kinds of settings. Like alignment and calling convention and linker to use. FPC uses search-paths. Some user defined through fpc.cfg, some build-in. See all -F... compiler settings. It would be nice to be able to get info through FPC itself about these settings and paths. As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by hand. Or look into a file like fpmkunit.pp to find the valid FPC targets. Or parse the Makefile to find all available subarchs when building a cross-compiler. For a start, I would favor a XML/JSON output of fpc -i. Would be very nice to use its output.

I added a first experimental implementation in r48897. It does not cover full -i, so far only to show how it could look like. Any comments?

fpc -ix writes to the console
fpc -ixfpc_info.xml to fpc_info.xml

Reply by email

Alfred
to Florian Klämpfl

Looks good. Thanks. My conclusion: we need more of this ! No kidding. This XML output is very useful. And, naturally, I would like to ask for more.
If more is given, the use of a scheme would make it very convenient (easy) to add new content and to read this new content. But anyhow, this output is very easy to use.

Show quoted text 10 lines
I added a first experimental implementation in r48897. It does not cover full -i, so far only to show how it could look like. Any comments? fpc -ix writes to the console fpc -ixfpc_info.xml to fpc_info.xml _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Michael Ring
to Florian Klämpfl: I added a first experimental implementation in r48897. It does not cover full -i, so far…

for this command:

~/fpcupdeluxe-embedded/fpc/bin/aarch64-darwin/fpc -Tembedded -Parm -WpDISCOVERYF411VE -ix

it would be good to also get back the controllerunitstr that belongs to DISCOVERYF411VE

or, when size does not matter much include the unit already in the more generalized call:

~/fpcupdeluxe-embedded/fpc/bin/aarch64-darwin/fpc -Tembedded -Parm -ix

....

<controllertype name="DISCOVERYF411VE" unit="STM32F411XE"/>

<controllertype name="STM32F429VG" unit="STM32F429XX"/>

....

Michael

Florian Klämpfl wrote 36 lines
Am 07.03.21 um 12:05 schrieb Alfred via fpc-devel: > Hello, > > As a follow-up on a Lazarus feature request. > > Among other applications, Lazarus uses some hard-coded list that > represent FPC features. Like supported MCU and boards. It would be > (much) more convenient to parse the FPC output itself to supply this > info. And that could be made easy by using XML as FPC output. > > Besides the above, I would welcome more features to be available > through FPC itself. > FPC uses system files, located in "compiler/systems". With all kinds > of settings. Like alignment and calling convention and linker to use. > FPC uses search-paths. Some user defined through fpc.cfg, some > build-in. See all -F... compiler settings. > It would be nice to be able to get info through FPC itself about > these settings and paths. > As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by hand. > Or look into a file like fpmkunit.pp to find the valid FPC targets. > Or parse the Makefile to find all available subarchs when building a > cross-compiler. > > For a start, I would favor a XML/JSON output of fpc -i. Would be very > nice to use its output. I added a first experimental implementation in r48897. It does not cover full -i, so far only to show how it could look like. Any comments? fpc -ix writes to the console fpc -ixfpc_info.xml to fpc_info.xml _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Michael Van Canneyt
to Florian Klämpfl: I added a first experimental implementation in r48897. It does not cover full -i, so far…
Florian Klämpfl wrote 31 lines
Am 07.03.21 um 12:05 schrieb Alfred via fpc-devel: > Hello, > > As a follow-up on a Lazarus feature request. > > Among other applications, Lazarus uses some hard-coded list that > represent FPC features. Like supported MCU and boards. It would be > (much) more convenient to parse the FPC output itself to supply this > info. And that could be made easy by using XML as FPC output. > > Besides the above, I would welcome more features to be available through > FPC itself. > FPC uses system files, located in "compiler/systems". With all kinds of > settings. Like alignment and calling convention and linker to use. > FPC uses search-paths. Some user defined through fpc.cfg, some build-in. > See all -F... compiler settings. > It would be nice to be able to get info through FPC itself about these > settings and paths. > As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by hand. Or > look into a file like fpmkunit.pp to find the valid FPC targets. Or > parse the Makefile to find all available subarchs when building a > cross-compiler. > > For a start, I would favor a XML/JSON output of fpc -i. Would be very > nice to use its output. I added a first experimental implementation in r48897. It does not cover full -i, so far only to show how it could look like. Any comments? fpc -ix writes to the console fpc -ixfpc_info.xml to fpc_info.xml

Since we write the resource strings in JSON, and XML is meanwhile all but replaced by JSON, I think it would be much better to write JSON ?

Michael.

Reply by email

Florian Klämpfl
to Michael Van Canneyt
Michael Van Canneyt wrote 39 lines
On Sun, 7 Mar 2021, Florian Klämpfl via fpc-devel wrote: > Am 07.03.21 um 12:05 schrieb Alfred via fpc-devel: >> Hello, >> >> As a follow-up on a Lazarus feature request. >> >> Among other applications, Lazarus uses some hard-coded list that >> represent FPC features. Like supported MCU and boards. It would be >> (much) more convenient to parse the FPC output itself to supply this >> info. And that could be made easy by using XML as FPC output. >> >> Besides the above, I would welcome more features to be available >> through FPC itself. >> FPC uses system files, located in "compiler/systems". With all kinds >> of settings. Like alignment and calling convention and linker to use. >> FPC uses search-paths. Some user defined through fpc.cfg, some >> build-in. See all -F... compiler settings. >> It would be nice to be able to get info through FPC itself about >> these settings and paths. >> As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by hand. >> Or look into a file like fpmkunit.pp to find the valid FPC targets. >> Or parse the Makefile to find all available subarchs when building a >> cross-compiler. >> >> For a start, I would favor a XML/JSON output of fpc -i. Would be very >> nice to use its output. > > I added a first experimental implementation in r48897. It does not > cover full -i, so far only to show how it could look like. Any comments? > > fpc -ix writes to the console > fpc -ixfpc_info.xml to fpc_info.xml Since we write the resource strings in JSON, and XML is meanwhile all but replaced by JSON, I think it would be much better to write JSON ?

The compiler writes the node tree already as XML, so I thought XML might be the better choice? Despite the fact that I really dislike json for two reasons: it reminds me of JS and C; ad hoc writing is annoying due to the comma being a separator and no trailing commas after the last value being allowed.

Reply by email

Michael Van Canneyt
to Florian Klämpfl
Florian Klämpfl wrote 6 lines
> Since we write the resource strings in JSON, and XML is meanwhile all but > replaced by JSON, I think it would be much better to write JSON ? > The compiler writes the node tree already as XML, so I thought XML might be the better choice?

The node tree is not for public use.
The resource string files are, and this is too...

Despite the fact that I really dislike json for two reasons: it reminds me of JS and C; ad hoc writing is annoying due to the comma being a separator and no trailing commas after the last value being allowed.

Well, then it means pas2js will unfortunately not follow FPC in this; if anything it will write JSON, because it already writes everything else in JSON.
I would have preferred to use the same format, and we're not adding XML to it.

When you finish it in FPC, I can always add -ij for json.

Michael.

Reply by email

Michael Van Canneyt
to Michael Van Canneyt
Michael Van Canneyt wrote 21 lines
On Tue, 9 Mar 2021, Florian Klämpfl via fpc-devel wrote: >> Since we write the resource strings in JSON, and XML is meanwhile all but >> replaced by JSON, I think it would be much better to write JSON ? >> > > The compiler writes the node tree already as XML, so I thought XML might be > the better choice? The node tree is not for public use. The resource string files are, and this is too... > Despite the fact that I really dislike json for two reasons: it reminds me > of JS and C; ad hoc writing is annoying due to the comma being a separator > and no trailing commas after the last value being allowed. Well, then it means pas2js will unfortunately not follow FPC in this; if anything it will write JSON, because it already writes everything else in JSON.

Just to show this is not an exaggerated statement, pas2js can also output the compiler messages itself as JSON for easier treatment:
{ "message" : "Using unit path: \"/Users/michael/pas2js/packages/rtl\"", "line" : 0, "col" : 0, "number" : 104, "filename" : "", "type" : "Info" } { "message" : "Output file: \"\"", "line" : 0, "col" : 0, "number" : 106, "filename" : "", "type" : "Info" } { "message" : "Fatal: parameter a.pp: Pascal file not found: \"/Volumes/Development/michael/a.pp\"", "line" : 0, "col" : 0, "number" : 0, "filename" : "", "type" : "Info" }

(I believe the TMS Web core compiler uses this format to convert it to a delphi-understandable format))

Michael.

Reply by email

Florian Klämpfl
to Florian Klämpfl: I added a first experimental implementation in r48897. It does not cover full -i, so far…
Show quoted text 14 lines
Am 07.03.2021 um 15:12 schrieb Florian Klämpfl via fpc-devel : Am 07.03.21 um 12:05 schrieb Alfred via fpc-devel: > Hello, > As a follow-up on a Lazarus feature request. > Among other applications, Lazarus uses some hard-coded list that represent FPC features. Like supported MCU and boards. It would be (much) more convenient to parse the FPC output itself to supply this info. And that could be made easy by using XML as FPC output. > Besides the above, I would welcome more features to be available through FPC itself. > FPC uses system files, located in "compiler/systems". With all kinds of settings. Like alignment and calling convention and linker to use. > FPC uses search-paths. Some user defined through fpc.cfg, some build-in. See all -F... compiler settings. > It would be nice to be able to get info through FPC itself about these settings and paths. > As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by hand. Or look into a file like fpmkunit.pp to find the valid FPC targets. Or parse the Makefile to find all available subarchs when building a cross-compiler. > For a start, I would favor a XML/JSON output of fpc -i. Would be very nice to use its output. I added a first experimental implementation in r48897. It does not cover full -i, so far only to show how it could look like. Any comments?

Meanwhile I completed it.

So if somebody thinks it’s useful, the json output can be added as well.

Reply by email

Michael Van Canneyt
to Florian Klämpfl
Florian Klämpfl wrote 20 lines
> Am 07.03.2021 um 15:12 schrieb Florian Klämpfl via fpc-devel : > > Am 07.03.21 um 12:05 schrieb Alfred via fpc-devel: >> Hello, >> As a follow-up on a Lazarus feature request. >> Among other applications, Lazarus uses some hard-coded list that represent FPC features. Like supported MCU and boards. It would be (much) more convenient to parse the FPC output itself to supply this info. And that could be made easy by using XML as FPC output. >> Besides the above, I would welcome more features to be available through FPC itself. >> FPC uses system files, located in "compiler/systems". With all kinds of settings. Like alignment and calling convention and linker to use. >> FPC uses search-paths. Some user defined through fpc.cfg, some build-in. See all -F... compiler settings. >> It would be nice to be able to get info through FPC itself about these settings and paths. >> As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by hand. Or look into a file like fpmkunit.pp to find the valid FPC targets. Or parse the Makefile to find all available subarchs when building a cross-compiler. >> For a start, I would favor a XML/JSON output of fpc -i. Would be very nice to use its output. > > I added a first experimental implementation in r48897. It does not cover full -i, so far only to show how it could look like. Any comments? Meanwhile I completed it. So if somebody thinks it’s useful, the json output can be added as well.

Will do, thanks!

Michael.

Reply by email

Michael Ring
to Michael Van Canneyt

Florian, it seems you missed a comment on that topic I wrote a while ago.

There is also the need to have a tuple that matches controllertype to controllerunit to get rid of a big peace of duplicated code from cpuinfo.pas in lazarus.

Lazarus needs to know which unit to include so that codetools can do their magic. In current implementation parts of controllertypes are duplicated in lazarus code.

To get rid of this lazarus will not only need to know the available controllertypes, it will also need to have the mapping from controllertype tu unitname like this:

<controllertype name="NUCLEOF103RB" unit="STM32F103RB" />* *

in the xml.

Example:

~/fpcupdeluxe-test/fpc/bin/aarch64-darwin/fpc -Tembedded -Parm -ix

<?xml version="1.0" encoding="utf-8"?>
<fpcoutput>
  <info>
    <ostargets>
...

   </ostargets>
    <cpuinstructionsets>
...

   </cpuinstructionsets>
    <fpuinstructionsets>
...

   </fpuinstructionsets>
    <abis>
...

   </abis>
...

   <optimizations>

    </optimizations>
    <wpoptimizations>
...

   </wpoptimizations>
    <modeswitches>
...

   </modeswitches>
    <asmmodes>
...

   </asmmodes>
    <controllertypes>

*...*

*     <controllertype name="NUCLEOF103RB" unit="STM32F103RB" />** *...

    </controllertypes>
    <features>
...

   </features>
    <codegeneratorbackend>FPC</codegeneratorbackend>   </info>
</fpcoutput>

Michael Van Canneyt wrote 47 lines
On Fri, 2 Apr 2021, Florian Klämpfl via fpc-devel wrote: > > >> Am 07.03.2021 um 15:12 schrieb Florian Klämpfl via fpc-devel >> : >> >> Am 07.03.21 um 12:05 schrieb Alfred via fpc-devel: >>> Hello, >>> As a follow-up on a Lazarus feature request. >>> Among other applications, Lazarus uses some hard-coded list that >>> represent FPC features. Like supported MCU and boards. It would be >>> (much) more convenient to parse the FPC output itself to supply >>> this info. And that could be made easy by using XML as FPC output. >>> Besides the above, I would welcome more features to be available >>> through FPC itself. >>> FPC uses system files, located in "compiler/systems". With all >>> kinds of settings. Like alignment and calling convention and linker >>> to use. >>> FPC uses search-paths. Some user defined through fpc.cfg, some >>> build-in. See all -F... compiler settings. >>> It would be nice to be able to get info through FPC itself about >>> these settings and paths. >>> As maintainer of fpcupdeluxe, often I need to parse fpc.cfg by >>> hand. Or look into a file like fpmkunit.pp to find the valid FPC >>> targets. Or parse the Makefile to find all available subarchs when >>> building a cross-compiler. >>> For a start, I would favor a XML/JSON output of fpc -i. Would be >>> very nice to use its output. >> >> I added a first experimental implementation in r48897. It does not >> cover full -i, so far only to show how it could look like. Any >> comments? > > Meanwhile I completed it. > > So if somebody thinks it’s useful, the json output can be added as well. Will do, thanks! Michael. _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Florian Klämpfl
to Michael Ring
Show quoted text 5 lines
Am 02.04.2021 um 16:21 schrieb Michael Ring via fpc-devel : Florian, it seems you missed a comment on that topic I wrote a while ago.

You are right. The controller unit is written now like:

<controllertype name="AVRSIM controllerunit="AVRSIM"/> <controllertype name="AT90CAN32 controllerunit="AT90CAN32"/> <controllertype name="AT90CAN64 controllerunit="AT90CAN64"/> <controllertype name="AT90CAN128 controllerunit="AT90CAN128"/> <controllertype name="AT90PWM1 controllerunit="AT90PWM1"/>

Reply by email

Michael Van Canneyt
to Florian Klämpfl
Florian Klämpfl wrote 15 lines
> Am 02.04.2021 um 16:21 schrieb Michael Ring via fpc-devel : > > Florian, it seems you missed a comment on that topic I wrote a while ago. > > You are right. The controller unit is written now like: <controllertype name="AVRSIM controllerunit="AVRSIM"/> <controllertype name="AT90CAN32 controllerunit="AT90CAN32"/> <controllertype name="AT90CAN64 controllerunit="AT90CAN64"/> <controllertype name="AT90CAN128 controllerunit="AT90CAN128"/> <controllertype name="AT90PWM1 controllerunit="AT90PWM1"/>

Seems a quote is missing after the name= value ?

Michael.

Reply by email