duff2013 / ulptool

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

Support for Platform IO ? #4

Closed timpur closed 5 years ago

timpur commented 6 years ago

... :/

duff2013 commented 6 years ago

sure, how would that happen?

timpur commented 6 years ago

I opened up a ticket in https://github.com/platformio/platform-espressif32/issues/95

think it would have something to do with this file https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py

but i dont know enough yet ...

Thanks for helping :)

duff2013 commented 6 years ago

Looks like they use SCon to build and I guess if they use esp-idf framework all the ulp build stuff should be there also.

timpur commented 6 years ago

It sounds like you know way more than me .... :p

jubueche commented 5 years ago

So I have followed all the steps, but I can not compile. Maybe you, @duff2013 , have an idea what is going on:

My setup: Ubuntu PlatformIO Arduino Framework

The folder structure is a little different, but judging from the platform.txt file it should not be a problem. Here are some paths of the folders: .platformio/packages/framework-arduinoespressif32/tools/binutils/esp32ulp-elf-binutils/ In .platformio/packages/framework-arduinoespressif32/tools/ I have the files/folders: binutils espota.py gen_esp32part.py partitions sdk build.py esptool.py get.py platformio-build.py And my platform.txt is located in: ~/.platformio/packages/framework-arduinoespressif32

My folder structure of the program is: -lib ----chaze-ulp (name of project) --------ulp_main.h --------ulp.s -src ----main.cpp

When I compile using verbose mode I get (truncated): xtensa-esp32-elf-as -x assembler-with-cpp -o .pioenvs/featheresp32/lib287/chaze-ulp/ulp.s.o lib/chaze-ulp/ulp.s xtensa-esp32-elf-ar rc .pioenvs/featheresp32/libFrameworkArduinoVariant.a xtensa-esp32-elf-as: unrecognized option '-x' *** [.pioenvs/featheresp32/lib287/chaze-ulp/ulp.s.o] Error 1 xtensa-esp32-elf-ranlib .pioenvs/featheresp32/libFrameworkArduinoVariant.a

Unfortunately this error code doesn't give me much information. I suppose this can also be raised for example when extern is misused? I was wondering why we use extern const uint8_t ulp_main_bin_end[] asm("_binary_ulp_main_bin_end"); And how the Assembly file is actually included using this command. How does the compiler know that ulp.s is the Assembly file to use?

Any help and/or explanation is appreciated.

duff2013 commented 5 years ago

I have never used platformIO so I'm really not sure whats going on for you. The .s files are unique to how I differentiate between the ulp and xtensa assembly files for Arduino. Xtensa assembly is not the same as ulp assembly so I you need the binutils compiler files but again I have no idea how platformIO compiles it's files so you will have to drill down on that first, maybe they have a verbose mode you can glean on how they compile and build your programs and go from there.

sch0bert commented 5 years ago

Hello @duff2013

Just to be clear about this, is there something that Espressif or you need to add to their framework so it could compile ULP code in PlatformIO? Because I'm having a hard time understanding who should add the support.

Regards, Pascal.

duff2013 commented 5 years ago

I have never used platform.io for anything so I'm not sure how it compiles esp32 code. If you can run user scripts during the compile time then you could modify my python script to work with platform.io I would think. Right now I'm focused on Arduino and might get to platform.io once I have a solid installer for Arduino.

sch0bert commented 5 years ago

Ok, then I think is something that is, for now, out of your scope and should be on PlatformIO engineers ( I guess). This issue can be close then?

duff2013 commented 5 years ago

Not out of my scope but just need to lock up the Arduino part first.

sch0bert commented 5 years ago

Great, is there an ETA?

Vincent-Stragier commented 5 years ago

Hello,

There is some useful information for this 'issue'/'improvement': https://docs.platformio.org/en/latest/projectconf/section_env_build.html https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html#projectconf-advanced-scripting

I hope it will be useful in the future.

sch0bert commented 5 years ago

Thanks, I will keep these links for the future.

Seems like the PlatformIO team will add the support soon:

https://community.platformio.org/t/ulp-main-h-is-not-found-in-esp-idf-when-i-compile/6387/12 https://github.com/platformio/platform-espressif32/issues/95

duff2013 commented 5 years ago

Ok sounds good they would be better at implementing this than me right now.

maxgerhardt commented 5 years ago

Implemented in PIO, see here and example here, please close.