ulptool icon indicating copy to clipboard operation
ulptool copied to clipboard

Underinvestigation

Open outoftrun opened this issue 3 years ago • 15 comments

outoftrun avatar Jul 12 '21 13:07 outoftrun

I am running esp32 version 2.0.0-alpha1, and the latest version of your code. The esp32ulp_build_recipy.py does not find any. '*.s' files in my '/tmp/.....' dir. If I manual copy them from my src dir everything works but whatever function had copied them to that dir is no longer doing so.

============================================== uname -a "Linux ThinkPad-T61 5.4.0-77-lowlatency #86-Ubuntu SMP PREEMPT Thu Jun 17 03:26:36 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux"

outoftrun avatar Jul 12 '21 13:07 outoftrun

This seems to have fixed my problem. I'm using the ulp_README.ino sketch from ulp_examples. I have to compile twice, once to generate the temporary folder, then the next time after copying over the ulp.S file. The first time I compiled, i received the following errors:

C:\Users\<user>\AppData\Local\Temp\arduino_build_598897\sketch\ulp_README.ino.cpp.o:(.literal._Z5setupv+0x1c): undefined reference to `ulp_count'
C:\Users\<user>\AppData\Local\Temp\arduino_build_598897\sketch\ulp_README.ino.cpp.o:(.literal._Z5setupv+0x20): undefined reference to `ulp_entry'

After this, I deleted all the files in the C:\Users\<user>\AppData\Local\Temp\arduino_build_598897\sketch folder, then copied over the ulp.S file from the sketch folder.

I'm running Arduino IDE version 1.8.15 (Windows Store 1.8.49.0). It does not seem to use nor need the C:\Users\<user>\AppData\Local\Arduino15\packages\esp32 folder. The ulptool installation instructions have been applied to the C:\Users\<user>\Documents\ArduinoData\packages\esp32\tools folder instead.

The Arduino IDE is installed in C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt.

The contents of the temp folder, after successful compilation, are as below, with the ulp.S file having been manually copied over from the main sketch folder:

size in bytes, filename:
           313 ulp.s
            18 ulp.ulp.d
           448 ulp.ulp.lst
           572 ulp.ulp.o
           174 ulp.ulp.pS
            36 ulp_main.bin
           492 ulp_main.bin.bin.o
           339 ulp_main.common.d
           453 ulp_main.common.ld
         8,716 ulp_main.elf
           183 ulp_main.h
           198 ulp_main.ld
         1,253 ulp_main.map
            40 ulp_main.sym
         1,641 ulp_README.ino.cpp
        15,330 ulp_README.ino.cpp.d
       763,616 ulp_README.ino.cpp.o

17 File(s)        793,822 bytes total

mahesh2000 avatar Jul 27 '21 04:07 mahesh2000

Also, printing the contents of glob in C:\Users\<user>\Documents\ArduinoData\packages\esp32\tools\ulptool\src\esp32ulp_build_recipe.py,

    print("glob:")
    print(glob.glob('*.*'))

shows the following without ulp.S the first time around. When run the second time, after the file has been copied over, it shows the result below:

glob:
['esp32_ulp_test1.ino.cpp', 'esp32_ulp_test1.ino.cpp.d', 'esp32_ulp_test1.ino.cpp.o', 'tmp.ulp.d', 'tmp.ulp.lst', 'tmp.ulp.o', 'tmp.ulp.pS', 'ulp.s', 'ulp_main.bin', 'ulp_main.bin.bin.o', 'ulp_main.common.d', 'ulp_main.common.ld', 'ulp_main.elf', 'ulp_main.h', 'ulp_main.ld', 'ulp_main.map', 'ulp_main.sym']

mahesh2000 avatar Jul 27 '21 04:07 mahesh2000

i had the same errors "undefined reference to `ulp_count'" and ".. to 'ulp_entry'".

i confirm that finding the temp folder for the build (in /var/folders////arduino_build_/ on macos), deleting sketch/*, copying ulp.s over manually and then recompiling works.

xandercrews avatar Jul 31 '21 05:07 xandercrews

so, when i use a hook to copy the .s file(s) to the tempdir it resolves it afaict (not windows):

recipe.hooks.core.prebuild.01.pattern=sh -c 'cp -vp {build.source.path}/*.s {build.path}/sketch/ | sed s,^,ASMFIXUP:,'

xandercrews avatar Jul 31 '21 07:07 xandercrews

is there a windows substitute?

mahesh2000 avatar Jul 31 '21 21:07 mahesh2000

i should think some similar xcopy command but i don't have a windows machine to try it on- in linux the key problem is that it won't invoke the command through a shell to expand the glob so you have to explicitly run it in one.

you could also make a little python program that you pass {build.source.path} and {build.path}, which would glob(os.path.join(sys.argv[1], '*.s')) and copy what it finds into sys.argv[2], similar to how these hooks invoke esp32ulp_build_recipe.py

xandercrews avatar Jul 31 '21 22:07 xandercrews

if python isn't your jam and you'd like help, lmk

xandercrews avatar Jul 31 '21 22:07 xandercrews

i wonder what broke. maybe arduino gui used to copy case-insensitive *.S and now it's case-sensitive?

xandercrews avatar Jul 31 '21 22:07 xandercrews

recipe.hooks.core.prebuild.01.pattern.windows=cmd /c copy /y {build.source.path}\*.s {build.path}\sketch\ works for me (windows)

angyongen avatar Aug 06 '21 13:08 angyongen

Python definitely isn't my jam, bread or butter :-). Any help is appreciated. Right now, I'm copying over s files when updated to the temp folder. Your help would be greatly appreciated!

On Saturday, July 31, 2021, xandercrews @.***> wrote:

if python isn't your jam and you'd like help, lmk

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/duff2013/ulptool/issues/78#issuecomment-890412951, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH7ZSRCL6TURDBHCPG4BNTT2R4WHANCNFSM5AG3TTWQ .

mahesh2000 avatar Aug 06 '21 15:08 mahesh2000

new updated command because my previous one had an error when there are no .s files. and also doesnt work if source path has spaces (place this in platforms.local.txt): recipe.hooks.core.prebuild.01.pattern.windows=cmd /c if exist "{build.source.path}\*.s" copy /y "{build.source.path}\*.s" "{build.path}\sketch\" @mahesh2000 maybe you can try this

angyongen avatar Aug 07 '21 04:08 angyongen

that seems to work!

On Sat, Aug 7, 2021 at 12:53 AM angyongen @.***> wrote:

new updated command because my previous one had an error when there are no .s files. and also doesnt work if source path has spaces (place this in platforms.local.txt): recipe.hooks.core.prebuild.01.pattern.windows=cmd /c if exist "{build.source.path}*.s" copy /y "{build.source.path}*.s" "{build.path}\sketch" @mahesh2000 https://github.com/mahesh2000 maybe you can try this

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/duff2013/ulptool/issues/78#issuecomment-894604655, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH7ZSVPMFCYPZUC3R7RVRLT3S33PANCNFSM5AG3TTWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

mahesh2000 avatar Aug 11 '21 01:08 mahesh2000

This solved my problem as well

jacoboth7 avatar Nov 14 '22 19:11 jacoboth7