Using GCC vs. IDEs - Page 1
Forum section: electronics / general

author: longh
author_rank: Contributor
timestamp: September 16, 2022, 09:32:54 pm
content: Hey everyone,I was wondering what the bare minimum setup requred for compiling code for and programming a micro controller (assuming it is on an eval board) using GCC is.A lot of microcontrollers, STM32, MSP430 ETC have their own special IDEs. I'm just wondering what the bare minimum setup is, and is it really as hard as people make it sound? For instance at work I'm trying to get to blinky with a Vorago microcontroller (like this:https://www.voragotech.com/products/va41620). They recommend using Keil, but I have to use the limited free version, and I'm on Linux and it works with Windows. Also, it just seems over complicated for the simple task I'm doing. The core of this is an ARM cortex M4, and I would assume using GCC to compile code for it is very common.I guess what I need to do is download the appropriate toolchain from here:https://developer.arm.com/downloads/-/gnu-rmthen figure out the correct GCC commands?Thanks,-Hunter

author: longh
author_rank: Contributor
timestamp: September 16, 2022, 09:34:30 pm
content: Maybe I answered my own question, looks like this is what I'm trying to do:https://www.shawndsilva.com/blog/embedded%20systems/makefiles-for-embedded-systemsAnd it doesn't look terribly complicated to do.

author: westfw
author_rank: Super Contributor
timestamp: September 16, 2022, 10:49:28 pm
content: Amusingly, this is being discussed somewhat in another thread, right now. Starting abouthttps://www.eevblog.com/forum/microcontrollers/rant-why-i-dumped-platform-io-ide-after-a-week/msg4416871/#msg4416871The hard part seems to be getting the vendor include files for the chip definitions, and dealing with the often-convoluted directory structures that are often used. (for example, the RPi rp2040 sdk requires so many -I switches on the command line that some builds on windows exceed the ~8000 character maximum command line.) (but it's OK, because they have CMake create the makefiles for you, or something like that.)

author: ataradov
author_rank: Super Contributor
timestamp: September 16, 2022, 11:47:35 pm
content: No, it is not hard at all. But it is better if you commit to writing all the drivers. The part that gets hard if you want to partially use vendor stuff and part custom stuff. In this case it is far easier to start with the vendor system and modify it as needed. Bringing components that rely on extensive system of utility functions into a clean project is a nightmare.Ans yes, just download the ARM compiler (arm-none-eabi-xxx in this case). They are clean build free of vendor cruft.Here is an example of a simple bare-metal STM32 projecthttps://github.com/ataradov/mcu-starter-projects/tree/master/stm32g071Stepping debugging is a different story. There are no good solutions. So, if you are heavily relying on a debugger in your flow, having an IDE may be a better option. There are ways to do mixed setups with custom build and IDE only for debugging, but the success rate may vary here.

author: eutectique
author_rank: Frequent Contributor
timestamp: September 17, 2022, 01:50:40 am
content: My personal preferences:-- dealing with source code : gvim + ctags for don't remember how many years, now switched to CLion-- building : arm-none-eabi-gcc + make + hand-written linker scripts-- debugging : j-trace + Ozone (rarely arm-none-eabi-gdb)Some dev kits have on-board j-link, like NRF52DK, or SAMC21xplained, or SAMV70xplained. Even STM32F100 discovery can be flashed with j-link OB. Just connect them to USB and debug.

author: MikeK
author_rank: Super Contributor
timestamp: September 17, 2022, 03:05:47 am
content: STM32 has it's "own special IDE"? Many people use the Arduino IDE or Eclipse, don't they?

author: ataradov
author_rank: Super Contributor
timestamp: September 17, 2022, 03:12:35 am
content: Quote from: MikeK on September 17, 2022, 03:05:47 amThey have STM32CubeIDE, which is Eclipse with customized code generators.Arduino is not really an IDE. It is barely a text editor with a hotkey to upload. Nobody is using that for projects outside of Arduino ecosystem.

author: Mechatrommer
author_rank: Super Contributor
timestamp: September 17, 2022, 06:58:21 am
content: Quote from: longh on September 16, 2022, 09:34:30 pminteresting topic, sometime i'm thinking of automating compilation/linking my own code with some sort of diy "IDE" or script... but if i have to ask one question about this is... how do we "interactively" single step our code?if i know how to do this, i think i can build a decent (at least for me) simple IDE better than Arduino the IDE... instead of build the code using Make, run the compiled executable and figure out whats wrong with it. another thing is tapping the compilation report into my app's console, the thing that we usually see about warnings and errors during compilation process, to some extend Arduino IDE can show this at the bottom of its app/gui.

author: ebclr
author_rank: Super Contributor
timestamp: September 17, 2022, 07:10:38 am
content: If you want make it simple tryhttps://os.mbed.com/

author: eutectique
author_rank: Frequent Contributor
timestamp: September 17, 2022, 10:35:25 am
content: Quote from: Mechatrommer on September 17, 2022, 06:58:21 amWe use gdb. It even has TUI, text user interface.

author: westfw
author_rank: Super Contributor
timestamp: September 17, 2022, 11:35:28 pm
content: Quotegdb? Even if you don't use one of the display editors that it interfaces to, it has an "ok" display-mode (text with cursor magic, not "graphics.")It does require appropriate debugger hardware and drivers, though. Which can be tough to install without installing "the rest" of the vendor's IDE.

author: ataradov
author_rank: Super Contributor
timestamp: September 17, 2022, 11:49:54 pm
content: Quote from: westfw on September 17, 2022, 11:35:28 pmNo, thanks. Even with TUI it is only usable if you are absolutely desperate for a quick localized debug. Otherwise just go with Ozone.

author: Mechatrommer
author_rank: Super Contributor
timestamp: September 18, 2022, 12:05:35 am
content: Quote from: westfw on September 17, 2022, 11:35:28 pmi was only thinking about "emulated" type of debugging, before we upload the code to hardware. just to pinpoint stupid (semantic) mistakes during software development process. last time, avr studio (now microchip studio) had it, and i think it still has, havent checked. hardware debugging with dedicated hardware debugger can get really complicated and is out of my head. my debug tool during hardware process is just oscilloscope and i'm still trying to grow mental process in dealing with things unique to hardware such as interrupt, in software. but then, i guess i have to make my own emulator if i want such "soft" step debug feature

author: DiTBho
author_rank: Super Contributor
timestamp: September 18, 2022, 10:34:42 am
content: Quote from: ataradov on September 17, 2022, 11:49:54 pmwell ...Debugging -> gdb is okStreaming Trace -> gdb forget itReal-Time Profiling -> gdb forget itCode Coverage -> gdb is *somehow* ok with integration

author: JPortici
author_rank: Super Contributor
timestamp: September 18, 2022, 07:14:56 pm
content: Quote from: DiTBho on September 18, 2022, 10:34:42 ammany people that use gdb have the guts to point the finger at PICKITs and complain about them being slow, unresponsive, unreliable

author: bson
author_rank: Unknown
timestamp: September 18, 2022, 07:53:42 pm
content: I just use M-x gdb in emacs, and its very simple debug buffer modes to single step code, set breakpoints and such. For anything not built in, like printing values, evaluating arbitrary expressions, setting conditional breakpoints or watchpoints, casting structure types, ad-hoc function calls, checking ARM core status registers such as to find a trap reason, etc, I just use the gdb command line directly.

author: westfw
author_rank: Super Contributor
timestamp: September 19, 2022, 07:00:11 am
content: QuoteI'll have to admit that I've mostly used gdb in "remote" forms over serial connections, where being relatively slow is "expected." Does it not get faster with a local debugger? (I guess the generic API to gdb is a network connection, isn't it?)I don't think I've ever used "Streaming Trace."