Recent

Author Topic: Paths manually specified.  (Read 2464 times)

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Paths manually specified.
« on: March 12, 2021, 04:55:29 pm »
Sometimes I use JALv2 compiler for PIC projects... compiler executable is accessed directly and paths to the include files are specified in the command line.

Because of this, you can have (if you want) a folder structure like this:
Code: [Select]
[your_home_folder]
   |
   o---[jalv2]
         |
         o---[includes]
         |
         jalv2_executable
         
So, I call the executable with path to [includes] and my project as parameters.

Can I do the same with the ppcrossarm executable, disregarding fpc.cfg and specifying the paths to where I put the RTL units and so on? If it works, will this allow me to have separate folders for targeted RTLs (for different cores)?

FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

Laksen

  • Hero Member
  • *****
  • Posts: 754
    • J-Software
Re: Paths manually specified.
« Reply #1 on: March 12, 2021, 07:43:10 pm »
Should be possible if you create a new fpc.cfg. I can't remember but I think the compiler might look for fpc.cfg in the same directory in which case you are in luck

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Paths manually specified.
« Reply #2 on: March 12, 2021, 08:09:58 pm »
yes, that would be ideal! I'll make some tests...
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Paths manually specified.
« Reply #3 on: March 12, 2021, 08:34:41 pm »
Ok, I think I found a combination of parameters for the configuration files, hopefully it will work...

So first we have:
  @<x>
which specifies a configuration file, but it says it will read it in addition to the default fpc.cfg

but then there is this option:
  -n
which says Do not read the default configuration files.

So, no fpc.cfg for you, but I will read the configuration file you delivered...
I am right? I'll test this.
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

MiR

  • Sr. Member
  • ****
  • Posts: 250
Re: Paths manually specified.
« Reply #4 on: March 12, 2021, 10:54:14 pm »
You can use the configuration done in fpcupdeluxe as a base for your experiments, there all is in place to have several subarchs/fp-abi's in parallel.
However, $FPCABI was added recently to the compiler, so you will need to compile a trunk compiler for it to work.
This of course depends on your needs. If you do not need to distinguish between floating point implementations then prod compilers will also work well.

# begin fpcup do not remove arm-embedded
# Inserted by fpcup 11-3-21 22:37:43
# Cross compile settings dependent on both target OS and target CPU
#IFDEF FPC_CROSSCOMPILING
#IFDEF EMBEDDED
#IFDEF CPUARM
#IFDEF CPUARMV6M
-CaEABI
#ENDIF CPUARMV6M
#IFDEF CPUARMV7EM
-CfFPV4_SP_D16
-OoFASTMATH
-CaEABIHF
#ENDIF CPUARMV7EM
#IFDEF CPUARMV7M
-CaEABI
#ENDIF CPUARMV7M
-FD/Users/ring/fpcupdeluxe/cross/bin/arm-embedded/
-XParm-none-eabi-
-Fl/Users/ring/fpcupdeluxe/cross/lib/arm-embedded/$FPCSUBARCH/$FPCABI/
-Fu/Users/ring/fpcupdeluxe/fpc/units/arm-embedded/$FPCSUBARCH/$FPCABI/rtl
-Fu/Users/ring/fpcupdeluxe/fpc/units/arm-embedded/$FPCSUBARCH/$FPCABI/packages
#ENDIF CPUARM
#ENDIF EMBEDDED
#ENDIF FPC_CROSSCOMPILING
# end fpcup do not remove



funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Paths manually specified.
« Reply #5 on: March 12, 2021, 11:43:08 pm »
Thank you!
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Paths manually specified.
« Reply #6 on: March 13, 2021, 01:50:08 pm »
Regarding the configuration file, or it's required presence or not, this sums it well:
https://www.freepascal.org/docs-html/user/usersu10.html
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Paths manually specified.
« Reply #7 on: March 13, 2021, 02:23:53 pm »
Regarding the configuration file, or it's required presence or not, this sums it well:
https://www.freepascal.org/docs-html/user/usersu10.html

Hello.

I think there are errors for Unix OS in the document and in the comment of /fpc/compiler/options.pas.

In the link you give, they say:

Quote
Unless you specify the -n (see page 104) option, the compiler will look for a configuration file fpc.cfg in the following places:

    Under unix (such as linux)

    1.
        The current directory.
    2.
        Your home directory, it looks for .fpc.cfg.
    3.
        The directory specified in the environment variable PPC_CONFIG_PATH.
    4.
        in the etc directory above the compiler directory.
        For instance, if the compiler is in /usr/local/bin, it will look in /usr/local/etc.
        See below for some additional information about this point.
    5.
        The directory /etc.

But if you take a look at /fpc/compiler/options.pas, there is:

Code: Pascal  [Select][+][-]
  1. {****************************************************************************
  2.                               Callable Routines
  3. ****************************************************************************}
  4.  
  5. function check_configfile(fn:string; var foundfn:string):boolean;
  6.  
  7.   function CfgFileExists(const fn:string):boolean;
  8.   begin
  9.     Comment(V_Tried,'Configfile search: '+fn);
  10.     CfgFileExists:=FileExists(fn);
  11.   end;
  12.  
  13. var
  14. {$ifdef Unix}
  15.   hs,
  16. {$endif Unix}
  17.   configpath : string;
  18. begin
  19.   foundfn:=fn;
  20.   check_configfile:=true;
  21.   { retrieve configpath }
  22.   configpath:=FixPath(GetEnvironmentVariable('PPC_CONFIG_PATH'),false);
  23. {$ifdef Unix}
  24.   if configpath='' then
  25.    configpath:=ExpandFileName(FixPath(exepath+'../etc/',false));
  26. {$endif}
  27.   {
  28.     Order to read configuration file :
  29.     try reading fpc.cfg in :
  30.      1 - current dir
  31.      2 - configpath
  32.      3 - compiler path
  33.   }
  34.   if not FileExists(fn) then
  35.    begin
  36. {$ifdef Unix}
  37.      hs:=GetEnvironmentVariable('HOME');
  38.      if (hs<>'') and CfgFileExists(FixPath(hs,false)+'.'+fn) then
  39.       foundfn:=FixPath(hs,false)+'.'+fn
  40.      else
  41. {$endif}
  42.       if CfgFileExists(configpath+fn) then
  43.        foundfn:=configpath+fn
  44.      else
  45. {$ifdef WINDOWS}
  46.        if (GetEnvironmentVariable('USERPROFILE')<>'') and CfgFileExists(FixPath(GetEnvironmentVariable('USERPROFILE'),false)+fn) then
  47.          foundfn:=FixPath(GetEnvironmentVariable('USERPROFILE'),false)+fn
  48.      else
  49.        if (GetEnvironmentVariable('ALLUSERSPROFILE')<>'') and CfgFileExists(FixPath(GetEnvironmentVariable('ALLUSERSPROFILE'),false)+fn) then
  50.          foundfn:=FixPath(GetEnvironmentVariable('ALLUSERSPROFILE'),false)+fn
  51.      else
  52. {$endif WINDOWS}
  53. {$ifndef Unix}
  54.       if CfgFileExists(exepath+fn) then
  55.        foundfn:=exepath+fn
  56.      else
  57. {$else}
  58.       if CfgFileExists('/etc/'+fn) then
  59.        foundfn:='/etc/'+fn
  60.      else
  61. {$endif}
  62.       check_configfile:=false;
  63.    end;
  64. end;

The comment says:

Quote
{
    Order to read configuration file :
    try reading fpc.cfg in :
     1 - current dir
     2 - configpath
     3 - compiler path
  }

But if you take a look at code, in fact it is:

 Order to read configuration file :
    try reading fpc.cfg in :
     1 - environement variable (/HOME)+'.'
     2 - configpath
     3 - /etc/


Fre;D
« Last Edit: March 13, 2021, 03:48:12 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Paths manually specified.
« Reply #8 on: March 13, 2021, 03:24:35 pm »
Thank you Fred, that is even clearer about the path priority of a config file... for now...

The best method is to take control for what I intend to do, to assure the desired outcome. In my book, -n option means no more confusion. For embedded, $HOME folder is enough. 
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Paths manually specified.
« Reply #9 on: March 13, 2021, 03:53:30 pm »
For embedded, $HOME folder is enough.

Yes but, afaik, the fpc.cfg must be in $HOME folder and hidden (a dot before), for example: /home/me/.fpc.cfg
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018