Enabling uTensor libraries (not available via Library manager)

Hi,

@maxgerhardt helped me resolve a similar issue in this thread. Also I noticed there was a similar issue link posted earlier and resolved similarly.

I tried the same technique for the uTensor libraries but it has not worked, what could I be doing wrong please? uTensor link

Image below shows where I copied the libraries into and the error I get on compilation.

Two ways:

  • Resturcture the library so that uTensor has two folders: include/ (all .h/.hpp files) and src/ (all .cpp files)
  • add the appropiate include flags to the platformio.ini, e.g.
build_flags =
	-I lib/uTensor/core
	-I lib/uTensor/loaders
	-I lib/uTensor/ops
	-I lib/uTensor/util
        -I lib/

Hi Max,

Thanks for jumping in again to help. I should have mentioned that I did try that structure /include and /src and moving the files but it gave the same error. Let me try the second method and report here.

Meanwhile I am trying this and will report on that too:

lib_extra_dirs = /Libraries/uTensor/uTensor

Since the cpp files include the file as uTensor/core/tensor.hpp, i.e the full path starting from uTensor, actually the method build_flags = -I lib/ should work.

1 Like

Hi Max,

I think the build_flags = -I lib/ worked. The ‘headers not found’ type errors don’t show up. The image below shows the host of other errors that came up - but I think they are code issues of the original uTensor library?

Thanks for helping. Also if you think this is now a issue with the library is there something you can suggest please :sweat:

Can you upload your current project so that I can take a look at it? (and execute the ‘Clean Project’ target so that you don’t upload the .pioenvs folder)

Dear Max,

Sorry it took me some time to understand what you meant by “Clean Project”, .pioenvs folder etc. I couldn’t find where to run that command - so I’ve uploaded the project to a git repo but made sure .pioenvs was in the .gitignore file

I hope you are able to access the repo. here> git repo

It was using the an old C++ language version for compiling which doesn’t have the features needed by uTensor. Finally it needs -D TARGET_MBED to prevent uTensor_util.cpp from trying to use filesystem function on a microcontroller with no filesystem (though you can add one using e.g. LittleFS). I can’t pull-request on your custom-domain github, so see my repository GitHub - maxgerhardt/pio-utensor: Example with PlatformIO and uTensor on an mbed-enabled board..

arm-none-eabi-objcopy -O binary .pioenvs\disco_l476vg\firmware.elf .pioenvs\disco_l476vg\firmware.bin
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [=         ]  12.9% (used 16920 bytes from 131072 bytes)
PROGRAM: [===       ]  27.0% (used 282944 bytes from 1048576 bytes)
 [SUCCESS] Took 128.48 seconds 
2 Likes

Dear Max

This solved it! Thank you so much.

Much to learn from you. I need to understand some of what you did – but I will save the questions for some other time.


Rajesh