Sign in Join

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

Mailing lists / lazarus / 2022-10

Possible Codetools issue for embedded targets in main branch

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Ring

I today looked at an issue posted in the lazarus forum:

https://forum.lazarus.freepascal.org/index.php/topic,60790.0.html

the user is unable to use ctrl-space for help because codetools cannot find the required unit rp2040.

I could not reproduce the issue with my older installation of lazarus-trunk but when I upgraded to latest trunk from today I saw the same issue.

Possible reason is that lazarus cannot extract the info about the unit source file from the output of the -ix format of fpc

I commented out a few log entries and got this result:

TFindDeclarationTool.FindUnitSource
Self="/Users/ring/devel/pico-fpcexamples/blinky/blinky.lpr" AnUnitName="RP2040" AnUnitInFilename=""
TCTDirectoryCache.FindUnitSourceInCompletePath AUnitName="RP2040" InFilename="" Directory="/Users/ring/devel/pico-fpcexamples/blinky/" TCTDirectoryCache.FindUnitSourceInCompletePath unit RP2040 not found in SrcPath="/Users/ring/devel/pico-fpcexamples/blinky;/Users/ring/devel/pico-fpcexamples/units" Directory="/Users/ring/devel/pico-fpcexamples/blinky/" searchin in unitset ...
TCTDirectoryCache.FindUnitInUnitSet
Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh TargetOS=embedded
TargetCPU=arm
Options=
FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/
Stamp=1" AUnitName="RP2040"
TFPCUnitSetCache.GetUnitSrcFile Unit="RP2040" SrcSearchRequiresPPU=False SkipPPUCheckIfTargetIsSourceOnly=True
TFPCUnitSetCache.GetUnitSrcFile Unit="RP2040" Result= TCTDirectoryCache.FindUnitInUnitSet
Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh#10TargetOS=embedded#10TargetCPU=arm#10Options=#10FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/#10Stamp=1" AUnitName="RP2040" Result=""
TCTDirectoryCache.FindUnitSourceInCompletePath unit RP2040 not found in unitlinks. Directory="/Users/ring/devel/pico-fpcexamples/blinky/" TCTDirectoryCache.FindCompiledUnitInUnitSet
Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh TargetOS=embedded
TargetCPU=arm
Options=
FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/
Stamp=1" AUnitName="RP2040.ppu"
TCTDirectoryCache.FindCompiledUnitInUnitSet
Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh#10TargetOS=embedded#10TargetCPU=arm#10Options=#10FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/#10Stamp=1" AUnitName="RP2040.ppu" Result=""
### TCodeToolManager.HandleException: [20170421200056] "unit not found: RP2040" in "/Users/ring/devel/pico-fpcexamples/blinky/blinky.lpr"

when I manually run the -ix command with my fpc I receive the hits I would expect:

~/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc -Tembedded -Parm -ix | grep -i rp2040
????? <controllertype name="RP2040" controllerunit="RP2040"/> ????? <controllertype name="RASPI_PICO" controllerunit="RP2040"/> ????? <controllertype name="FEATHER_RP2040" controllerunit="RP2040"/> ????? <controllertype name="ITZYBITZY_RP2040" controllerunit="RP2040"/> ????? <controllertype name="QTPY_RP2040" controllerunit="RP2040"/> ????? <controllertype name="TINY_2040" controllerunit="RP2040"/>

and I also find the unit in my fpcsrc directory:

find /Users/ring/fpcupdeluxe/fpcsrc -name "rp2040*" /Users/ring/fpcupdeluxe/fpcsrc/rtl/embedded/arm/rp2040.pp

I am stuck because I cannot find the correct implementation for TCTGetCompiledUnitFromSet althoug I searched through all sources for (const UnitSet, AnUnitName: string)

Michael

Please note that you will not find unit rp2040 in official trunk, only in my version but the same issue should be there for any other existing embedded comtrollerunit

Reply by email

Michael Ring
to Michael Ring

While investigating further I suddenly saw that the unit was detected.

So I did a complete fresh install via fpcupdeluxe, opened a project for rp2040, saw the error.

Then I selected 'rescan fpc source directory' and the issue was gone.

So not sure if this is an issue or not, it definitely does not fully work as expected.

Michael

Michael Ring wrote 100 lines
I today looked at an issue posted in the lazarus forum: https://forum.lazarus.freepascal.org/index.php/topic,60790.0.html the user is unable to use ctrl-space for help because codetools cannot find the required unit rp2040. I could not reproduce the issue with my older installation of lazarus-trunk but when I upgraded to latest trunk from today I saw the same issue. Possible reason is that lazarus cannot extract the info about the unit source file from the output of the -ix format of fpc I commented out a few log entries and got this result: TFindDeclarationTool.FindUnitSource Self="/Users/ring/devel/pico-fpcexamples/blinky/blinky.lpr" AnUnitName="RP2040" AnUnitInFilename="" TCTDirectoryCache.FindUnitSourceInCompletePath AUnitName="RP2040" InFilename="" Directory="/Users/ring/devel/pico-fpcexamples/blinky/" TCTDirectoryCache.FindUnitSourceInCompletePath unit RP2040 not found in SrcPath="/Users/ring/devel/pico-fpcexamples/blinky;/Users/ring/devel/pico-fpcexamples/units" Directory="/Users/ring/devel/pico-fpcexamples/blinky/" searchin in unitset ... TCTDirectoryCache.FindUnitInUnitSet Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh TargetOS=embedded TargetCPU=arm Options= FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/ Stamp=1" AUnitName="RP2040" TFPCUnitSetCache.GetUnitSrcFile Unit="RP2040" SrcSearchRequiresPPU=False SkipPPUCheckIfTargetIsSourceOnly=True TFPCUnitSetCache.GetUnitSrcFile Unit="RP2040" Result= TCTDirectoryCache.FindUnitInUnitSet Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh#10TargetOS=embedded#10TargetCPU=arm#10Options=#10FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/#10Stamp=1" AUnitName="RP2040" Result="" TCTDirectoryCache.FindUnitSourceInCompletePath unit RP2040 not found in unitlinks. Directory="/Users/ring/devel/pico-fpcexamples/blinky/" TCTDirectoryCache.FindCompiledUnitInUnitSet Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh TargetOS=embedded TargetCPU=arm Options= FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/ Stamp=1" AUnitName="RP2040.ppu" TCTDirectoryCache.FindCompiledUnitInUnitSet Directory="/Users/ring/devel/pico-fpcexamples/blinky/" UnitSet="CompilerFilename=/Users/ring/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc.sh#10TargetOS=embedded#10TargetCPU=arm#10Options=#10FPCSrcDir=/Users/ring/fpcupdeluxe/fpcsrc/#10Stamp=1" AUnitName="RP2040.ppu" Result="" ### TCodeToolManager.HandleException: [20170421200056] "unit not found: RP2040" in "/Users/ring/devel/pico-fpcexamples/blinky/blinky.lpr" when I manually run the -ix command with my fpc I receive the hits I would expect: ~/fpcupdeluxe/fpc/bin/x86_64-darwin/fpc -Tembedded -Parm -ix | grep -i rp2040 ????? <controllertype name="RP2040" controllerunit="RP2040"/> ????? <controllertype name="RASPI_PICO" controllerunit="RP2040"/> ????? <controllertype name="FEATHER_RP2040" controllerunit="RP2040"/> ????? <controllertype name="ITZYBITZY_RP2040" controllerunit="RP2040"/> ????? <controllertype name="QTPY_RP2040" controllerunit="RP2040"/> ????? <controllertype name="TINY_2040" controllerunit="RP2040"/> and I also find the unit in my fpcsrc directory: find /Users/ring/fpcupdeluxe/fpcsrc -name "rp2040*" /Users/ring/fpcupdeluxe/fpcsrc/rtl/embedded/arm/rp2040.pp I am stuck because I cannot find the correct implementation for TCTGetCompiledUnitFromSet althoug I searched through all sources for (const UnitSet, AnUnitName: string) Michael Please note that you will not find unit rp2040 in official trunk, only in my version but the same issue should be there for any other existing embedded comtrollerunit

Reply by email

Mattias Gaertner
to Michael Ring
Show quoted text 9 lines
While investigating further I suddenly saw that the unit was detected. So I did a complete fresh install via fpcupdeluxe, opened a project for rp2040, saw the error. Then I selected 'rescan fpc source directory' and the issue was gone. So not sure if this is an issue or not, it definitely does not fully work as expected.

Your cache was outdated. When you update the FPC sources and some units are added/removed/moved, you should use the rescan.

Mattias

Reply by email

Mattias Gaertner
to Alfred
Show quoted text 5 lines
Sidenote request, as fpcupdeluxe maintainer. It would be nice if the rescan procedure would be reacheable from the outside. Fpcupdeluxe would like to use it when updating/installing sources. Thanks.

Outside means here IPC or a public method?

Mattias

Reply by email

Alfred
to Mattias Gaertner

If I am free to make this request, the most easy method (for me) would be a boolean setting in miscellaneousoptions.xml.
Something with the name "Force-rescan" that gets reset when the rescan has been performed when Lazarus has been started and the rescan is finished.
I know I ask a lot, but this would serve me well ... ;-)

Greetings, Alfred.

Earlier message 20 lines
------ Original Message ------ >From "Mattias Gaertner" To Cc "Alfred" Date 10/7/2022 8:19:12 AM Subject Re: [Lazarus] Possible Codetools issue for embedded targets in main branch >On Fri, 07 Oct 2022 06:00:28 +0000 >Alfred via lazarus wrote: > >>Sidenote request, as fpcupdeluxe maintainer. >>It would be nice if the rescan procedure would be reacheable from the outside. >>Fpcupdeluxe would like to use it when updating/installing sources. >>Thanks. > >Outside means here IPC or a public method? > >Mattias >

Reply by email

Mattias Gaertner
to Alfred
Show quoted text 6 lines
If I am free to make this request, the most easy method (for me) would be a boolean setting in miscellaneousoptions.xml. Something with the name "Force-rescan" that gets reset when the rescan has been performed when Lazarus has been started and the rescan is finished. I know I ask a lot, but this would serve me well ... ;-)

If you just need a rescan on start, you can simply delete fpcdefines.xml

Mattias

Reply by email