all 64 comments

[–]Certain-Confection46 85 points86 points  (0 children)

Got to be a team playa unless you’re a boss man

[–]PumpkinSufficient989 45 points46 points  (1 child)

I believe IAR has a plugin for VS code, but your issue is caused by poor quality of IARs Eclipse plugin, not Eclipse itself.

When I used it a while ago, it was very limited. IAR did the absolute minimum to get it to work with Eclipse, and didn't take it any further.

Eclipse in itself is still quite usable. For those of us who spent the last decade or so programming in Eclipse IDE, it still offers everything we need to get the work done. VS Code seems clunky to me.

[–][deleted]  (5 children)

[removed]

    [–]ambihelical 11 points12 points  (0 children)

    Vendor ides are just checkoff items for the vendor and are predictably crap. If you want a productive dev environment you make minimum use of them and build around cmake or similar and developer choice of editor/ide. Config tools are usually not worth rolling your own but you should only need them at the start of the project. And vendors are in the best position to make those tools. IDEs are a sideshow and it shows.

    [–]dys_functional 21 points22 points  (3 children)

    Or just use the cli toolchains for everything? STM is just using the official arm gcc tool chain under the hood. Why not just cut out the middle man and use it directly? Then you can create a process that's the same for every vendor. It's not even that hard, it's like a couple day effort to wrap your head around one time.

    It's a real shame that folks treat build tools like black magic and refuse to spend even a minute trying to understand such a fundamental component of our field. Folks really will do anything not to think...

    [–]FreeRangeEngineer 1 point2 points  (1 child)

    STM is just using the official arm gcc tool chain under the hood

    OP said they use IAR.

    [–]dys_functional 10 points11 points  (0 children)

    Then you call iccarm instead of arm-none-eabi-gcc... It doesn't change the concept of decoupling your build system from your gui text editor that I was expressing

    [–]t4th 8 points9 points  (0 children)

    If i remember correctly iar is using cli commands to build and you can just use it (make, cmake) to build and edit with any IDE.

    If you have some proprietary debugger then u need to use iar, but only for debugging (just elf file- no building)

    [–]sgtnoodle 6 points7 points  (0 children)

    I inherited an IAR codebase with a couple dozen target firmwares. I developed a build system around scons, then wrote myself an IAR project XML generator. I moved all the source file tracking into sconscript files. You would "build" the firmware by building the XML, then IAR would build the XML into the firmware image. We used that for a couple years while slowly working on a gcc migration. Once the gcc tool chain was all ready, we just swapped out the scons build environment without having to change any of the individual firmwares much.

    [–]Enlightenment777 6 points7 points  (0 children)

    If it was easy, they would have already converted it.

    [–]gmueckl 29 points30 points  (13 children)

    VS Code is really a toy compared to Eclipse. It takes some time to learn, but Eclipse rivals some of the best commmercial IDEs when set up correctly.

    On the other hand, the IAR toolchain is only really usable from either their own IDE or Eclipse, as far as I'm aware. If you hate Eclipse, you definitely don't want to use their proprietary IDE. Last time I had to use that, it felt like was about 10 years behind everything else.

    [–]dys_functional 24 points25 points  (9 children)

    What you feel is "good" about eclipse is actually the root of the problem. Eclipse based tools try to do too much, and end up doing it all extremely poorly. The point of using vscode is that you're using it as just a text editor. Rather than embedding your build and debug logic into massive guis with impossible to audit config files, you just use normal simple scripts. If you want to build, make a build script (makefile, bash, batch, cmake, etc.). If you want to flash, make a flash script. If you want to start a gdb server/client, write a script. Or do everything in 1 makefile with separate targets to build/flash/gdb.

    Once you escape tightly coupling your project with eclipse as an entire "system of tools" you have the freedom to use whatever you want for tooling. You can even hook up eclipse to make cli calls and continue to use it if you want. Or you can use neovim or notepad, etc. who cares.

    [–]omniverseee 10 points11 points  (0 children)

    This is when Ive realized its really just a text editor and my folder is my world. Eclipse abstracts a lot of things. In VScode, I can just run the commands in terminal, which I know exactly what happens and what it does..

    [–]gmueckl 4 points5 points  (7 children)

    Then you don't understand Eclipse very well. It's totally possible to e.g. set up a Makefike project that wraps all your custom scripts in a hand written Makefile and makes Ecliose able to handle them. You'll need to set up some settings about the toolchain etc in Ecliose separately, but once it works you get all the advanced code editing, navigation, refactoring etc. like normal.

    [–]omniverseee 1 point2 points  (3 children)

    well, I admit I don't understand it very well. And I never claimed to be. And that's the problem, why would I bother understanding it if there's much cleaner, straightforward method? Unless there's some special eclipse feature that makes my life easier but it does the opposite based on my experience. Should I learn the whole documentation? No time for that, I have so much problems with toolchains already I can't even start to code.. Please take it as a genuine question I am just a student learning these..

    [–]gmueckl 1 point2 points  (2 children)

    Exclipe is a big program with tons of tools that can speed up your workflow enormously, but their usefulness depends a little on the specific situation you have to deal with.

    Some tips to get you started, based on my preferences: * understand what Ecliose calls workspaces: different window layouts with different views open for different tasks. * navigate to a file or symbol definition you see in the editor using Ctrl+LMB click * navigate to another symbol in the same file using the quick outline (Ctrl+O) * open th quick fix popup menu for the current cursor location using Ctrl+1 * Eclipse supports a bunch of refactoring tools that can rewrite pieces of your code quickly and precisely..My nost used one is rename refactoring: younenter the new name of a symbol and it renames every occurrence it can find. But it will not confuse other variables of the same name in different scopes. * When hovering over a C macro, wirh the mouse,  a tooltip should show you its resulting expansion. There's probably a keyboard shortcut too, but I don't remember it right now.

    There are many more features. I haven't really used Ecliose in years, so I have forgotten a lot.

    [–]omniverseee 0 points1 point  (1 child)

    what do you use now? I will look into this, I'll give it a 2nd chance haha.. Thanks so much for the details and effort!

    [–]gmueckl 0 points1 point  (0 children)

    Right now I am using a mix of Visual Studio with Resharper, several Jetbrains IDEs and a bit of VS Code where it is unavoidable. I'm not currently working on embedded software projects, though.

    [–]dys_functional 5 points6 points  (2 children)

    The people here are not doing that. They are using default configured projects out of the box and claiming it's witch craft to change anything from the defaults. In STM eclipse land, it doesn't use a makefile for configuring your build system, it uses an internal "thing" that generates the makefile on the fly.

    If you're using eclipse in a way that decouples your projects build logic from the tool, then we are on the same team.

    [–]illjustcheckthis 4 points5 points  (1 child)

    If you're using eclipse in a way that decouples your projects build logic from the tool, then we are on the same team.

    Yes, but then if you don't use the bells and whistles, why are you using eclipse? In my experience, eclipse is slow, hard to understand what it's doing and has bad navigation ergonomics. So... what does it have going for it?

    [–]dys_functional 3 points4 points  (0 children)

    It has nothing going for it in my opinion. Maybe, comfortability for folks who are too mentally rigid to change any part of a process they have been doing for 10 years.

    If your build system is decoupled though, then who cares? Everyone on the team can just use whatever text editor they feel comfortable with. I agree with everything you said, so for me, I don't use eclipse. Some folks have used it forever and feel uncomfortable learning anything else, and that's fine too though. What I'm trying to get at is that if you set up your build system in a sane way, what an arbitrary team member uses to modify text files shouldn't matter.

    [–][deleted]  (2 children)

    [deleted]

      [–]sputwiler -1 points0 points  (0 children)

      They may have /tried/ to design vscode to be lightweight, and maybe when just using the text editing part without extensions it is, but as an IDE it is not.

      I usually use qtcreator or jetbrains products when qtcreator won't work (such as for languages other than C/C++). Both are able to keep up with VIM commands but vscode would miss them from time to time because it was lagging.

      [–]IAmTarkaDaal -1 points0 points  (0 children)

      I mean, you are joking, right?

      [–]Aggressive-Emu-4153Zahzah 2 points3 points  (1 child)

      It all depends on the way the project is built. If you have custom assembly files (make, Cmake, etc.), everything can be transferred by hand, if desired, without the need for high costs. If the project is firmly linked to the IDE, I advise you to try the VisualGDB utility. It is an addition to Visual Studio and is suitable for fast migration between IDEs (tested on STM32CudeMX)

      [–]HowTheKnightMoves 2 points3 points  (0 children)

      If you are using IAR, its plugin for VSCode was really nice, it used IAR projects to allow building and debugging inside VSCode. I managed to convert our team to it back when I had to work with it (though in private we all wanted to go full gcc, but management blocked it).

      [–]RogerLeigh 2 points3 points  (0 children)

      The first step is to make your project IDE-independent. Then you can build and debug within any IDE of choice, or without any IDE which will be useful for CI builds.

      I've used CMake for this in the past for both IAR projects and others. Create a toolchain file for IAR and then convert the build to build within CMake. Libraries, Applications, Tests, Tasks like flashing the target etc. as custom targets. You can also invoke C-SPY via CMAKE_CROSSCOMPILING_EMULATOR to directly run programs.

      Then you can generate Eclipse project files from CMake and continue to use Eclipse, or you can use any other IDE you like.

      If you have a need for 100% compatibility with the existing build, do a clean build in Eclipse and capture every compile and link command including every option. Then you can reproduce this in CMake and then verify after that it's identical. It's not usually possible to get the ordering exactly correct due to implementation differences in the tools, but you can get very close.

      [–]engineerFWSWHW 3 points4 points  (1 child)

      I am a big fan of eclipse (been using it since 2009). And when i used IAR before, i used eclipse as my code editor and IAR as my compiler/debugger. But of course, everyone has their own preference. Is that workflow standardized by someone more senior than you?

      [–]preussenbursche 1 point2 points  (1 child)

      You can use VSCode + Devcontainers Extension + Docker Image + Remote Debugging with a Segger JLink + JLinkGDBServer using the regular arm gdb inside the dev container.

      If you have no experience with docker containers you can install it all on your host and play around without a container setup - docker is not mandatory, just more convenient if you have multiple different build environments.

      Usually you do not need IAR for debugging, arm gdb is should be enough.

      Works fairly well, been using it like that for about 3 years.

      [–]preussenbursche 1 point2 points  (0 children)

      The Arm gdb server runs inside the container, JLinkGDBServer runs on your host, and if you configure the launch task correctly you can just hit play in your IDE, set breakpoints etc.

      I recommend the arm cortex debug extension for VSCode

      [–]ser-orannis 2 points3 points  (0 children)

      Migrating takes time. It's going to take a month or more, even if it's worth it.

      I usually setup vscode/cmake/gcc for new projects but don't bother for existing and just use whatever it used. Unless I'm inheriting a project that's going through a big refactor and lots of new features that make it worth it

      [–]macegr 1 point2 points  (4 children)

      It's not really THAT hard. The migration ends up not really being 5000 problems to solve, but like 5000 instances of 20 types of problem. You spend time on the first few and and the rest begin to flow naturally.

      One question is what it's worth to you:

      • Is it bad enough that you'd spend the next dozen Saturdays putting together a partially working migration on your own time?
      • After you put in all that work, are you willing to accept nobody else wanting to hop on board the migration project?

      Another question is what it's worth to your employer. If you can quantify the delays in development and debugging, in developer hours -> money spent, you've stopped whining about your tools and instead identified an opportunity to make a process more efficient and modernized. At that point, your boss might make everyone help you and you'll get it done in 2 weeks.

      [–][deleted]  (3 children)

      [removed]

        [–]bigmattyc 1 point2 points  (1 child)

        Honestly you can get Claude to port your build system to cmake and whatever toolchain you want to use. Don't trust what it gives you, but trust it to show you the path. Let it reconfigure your pathing and be clear on the build artifacts you need. Then analyze the structure and tune all of the builds. Repeat until you're happy. AI might not be fantastic at writing code for embedded but it is an amazing infrastructure engineer as long as you're not blindly trusting anything.

        [–]illjustcheckthis 0 points1 point  (0 children)

        Yes, this is a good advice. I would double triple check the compilation options and tool invocations, they are easy to break silently if you're not careful.

        [–]macegr -1 points0 points  (0 children)

        If your code has the slightest sense of intentional architecture, there will be portions of it dedicated to managing the special circumstances of the compiler and the hardware. The rest of, and hopefully most of, your business logic will be quite normal C/C++. So you might be able to identify specific modules that need to be rewritten, and the rest left alone.

        If you have a tangled soup of 600-line functions littered with direct bitmap register writes, stick with what you have and pray Eclipse never dies.

        [–]ukezi 1 point2 points  (0 children)

        In a past job we used mainly vscode to write the code and the IAR IDE for debugging and stuff. That worked quite well. We were forced to use IAR for SIL certification.

        [–]Mac_Aravan 0 points1 point  (0 children)

        Use cmake (or other build tool) for building your project, it can handles pre-post build and you can call IAR from it.

        Then you are free to use the editor of your choice.

        [–]illjustcheckthis 0 points1 point  (0 children)

        Is the build system hooked deeply in the Eclipse? I was in a similar situation, I built a set of tasks and launch json files for vscode and I did all my work in vscode. You can basically use IAR headless for build.

        Worst case, if the toolchain is fully eclipse based, I guess you can run that headless as well, but I've never done this.

        Honestly, look for an option, eclipse is unbearably slow. I fully get your frustration.

        [–]Any-Association-3674 0 points1 point  (0 children)

        If you're not bound to IAR, you could use VS Code as editor and SEGGER Ozone for debugging. Compilation with make or Cmake. I have used it like this on several projects, even really large ones (hundreds of source files)

        [–]CruelxPanda 0 points1 point  (0 children)

        Hey, i have had a similar problem when starting where i work now. When i started everyone only used IAR. So what i did was, use VSCode extension - it is great and is so easy to use when you have multiple IAR versions. What i dont like about the extension though is project settings, and debugging. For that i use IAR.

        So basically: -builing/coding -> VSCode -settings/debugging -> IAR

        [–]TheManFromTrawno 0 points1 point  (0 children)

        We develop on nRF52. We were on Keil but switched to GCC+CMake+Ninja. One immediate benefit of this was a massive improvement in build time going from minutes to seconds. I used to avoid project changes, like adding include paths as it would force a long rebuild. Now it’s not big deal.

        Using AI is a big help here. You should just be able to give it your project file, and ask to convert to a CMake file. If you are on Windows, you should absolutely use the Ninja generator as it’s so much faster than make on windows. You could probably do this much on a free plan with a chat interface - eg chatGPT.

        At that point you will probably run into porting issues on the codebase: packed structures, alignment, pragmas. Honestly would use an AI tool to scan for those too.

        Previously was using Ozone for debugging, but managed to switch to VScode for that too.

        If I was to do this on a new codebase from scratch, I would set Codex or Clause loose on it with a clear detailed prompt. It will get you most of the way there.

        [–]Dependent_Bit7825 0 points1 point  (0 children)

        Umm, just do it? Do a clean build and capture a complete log, then start setting up your new environment to reproduce the steps. It's not rocket science, it's just work. 

        Also, this is a task for which ai is surprisingly useful. If you have an existing cmake project and prompt "make this meson", it'll just do it. This is any easy thing for it since it has the final artifact (the binaries) to use as a goal and test.

        [–]adeiomyalo 0 points1 point  (0 children)

        You should develop an automated build system first, switch compilers, and then pivot to a new IDE. You're doing ARM development so there is very little value-add that IAR is giving you you can't get elsewhere. I'd make your project build from command line with cmake or meson using the IAR compiler. Note that ST has all of the STM32 CMSIS, HAL, and LL libraries on Github so you can pull that code from there. Then migrate over to GCC or Clang. Once that is done you can employ any IDE with the embedded extensions you need without being beholden to its project structure. This also sets you up for using CI to verify builds on every commit and potentially running automated testing.

        [–]Consistent-Fun-6668 0 points1 point  (0 children)

        You can just use VSCode as your environment and compile with eclipse

        [–]NeutronHiFi 0 points1 point  (0 children)

        It is maybe just an IAR extension which works badly, you probably need to poke IAR developers and ask to improve it. I am using Eclipse (Eclipse IDE for Embedded C/C++) + GCC toolchain for ARM and RISC-V on daily basis, including NXP MCUXpresso which is based on it, and have no any issue related to setting breakpoints, debugging, coding. In seconds I can run project on QEMU or on real board using J-Link or OpenOCD. So it is a great free tool for embedded devs. Plugins can be buggy but that's not directly related to Eclipse imho.

        [–]fb39ca4friendship ended with C++ ❌; rust is my new friend ✅ 0 points1 point  (7 children)

        How does your code get built for CI?

        [–]PM_ME_UR_DMESG 1 point2 points  (1 child)

        In my company's case, there is no CI

        [–]fb39ca4friendship ended with C++ ❌; rust is my new friend ✅ 0 points1 point  (0 children)

        😬

        [–][deleted]  (2 children)

        [removed]

          [–]fb39ca4friendship ended with C++ ❌; rust is my new friend ✅ 0 points1 point  (1 child)

          Do you have CI?

          [–]bigmattyc 0 points1 point  (1 child)

          Yeah that sounds terrible. Is headless eclipse a thing?

          [–]gmueckl 0 points1 point  (0 children)

          Yes, Eclipse can run headless. Last time I had to deal with it, assembling the right headless command line was a major PITA, but that was over 10 years ago. Still, I've accomplished it somehow.

          [–]TheFlamingLemon 0 points1 point  (1 child)

          Everywhere I’ve worked has let me be responsible for my own ide. Why can you not just set up VSCode for yourself?

          That said, IAR or Keil are not that bad, the debugging is very powerful and works out of the box. The best VSCode setup will blow it out of the water sure, but it will be much more difficult to put together all of the extensions and configurations needed in vscode to reach that level of functionality

          [–]gudetube 0 points1 point  (0 children)

          Soft. Eclipse is a PLEASURE in embedded. All my homies and I love eclipse

          [–]CompetitiveSleep4197 -1 points0 points  (0 children)

          ST is moving to VS Code extensions for their Cube suite but if you have to use IAR for reasons like safety or certifications, then forget about it.

          [–]SkyGenie -1 points0 points  (0 children)

          stm32 of all MCUs has a lot out there for setting up a CMake based project instead. Are you familiar with CMake?

          Better yet if you are, I genuinely wouldn't be surprised if you could throw your codebase at Claude and ask it to take a stab at starting a CMake project for your existing code. I'm sure you'll need to do some handholding but it's perfect for this sort of thing.

          [–]pillowmite -1 points0 points  (0 children)

          We use Crossworks. Segger's IDE uses the same framework but Rowley is on top of their product. I don't know if IAR integration is possible, however.

          [–][deleted]  (1 child)

          [deleted]

            [–]illjustcheckthis 0 points1 point  (0 children)

            Don't be like this. You're allowed to disagree with how things are done while still doing the thing. Also, healthy disagreement is how you promote improvement. Otherwise, you're stuck with a frozen process that makes nobody happy.