Report
2 months, 1 week ago.

Eclipse CDT Indexing/Parser Issue

Hi Guys,

Brand new mbed user here. I've spend the whole weekend setting up my development environment, and I'm nearly there with it. I'm using Eclipse (latest release) on Ubuntu as my debug environment, and along with a NUCLEO-L433RC-P board. I have installed OpenOCD, the arm-none-eabi-gcc toolchain, and mbed-cli, everything seems to be working well. I can can clone an example repo (blinky for instance), run an mbed-cli export for GCC_ARM and my specific board to generate the Makefile and other bits that I can then import into Eclipse. I have configured Eclipse to debug using OpenOCD and I can successfully build using make and step through the code no worries!

The only issue I could not resolve this weekend is the fact that Eclipse indexes only a small fraction of my project, and I'm left with #ifdef statements that visually appear to be evaluated wrongly, undefined macros, variables with squiggly lines, basically a nightmare scenario to begin debugging in. I need to get this resolved before I can start my project, so any help is greatly appreciated. To illustrate my point. My Makefile appears to contain all the right stuff, including direct reference to the directory for my board header files:

INCLUDE_PATHS += -I.././mbed-os/targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L433xC/TARGET_NUCLEO_L433RC_P

If I don't include "PinNames.h" from this dir manually in my main.cpp file, then "LED1" has a red squiggle under it. If I include that file manually, it disappears.

Another example, I loaded the 'ThisThread' project. I have in my mbed_config.h:

  1. define MBED_CONF_RTOS_PRESENT 1

Yet when I explore the source file mbed_wait_api_rtos.cpp, the whole file is wrapped with #ifdef MBED_CONF_RTOS_PRESENT, #endif, and it's all greyed out. When I come to compile and run the project, it works fine! So that #ifdef must have evaluated to true.

I have tried following hints and guides from the following sources:

https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_newproj_discovery_options.htm https://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_pref_build_scanner_discovery.htm https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_proj_paths.htm https://os.mbed.com/forum/bugs-suggestions/topic/27892/?page=1#comment-52933 https://stackoverflow.com/questions/8480840/how-do-i-make-eclipse-acknowledge-my-include-files-in-a-c-existing-makefile-pr https://devzone.nordicsemi.com/f/nordic-q-a/7690/unresolved-headers-with-eclipse https://devzone.nordicsemi.com/tutorials/b/getting-started/posts/development-with-gcc-and-eclipse https://32bits.io/blog/2017/6/13/eclipse-cdt-indexing-with-makefiles https://bugs.eclipse.org/bugs/show_bug.cgi?id=423199 https://bugs.eclipse.org/bugs/show_bug.cgi?id=471223

And I've gotten nowhere. Really need some help from experienced people in this area to help me resolve this final hurdle!

Thanks guys,

Dan

Sorry I don't understand, why aren't you using MBED Studio ? I believe its based on Eclipse but using the pukka Arm 6 compiler.

https://os.mbed.com/studio/

posted by Paul Staron 08 Apr 2019

I'm running Ubuntu, and unfortunately Mbed Studio is not currently supported. I may try using vscode instead as it looks like studio is based on VSC

posted by Daniel Beckett 09 Apr 2019

You might want to try System Workbench. Similar toolchain but some of these issues will have been worked out. It says Linux is supported but I've not used it there. It works quite well on Windows. I would still expect a battle getting exported mbed project to compile though. Issues are usually around include paths and making sure to exclude files your project doesn't actually need.

posted by Graham S. 09 Apr 2019

Great, thanks for the suggestion!

posted by Daniel Beckett 09 Apr 2019
Comment on this question

3 Answers

2 months, 1 week ago.

Daniel, Tell us what you decided to do and how it worked out. I have been working with SW4STM32 on Win-10 with basically no success so far getting an mbed project going so am interested in alternative solutions. Especially if they work ;-).

I will post a link showing how to set eclipse for mbed later on when i am with my pc.

U also can try platformio.

posted by Kamil M 11 Apr 2019

Easy Debugging Environment Setup

Okay so I have a running, fully indexed debug project running in both Windows and Linux. The answer was to switch to System Workbench.

I had installed OpenOCD, pyOCD, the ARM GNU toolchain, python, eclipse, VSC, a ton of dependent packages etc etc and not managed to completely get there with a debug environment. ST have created System Workbench, based on Eclipse, and have included basically everything you need to build a fully featured debugging environment.

I was using a NUCLEO_L433RC_P board to develop with, I found that I could not export the project. When checking the supported IDE/board matrix against the blinky example, I saw that exporting to SW4STM32 using a NUCLEO-L433RC-P board was not possible. I bought a NUCLEO_L476RG board and tried with this instead. Here are the steps that worked twice, on two different computers, running two different operating systems:

1. Install the mbed-cli:
https://os.mbed.com/docs/mbed-os/v5.6/tools/setup.html

2. Use mbed-cli to import blinky
$ mbed import mbed-os-example-blinky
$ cd mbed-os-example-blinky

3. View supported boards matrix (optional)
$ mbed export --supported

4. Export the project to System Workbench. Obviously switch the board here for yours.
$ mbed export -i sw4stm32 -m NUCLEO_L476RG

5. Install System Workbench with installer (not from Eclipse). You need to register. gksudo isn't available in Ubuntu anymore, so just do it from the command line.
http://www.openstm32.org/HomePage

6. Run System Workbench (./eclipse in install dir from command line)

7. Import project (it'll detect two separate projects from within blinky)

8. Admire a now fully-indexed project, browse some definitions if you want to treat yourself.

9. Build (it just works straight out of the box)

10. Debug (it just works straight out of the box)

11. Enjoy and thank the OpenSTM32 community for doing all the PITA work for you.

posted by Daniel Beckett 11 Apr 2019

I also managed to get VSCode workng - this is my IDE of choice now, it's brilliant. All I did was follow the mbed setup guide word for word, and in the launch.json file:

"debugServerArgs": "-f /interface/stlink.cfg -f /target/stm32l4x.cfg", "serverStarted": "Info : Listening on port 4444 for telnet connections",

"linux": { "MIMode": "gdb", "MIDebuggerPath": "arm-none-eabi-gdb", "debugServerPath": "openocd" },

posted by Daniel Beckett 13 Apr 2019
2 months, 1 week ago.

Paul

Mbed studio is not based on eclipse and still have some serious problems, at least for me.

Dan, I also started with Eclipse plus gcc and spun out. System Workbench worked better but my sequence was a little different from yours. Knowing that it can be done is a mighty good handhold and I will try it one more time. Thank you (a lot)!

posted by Stefan King 11 Apr 2019
2 months, 1 week ago.

Hello Daniel,

Mbed CLI covers all target boards and supports both Mbed OS2 an Mbed OS5. No hassle with tailoring makefiles after export. Team Mbed did a really good job. The only disadvantage is the old style interface. But that can be enhanced to a GUI based IDE while Mbed CLI is still running in the background and doing the compilation job as before. The tutorial contains lot of details so at first glance it seems like lot of effort is needed to configure. Indexing works as it should. Big advantage is also that the mbed_app.json, mbed_lib.json and custom_targets.json files are processed automatically. Importing and using libraries is easy too. It works on Linux and Windows. If you are interested then have a look at Building offline with Qt Creator IDE.

Your tutorial is fantastic Zoltan! Thanks ever so much for sharing it, QTCreator looks like great application. I'll give this a go for sure, and see if I prefer using that IDE instead of SW4STM32. It looks very modern, more like VSCode (which I also really like) with better support for micro debugging.

posted by Daniel Beckett 11 Apr 2019

No joy with sw4stm32; I get many compile errors, symbol asm is undefined, macro expansion errors, and so on. I will try blowing everything clean, hoping there's nothing lurking in the registry (damn windows), and reinstalling. It may have to wait till after tax time tho. Zoltan, I may be on the Qt Creator train soon, your tutorial looks magnificent.

update Ripped out sw4stm32, installed install_sw4stm32_win_64bits-latest.exe from openstm32.org. For some reason, no binaries get installed although I tried it several times. It does deposit a .zip way down in the tools directory. Unzipping that by hand every which way never seems to create the right directory structure and sw4stm32 is never happy. I think mbed-cli is working, but sw4stm32 cannot compile the results. Basic defines are missing and it whines about g++ not in path. Extracting the PATH defines from Eclipse's brain is next to see if I can figure out what it wants. My girlfriend has left me, my dog barks at me, and updates will have to be sent from federal prison where I will be serving a rap for failure to comply with tax law.

I blew most of yet another day trying to get the mbed-import-export-to-sw4stm32 to work. I have tried install_sw4stm32_win_64bits-v2.8 and install_sw4stm32_win_64bits-latest many times each. I did discover that the install is not really complete until you fire up system workbench the first time, which is why I couldn't find the .exe's after the "install". But it didn't help. mbed config minusminus list shows GCC_ARM_PATH=c:\Ac6\Systemworkbench\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.17.0.201812190825\tools\compiler\bin I do get two projects showing up in sw4stm32, eventOS, and mbed-os-example-blinky. Project->Build All runs about 10 minutes and produces 8 errors, 'asm' undeclared, g++ not found, gcc not found, "make" not found in path, recipie for flash_api.o failed, 4 invalid project paths, i.e. include paths not found. I have tried various ways to import from mbed, "Open projects from file system" seems to work the best, not that it works. Import project with a working makefile from the Welcome page imports only 1 project which is not what Dan said worked for him, so that can't be right. I am using a NUCLEO_F401RE board, which is supposed to be supported. I have done all of the checks for mbed, pip, python, git, and hg. I would really like to know what is wrong with this thing.

Dan, Is there any chance you could do this for me? On your windows box, right click on mbed-os-example-blinky -> Export... C/C++ Project Settings (Next) mbed-os-example-blinky + Debug, Include Paths + Symbols export to an .xml file. and send it to me at stefank2 (atsign) yahoo d0t com ?

posted by Stefan King 12 Apr 2019

To post an answer, please log in.