Page 1 of 1

[solved] Issues using libopencm3 with TrueStudio

Posted: Tue May 14, 2019 5:56 am
by Contumas
Hello,

I have issues trying to make libopencm3 work. I use Atollic TrueStudio v9.3.0 on Windows 10, and have a STM32F4-Discovery board.

I try to import the library and whatever the way I try (from archive, file or git) I systematically fail to compile.

here is how I proceed:
- Run Atollic TrueStudio
- File / Import / Projects from file or archive
- select the archive I downloaded from libopencm3 git repository
- the import come without error or warning
- I define STM32F4 in the project properties, under C/C++ general / Path & symbols / symbols for all languages and configurations. this doesn't need a value. it jusst appears in the source code to load appropriate H files based on your MCU.
- Then I do a 'freshen all files' and 'index rbuild'.
- I launch a build and get the first error : "fatal error : libopencm3/stm32/dac.h: no such file or directory" in 'dac.c'.
- I open the code for 'dac.c' and select the include. Then I press "F3" which is the key for jumping to the selected include, and it works, which means that TrueStudio knows where the file is, otherwise "F3" does nothing at all.

So, TrueStudio is not able to compile because he doesn't know where to find files he knows where they are o_0

I'm a hobbyist, clearly not at ease with C/C++, but I searched and tried a lot before asking. I'm keen to learn, and I'm not waiting for a solution, any hint or guidance will be welcome.
I hope you will be able to help me.
best regards,
Contumas

Re: Issues using libopencm3 with TrueStudio

Posted: Tue May 14, 2019 10:58 pm
by alister
> I open the code for 'dac.c' and select the include. Then I press "F3" which is the key for jumping to the selected include, and it works
This means Eclipse can find dac.h. The files visible to Eclipse are listed in its Project Explorer.

> "fatal error : libopencm3/stm32/dac.h: no such file or directory" in 'dac.c'.
This means GCC can't find dac.h. You have to tell GCC where to look for its include files. Right-click your project in Project Explorer and select Properties, and then C/C++ Build -> Settings, select the Tool Settings tab, C or C++ Compiler -> Directories. In the Configuration bar, select "[ All Configurations ]". Best practice is to specify relative paths. That way, presuming you're versioning controlling, your files will be found regardless of the directory your repository is cloned to. GCC's directory is the build configuration's directory, typically named Debug or Release.

Re: Issues using libopencm3 with TrueStudio

Posted: Wed May 15, 2019 4:46 am
by Contumas
Hi Alister
I'll check this evening when back home. Anyway, many thanks for your support.
Contumas.

Re: Issues using libopencm3 with TrueStudio

Posted: Thu May 16, 2019 5:41 am
by Contumas
Hi Alister,
thanks a lot for your help, it worked fine. I still have some errors, but none related to this symptom.
regards,
Contumas.