IDE for STM32F303RE & similar, 64bit Linux (Mint) - Page 1
Forum section: electronics / general

author: fourtytwo42
author_rank: Super Contributor
timestamp: November 12, 2024, 09:55:51 am
content: Hello all, I am having a frustrating time trying to find an IDE for these chips having given up on Mchip PIC.I am a bare metal programmer (in C or Assembler) and have tried the following :-openSTM32 I last used 2018ish and it now seems abandoned (no updates) so unsafe ?Arduino horrible, seems like basic, no information on libraries or how the chip has been setup (not even the clock speed), lots of nasty macro's/functions for doing i/o with no idea whats in them, doesn't look any use at all for realtime ?CUBEide downloaded it, probably made mistake in numerous nonsensical installation questions as it will not generate code from GUI (not that I need it too). Tried uninstall but on re-install complains "command not found" in installation script and hangs up, remains same even when re-downloaded, doesn't seem very usable any idea's ?So there we have it a potentially useful chip series but no usable IDE, anybody out there with any suggestions (for free IDE's) ?Regards

author: iMo
author_rank: Super Contributor
timestamp: November 12, 2024, 10:06:43 am
content: The best/fastest stm32 rtos with linux, imhohttps://www.chibios.org/dokuwiki/doku.phpThe author is an STM guy, afaik..

author: voltsandjolts
author_rank: Unknown
timestamp: November 12, 2024, 10:09:12 am
content: First, forget about IDE's and just setup a command line compiler system. Then use an editor of your choice.https://github.com/ataradov/mcu-starter-projectshttps://github.com/cpq/bare-metal-programming-guideFor programming and debugging I use Segger J-Link and Segger Ozone. For me this was the key to escape from IDEs. There are many other options for programming and debugging.

author: nctnico
author_rank: Super Contributor
timestamp: November 12, 2024, 11:06:33 am
content: STM32CubeIDE should just work on Linux. Maybe it is a matter of following the installation instructions? Are all the prerequisite packages installed? To add a datapoint: I have zero problems running Eclipse based IDEs on Linux (Debian 11).

author: newbrain
author_rank: Super Contributor
timestamp: November 12, 2024, 11:54:45 am
content: As ntcnico says, Eclipse based IDEs, so also STM32CubeIDE, should work on Linux, I never had problems with their installation...but my doctor told me to stay away due to my blood pressure.Millions offliesdevelopers like Visual Studio Code.I am one of them, it's the only editor that managed to replace emacs for me.As it is in the middle between a text editor and a full blown IDE, you still need to follow voltsandjolts's advice and set up a CLI toolchain.This will give you complete freedom if/when you decide to switch to another editor or platform.I use both Windows (10, 11) and Linux (mint - my main OS, fedora kde) machines, and share embedded projects with a Mac based friend.I have nothing host-system specific in my projects and they compile and link cleanly as long as teh rigth tools are available.I mostly use llvm/clang with picolibc and Cmake/ninja, but a more common gcc/newlibnano/make toolchain is perfectly fine.Once the the toolchain is setup, integration in VSC is quite easy: add the extensions for C/C++, the one for your preferred build system (Cmake/ninja integration with VSC is really good), the cortex-debug extension for target debugging (works with openocd or pyocd inheriting their wide probe and target support, and also with J-link native debug server) and you are set (there are many customization options - some json file editing is probably needed).I haven't yet tried Microsoft's own Embedded Tools extension (I have a working setup and I'm lazy) but I might in the future.I know another extension exists, specifically for STM32: stm32-for-vscode, but I have not tried that either as I also use other vendors and architectures.VSC also natively support git, there are extensions to improve on this: gitlens is probably the most feature rich, I use gitgraph which is more than enough for my purposes.Remember to disable telemetry, alternatively there's always VS Codium, the version of VS Code unencumbered by Microsoft's non-free stuff. You might have to jump through some hoops to get all the extensions.TBH, VSC latest fascination with AI worries me a bit, but at least copilot isstillan optional extension...

author: fourtytwo42
author_rank: Super Contributor
timestamp: November 12, 2024, 02:53:53 pm
content: Thank you for your helpful replies, I should have mentioned I prefer something that requires simple button pushes to compile & go, complex command line incantations between different programs is not my scene, I just need something simple to use like a screwdriver!After a few more goes I did get CubeIDE to at least install again and after a while found how to create a project without it's horrible GUI code generator, the last hurdle being an obscure error that transpired to be it wanting the package Cmake installed (that it fails to mention in the installation guide). A bit more effort got it to recognize it's own ST-LINK again no documentation just trial and error. So so far this does appear to be the most promising solution until I uncover the next brick-wall........Worryingly it keeps going on about authentication but that seems ignorable and is running crappy Chrome for no apparent reason no doubt this comes loaded with nasty malware and there doesn't seem to be an option to disable it's network access

author: nctnico
author_rank: Super Contributor
timestamp: November 12, 2024, 05:04:50 pm
content: From what I've seen so far, the Eclipse based ISE solutions offer a complete package out of the box. Ofcourse you may like it or not, but it works and it is way better compared to what microcontroller and compiler vendors used to offer as their home brew IDE solution.Visual Studio Code does offer more flexibility but you do have to setup a lot of things yourself by installing all kinds of plugins. In that way it isn't different to the old Visual Studio which is also quite bare-bones out of the box (like notepad with a compile button). To make matters worse, there are lots of different plugins for the same function so for a novice, it is super hard to find the right plugin.

author: hans
author_rank: Super Contributor
timestamp: November 12, 2024, 05:23:07 pm
content: Learn to write your own makefiles with Makefile, or semi-automate it with CMake. It is an useful skill and also frees you from all the proprietary project/build systems that other IDEs use which will eventually backfire (e.g. if you want to do automated testing on a buildserver, it ensures it's portable across OSS toolchains, etc.)If you choose CMake it also opens the pathway to use IDEs like CLion (not free).Otherwise you could also use something like VSCode. Do make sure you download the official one, and not the community edition (if you ever plan to use plugins like PlatformIO). It works decently well for regular coding work. I still like JetBrains IDEs more for their productivity tools, but it can be a giant resource hog.STMCube also works on Linux just fine, but it is based on Eclipse though.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 12, 2024, 07:29:30 pm
content: As for the "SDK", you can use the HAL without CubeMX. Though, it's relatively bloated, so I do recommend using the LL (which is also part of the Cube SDK) instead. It's a very thin layer above registers and still has some higher-level functions in .c files, but you can strictly use the .h files of the LL. The downloads come with a lot of examples.For the STM32F3, the download is there:https://www.st.com/en/embedded-software/stm32cubef3.htmlIf you prefer getting it from github, it's there:https://github.com/STMicroelectronics/STM32CubeF3They have those for all their families.

author: fourtytwo42
author_rank: Super Contributor
timestamp: November 12, 2024, 08:07:32 pm
content: Thank you SW, ewww I just downloaded it and unfortunately the header files are all written for there horrible HAL rather than being generic for the chip.I have seen some other BM programmers have had this problem so I shall either have to write my own or hope to find something somewhere else.

author: nctnico
author_rank: Super Contributor
timestamp: November 12, 2024, 08:20:49 pm
content: One of my biggest complaints about the STM32 chips is that either you use the poorly documented crappy HAL or try to go bare metal with confusing / incorrect / incomplete documentation. Pick your poison.So if I have a choice, I avoid using STM32 at all and use the LPC series microcontrollers from NXP. The documentation is way better and the peripherals are 99% the same across the entire line allowing re-use of bare metal code without (much) thinking. It sure saves a lot of development time which more than makes up for the small extra cost of the NXP microcontrollers.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 12, 2024, 08:30:05 pm
content: Using the LL library is the easiest bet here, it's pretty lightweight again, and writing your own wouldn't make much sense.The files are located in the same directories as the HAL, but with a _ll_ in their names. There are examples using them in "Examples_LL" directories.You can also directly use registers and include only the header files for the chips, which are located in the CMSIS directories.Just like for any other ARM MCU out there. You don't need to write your own header files, they are all there written in the CMSIS style.But again, using the thin LL layer is what usually makes the most sense when using STM32 MCUs.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 13, 2024, 07:54:35 am
content: As a bare metal coder myself, I have no problems with the STM32 devices. Sure at times it takes some fiddling to get to the bottom due to the indeed a bit crappy documentation, but that is part of the fun or sport of doing bare metal development.There are header files for the low level stuff of the MCU's, but they are also a bit bloated, so mostly I copy and edit parts of them to fit my needs.As for an IDE on Linux, there are many that can be used. I myself still work with Netbeans 8.2, but there are annoyances though. The tool chain of choice is gnu-arm-none-eabi, so the option to do command line make is certainly there, but debugging that way is cumbersome. The advantage of a good working IDE is that with debugging there is no fiddling with GDB directly, and setting break points is simply done in the source. Also viewing variables is as easy as hovering above it to see the content.As to STM versus NXP devices, for me the price and easy availability (Aliexpress) is reason to stick with STM (or it's clones), but I'm just a hobbyist.Attached are the original header file for the STM32F303xC series and the extract I made for one of my projects. A better option would be to create separate header files per peripheral, but have not got around to doing that.

author: tellurium
author_rank: Frequent Contributor
timestamp: November 13, 2024, 08:02:50 am
content: Am I right assuming the following:- ST SDK used to provide a so-called "standard peripheral library", SPL, now obsolete- LL API is the derivative , or the the rewrite, of the "standard peripheral library". LL API sits on top of CMSIS, and is independent from anything- HAL API is the new rewrite by ST of their peripherals API. HAL sits on top of CMSIS, and is independent from anything- So basically LL is a legacy code, HAL is ST's next new attemptIs that correct? Or completely off?Also, am I the only one who finds all that co-habitation of _hal and _ll code in the Cube deployment confusing?Am I the only one who finds that both LL and HAL are essentially duplicating CMSIS definitions in their own (sometimes weird) way?

author: newbrain
author_rank: Super Contributor
timestamp: November 13, 2024, 09:48:34 am
content: Quote from: tellurium on November 13, 2024, 08:02:50 amThis is an AN with some info on SPL/LL/HAL:https://www.st.com/resource/en/application_note/an5044-stm32-standard-peripheral-library-to-stm32cube-lowlayer-migration-stmicroelectronics.pdfMy impression of the SPL (which I only saw on its way out) was something intermediate between HAL and LL.Moreover, as of my recollection, the history went SPL -> HAL -> LL, yes, LL was introduced later than HAL (maybe due to the backlash for HAL's bloat?).I'm also irked by having LL and HAL in the same directory.As of today, I mostly use a mix of LL and direct register access rather than the HAL.Quote from: hans on November 12, 2024, 05:23:07 pmJust to make sure there's no confusion:Visual Studio Code is distributed by Microsoft, and is based on "Visual Studio Code - Open Source" (AKA "Code - OSS", MIT licensed).They add the extension marketplace, telemetry etc. and the license is proprietary (but quite liberal for use).https://github.com/microsoft/vscodeThere's a fully OSS version, built straight from "Code - OSS" source, called VSCodium:https://vscodium.com/As I said earlier, there are hoops to jump through to have (almost) full Visual Studio Code functionality.Calling it "community edition" is 100% correct - but it can lead to false hits in a search, as there's also Visual Studio Community Edition:https://visualstudio.microsoft.com/vs/community/Note the lack ofCode, this is the full Visual Studio IDE (a great one, miles ahead of anything Eclipse based, IMHO), free for personal and Open Source use, and lacking some more enterprise oriented features found in Visual Studio Pro and Enterprise.Unfortunately it only runs on Windows.That said, the OP manifested their preference for a turnkey solution, so the STM32CubeIDE is as good as it can get (not much, but it's a 'me' problem).As SiliconWizard said, the libraries can be downloaded separately from the IDE, as can the HAL configuration SW.The hierarchy goes something like this:STM32CubeXX: only libraries and examples for the XXX family (e.g. F3, H7 etc..)STM32CubeMX: the HAL/LL configuration code and app template generator. It will download the needed CubeXXs on requests.STM32CubeIDE: the full shebang.Then there are other tools like the STM32CubeProgrammer etc.Quote from: fourtytwo42 on November 12, 2024, 08:07:32 pmIn the STM32F3Cube there are lots of LL examples, look in the various Nucleo/Eval/Discovery boards Project directories for Examples_LL dirs.The headers and c files for HAL and LL as said above are mixed together - messy, but almost innocuous.The generic includes are under CMSIS directory, it's mix of Arm provided core specific includes for standard peripherals, plus the register definitions (generated from an SVD file, usually) for the specific MCU.Edit: link to VSCodium was wrong.

author: fourtytwo42
author_rank: Super Contributor
timestamp: November 13, 2024, 10:52:25 am
content: Thank you all so much for your help, it is indeed a minefield undocumented and very very badly organized. It's so bad I even went back to the PIC to see if I could overcome it's limitations those being that high pin-count devices are not supported by the combination of PICKIT3 and MPLAB-X but that sadly is the case so I either have to spend £100 on a PICKIT4 (no way) or maintain a 32 bit windows machine just to run MPLAB8.Going back to STM32 thanks to pcprogrammer for the extracted header file that is what I am used to, the stuff from ST is a disgusting mess and completely unreadable and unusable IMOP.I should add I already have a NUCLEO-64 board along with it's ST-LINK I bought in 2018 to evaluate the chip for controlling an inverter (the eval failed and I used PIC instead), I was finally driven to try STM32 again due to the aforementioned PIC large pinout device support problems. I am trying to unify all my design tools onto a single 64bit Linux platform.Today is make Christmas cake day, much more satisfying than this malarky

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 13, 2024, 05:21:11 pm
content: If it is pins you are after you might want to choose a version that is more available then the F303, like the STM32G431, STM32F412 or STM32F446 range. They have similar or even better peripherals.WeAct studio has some nice boards to play with.https://nl.aliexpress.com/item/1005005303669884.htmlhttps://nl.aliexpress.com/item/1005006051651136.html

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 13, 2024, 09:35:36 pm
content: I agree it takes a while to figure it all out, but browsing the various directories of the Cube SDK distribution should get you there.It's not the best organization I've seen, but to be fair, SDKs from other vendors are very rarely any better. Try to make sense of the NXP SDK for the iMXRT MCUs in the same manner (that is, directly rather than using their predigested IDE crap), and it's even a lot worse with all this CMake-like hierarchy with almost one directory per source file and then one subdirectory for the related header file, that's awful if you don't exactly use all this in the exact way they intended you to use it. (And similarly, ST organized their SDK probably to make their life easier with the CubeMX software, and if you don't use that, you have to invest significant upfront time, but that's again the same with almost all vendors).I would second the suggestion to go for a more recent MCU line from ST if you're just starting and you have a choice. The F4/G4/L4, even L5/U5 if you're after low-power stuff. And if you look for cheaper/a bit lower performance, the G0 line is pretty good.

author: reboots
author_rank: Regular Contributor
timestamp: November 13, 2024, 10:27:38 pm
content: I started with STM32CubeIDE under Linux (which worked fine), and quickly became frustrated by their incoherent SPL/HAL ecosystem. Hearing about LL feels like I dodged a bullet. I moved on to arm-none-eabi with libopencm3, which I found to be a much better experience and probably an ideal starting point.https://github.com/libopencm3/libopencm3I program in C without using an IDE, so I can't recommend anything there, but I believe it's pretty easy to integrate this toolchain with Eclipse. FWIW I script away any command-line incantations; my workflow is usually something like "make; flash" where "flash" is a script calling st-flash or openocd:Code:#!/bin/bashst-flash write build/main.bin 0x08000000Code:#!/bin/bashopenocd -f extra/stm32f030x6.cfg -f extra/stm32f0-openocd.cfg \-c "stm_flash `pwd`/$1" -c shutdownThis looks like a pretty good introduction to libopencm3 with Visual Studio Code:https://medium.com/@csrohit/stm32-blue-pill-using-libopencm3-882165a0d79f

author: fourtytwo42
author_rank: Super Contributor
timestamp: November 14, 2024, 08:41:45 am
content: Thank you all once again for your many suggestions and experiences, I confess the whole ST experience forced me to sort out what was wrong with the Mchip PIC large pinouts on Linux and thank god it was a few stupid mistakes on my part................For one I had inadvertently typed in the wrong memory size part when creating the MPLABX project and that seems to have caused one error and the other was using non-default programming pins without having blown the corresponding fuse!So the STM32 has gone back in the bottom of the drawer for at least another few years till I am so desperate that lengthy & tortuous self-flagellation is the only answer!Meanwhile the all important Christmas cake came out of the oven perfectly