Discussion:
[fpc-devel] Public access of FPC features and settings
Florian Klämpfl via fpc-devel
2021-04-02 12:52:02 UTC
Permalink
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.

_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
https://li
Michael Van Canneyt via fpc-devel
2021-04-02 13:07:28 UTC
Permalink
Post by Florian Klämpfl 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.
Michael Ring via fpc-devel
2021-04-02 14:21:47 UTC
Permalink
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>
Post by Michael Van Canneyt via fpc-devel
Post by Florian Klämpfl via fpc-devel
Am 07.03.2021 um 15:12 schrieb Florian KlÀmpfl 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.
_______________________________________________
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Florian Klämpfl via fpc-devel
2021-04-02 17:13:23 UTC
Permalink
Post by 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"/>
Michael Van Canneyt via fpc-devel
2021-04-02 21:10:55 UTC
Permalink
Post by Florian Klämpfl via fpc-devel
Post by Michael Ring via fpc-devel
Florian, it seems you missed a comment on that topic I wrote a while ago.
<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.

Loading...