duff2013 / ulptool

Program the esp32 ULP coprocessor in Arduino
272 stars 66 forks source link

Compile fails for non-ulp project #26

Open Rain92 opened 5 years ago

Rain92 commented 5 years ago

Thanks to #25 I got this tool running nicely under windows python 3 and esp 1.0.1. However every time I want to compile a project without any ulp code I get the error message: xtensa-esp32-elf-gcc*: error: [...]\ulp_main.bin.bin.o: No such file or directory

It would be nice if this could be handled automatically.

duff2013 commented 5 years ago

oh man thanks for letting know!

Vincent-Stragier commented 5 years ago

Yes, same error (I've used 'blink' to test it). But I don't think that comes from the 'esp32ulp_build_recipe.py' script since it just open, close 'ulp_main.ld' and exit the script in this case. My only clue is the 'platform.local.txt' file but I don't know the syntax...

duff2013 commented 5 years ago

For the time being to get it to compile just add blank .s file to your sketch.

Vincent-Stragier commented 5 years ago

Examples are in a read only directory. I'll try to find an other workaround since just automatically creating an empty 'ulp.s' file is not really an option for the examples.

Vincent-Stragier commented 5 years ago

After 'some' investigations, I found that the issue comes from the extra flag

compiler.c.elf.extra_flags="-L{build.path}/sketch/" -T ulp_main.ld "{build.path}/sketch/ulp_main.bin.bin.o"

in "platform.local.txt".

So it will be useful to add a conditional statement somehow... IDK for the moment.

Edit: I omit to say that commenting this line (Add ## in front of the line) is a tested working workaround for the examples.

Vincent-Stragier commented 5 years ago

I don't think it's possible to have a conditional statement in the 'platform.local.txt'. So, maybe overwriting the recipe:

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf" 

in the 'platform.local.txt', use a python script to add flag or no. @duff2013 do you think it can be a fix for this issue ?

Edit: Maybe the main python script can also handle this task.

duff2013 commented 5 years ago

I have a fix, basically I just create a blank temporary .s file and compile it to get those files after I delete that temporary file. This is not a complete fix because it might use 12 bytes Slow RTC memory but I hope it will work for now until I can figure out a better way.

@2010019970909 The only way I can see the script being able to handle this is if there are no ulp files detected then delete the flags in my platform.local.txt file or add them to it if there are. But for now the fix I have works and need to publish some more pressing fixes for other big issues with how the ulp is allocated RTC Memory in the esp core at compile time.

Vincent-Stragier commented 5 years ago

On my fork, I've added an modified 'platform.local.txt' file to launch a script ('recipe_c_combine_pattern.py') which build the correct command for the gcc compiler. As usually, I've tested it only on windows.