Author Topic: Using GCC vs. IDEs  (Read 4974 times)

0 Members and 1 Guest are viewing this topic.

Offline longhTopic starter

  • Contributor
  • Posts: 44
  • Country: us
Using GCC vs. IDEs
« on: September 16, 2022, 09:32:54 pm »
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-rm then figure out the correct GCC commands?

Thanks,
-Hunter
All hard work brings a profit, but mere talk leads only to poverty. -Proverbs 14:23
 

Offline longhTopic starter

  • Contributor
  • Posts: 44
  • Country: us
Re: Using GCC vs. IDEs
« Reply #1 on: September 16, 2022, 09:34:30 pm »
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-systems

And it doesn't look terribly complicated to do.
All hard work brings a profit, but mere talk leads only to poverty. -Proverbs 14:23
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 4668
  • Country: us
Re: Using GCC vs. IDEs
« Reply #2 on: September 16, 2022, 10:49:28 pm »
Amusingly, this is being discussed somewhat in another thread, right now.  Starting about https://www.eevblog.com/forum/microcontrollers/rant-why-i-dumped-platform-io-ide-after-a-week/msg4416871/#msg4416871
The 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.)
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12500
  • Country: us
    • Personal site
Re: Using GCC vs. IDEs
« Reply #3 on: September 16, 2022, 11:47:35 pm »
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 project https://github.com/ataradov/mcu-starter-projects/tree/master/stm32g071

Stepping 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.
« Last Edit: September 16, 2022, 11:49:43 pm by ataradov »
Alex
 

Offline eutectique

  • Frequent Contributor
  • **
  • Posts: 638
  • Country: be
Re: Using GCC vs. IDEs
« Reply #4 on: September 17, 2022, 01:50:40 am »
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.
 

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1364
  • Country: us
Re: Using GCC vs. IDEs
« Reply #5 on: September 17, 2022, 03:05:47 am »
STM32 has it's "own special IDE"?  Many people use the Arduino IDE or Eclipse, don't they?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12500
  • Country: us
    • Personal site
Re: Using GCC vs. IDEs
« Reply #6 on: September 17, 2022, 03:12:35 am »
STM32 has it's "own special IDE"?  Many people use the Arduino IDE or Eclipse, don't they?
They 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.
Alex
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11727
  • Country: my
  • reassessing directives...
Re: Using GCC vs. IDEs
« Reply #7 on: September 17, 2022, 06:58:21 am »
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-systems
And it doesn't look terribly complicated to do.
interesting 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.
« Last Edit: September 17, 2022, 07:02:14 am by Mechatrommer »
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2332
  • Country: 00
Re: Using GCC vs. IDEs
« Reply #8 on: September 17, 2022, 07:10:38 am »
If you want make it simple try

https://os.mbed.com/
 

Offline eutectique

  • Frequent Contributor
  • **
  • Posts: 638
  • Country: be
Re: Using GCC vs. IDEs
« Reply #9 on: September 17, 2022, 10:35:25 am »
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

We use gdb. It even has TUI, text user interface.
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 4668
  • Country: us
Re: Using GCC vs. IDEs
« Reply #10 on: September 17, 2022, 11:35:28 pm »
Quote
Stepping debugging is a different story. There are no good solutions.
gdb?  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.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12500
  • Country: us
    • Personal site
Re: Using GCC vs. IDEs
« Reply #11 on: September 17, 2022, 11:49:54 pm »
gdb?
No, thanks. Even with TUI it is only usable if you are absolutely desperate for a quick localized debug. Otherwise just go with Ozone.
Alex
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11727
  • Country: my
  • reassessing directives...
Re: Using GCC vs. IDEs
« Reply #12 on: September 18, 2022, 12:05:35 am »
It does require appropriate debugger hardware and drivers, though.  Which can be tough to install without installing "the rest" of the vendor's IDE.
i 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 :-[

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 5120
  • Country: gb
Re: Using GCC vs. IDEs
« Reply #13 on: September 18, 2022, 10:34:42 am »
gdb?
No, thanks. Even with TUI it is only usable if you are absolutely desperate for a quick localized debug. Otherwise just go with Ozone.

well ...

Debugging -> gdb is ok
Streaming Trace -> gdb forget it
Real-Time Profiling -> gdb forget it
Code Coverage -> gdb is *somehow* ok with integration
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3921
  • Country: it
Re: Using GCC vs. IDEs
« Reply #14 on: September 18, 2022, 07:14:56 pm »
Debugging -> gdb is ok

many people that use gdb have the guts to point the finger at PICKITs and complain about them being slow, unresponsive, unreliable
 

Offline bson

  • Supporter
  • ****
  • Posts: 2822
  • Country: us
Re: Using GCC vs. IDEs
« Reply #15 on: September 18, 2022, 07:53:42 pm »
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.
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 4668
  • Country: us
Re: Using GCC vs. IDEs
« Reply #16 on: September 19, 2022, 07:00:11 am »
Quote
Streaming Trace -> gdb forget it
I'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."
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->