Author Topic: C/C++ and the codeblocks IDE  (Read 7216 times)

0 Members and 1 Guest are viewing this topic.

Offline ampdoctorTopic starter

  • Frequent Contributor
  • **
  • Posts: 266
  • Country: us
C/C++ and the codeblocks IDE
« on: November 12, 2014, 02:56:27 am »
It's been forever and a day since I've done any embedded work let alone any other sort of programming with the exception of some basic PHP and javascript for a few websites I've helped out with. In light of this I have a three part question that hopefully won't stir up too much controversy.

First, I've seen a few people mentioning recently that C as a programming language has become a bit old and outdated. So the question here is what are these people using and what would be considered THE language to get proficient in while looking a few 5 or so years down the road, assuming they're not just talking out their backsides?

Second question, that relates somewhat to the first is if you were to want to get good at a language would you go hard at C++ or C and why? I ask this because in a recent job interview the hiring team seemed to be very interested in people that could work comfortably in C++, and as languages go they don't seem to be much different.

Finally, yesterday I downloaded a copy of the codeblocks compiler/IDE and it seems fairly decent at first blush with support for both ARM and AVR processors as well as matlab. I know IDE's are a hotly debated area, but I'd like some subjective as well as objective opinions on it just the same.
 

Offline briselec

  • Regular Contributor
  • *
  • Posts: 94
  • Country: au
Re: C/C++ and the codeblocks IDE
« Reply #1 on: November 12, 2014, 03:42:18 am »
I've been using codeblocks for about a year and quite happy with it. Tried eclipse first and didn't like it.
I prefer C. Never been much of a fan of C++ for embedded work.   
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: C/C++ and the codeblocks IDE
« Reply #2 on: November 12, 2014, 06:36:16 am »
Many people are running around claiming C is dead, trying to push the hype-of-the month programming language instead. Still C is the most popular programming language. Not only for embedded work, but for all programming work. And it has been #1 or #2 for at least the last decade. It changed place only with Java a few times.

Java is currently second (so much for "no one uses Java" and "Java is dead"), Objective-C is third (that's almost exclusively thanks to Apple), C++ is forth.

I consider C++ for low-level embedded work rather pointless. That is especially for what is called a free standing environment - one where you don't have a big fat operating system at hand. You can't harvest the full power of C++ in such an environment, and boy, does it have some power.

C++, when fully used, is much different than C, although the syntax is similar, the concept's aren't. You can of course ignore most of the C++ features and just code as if you are using C. But what is the point of using C++ then if you treat it like C? However, that is what you often see when people use C++ for embedded work, they use it like C with some syntactic sugar.

It already starts with the basic libraries. You hardly see C++ libraries like a working STL implementation for your microcontroller, esp. not for 8-bit one*. Or a half decent streams implementation. Instead people use the classic C libraries with C++.

You also don't see people using object-orientation in embedded C++ code. With that I mean really applying the OO concepts and having an object-oriented program architecture. There is more to OO than grouping things together in a random class here and there.


Regarding IDEs. Unfortunately it has become common for programming shops to "standardize" on an IDE, instead of letting people chose their editor and environment according to their individual preference. Standardize on the protocols, not the tools.

What people also miss is that being able to use a particular IDE is really not a great achievement. You manage to use a tool of your trade? Wow - not. But what separates the boy from the men is if people manage to tame their preferred IDE to do what it should do. I have seen many fanboys of particular IDEs who couldn't for the life of them change a compiler option in the IDE. Because they didn't know where that stuff was buried in their IDE and they have no clue about the meanings of the compiler options. Or, one of the most annoying things, people not being able to adjust the space/tab expansion and substitution behavior.

So, if you to crown a particular IDE as THE ONE AND ONLY IDE, spend at least some time to learn that thing, dammit.

* Despite what some fanboys claim, 8-bit microcontrollers are also not dead.
« Last Edit: November 12, 2014, 06:45:09 am by Bored@Work »
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: C/C++ and the codeblocks IDE
« Reply #3 on: November 12, 2014, 11:58:56 am »
Quote
So the question here is what are these people using and what would be considered THE language to get proficient in while looking a few 5 or so years down the road, assuming they're not just talking out their backsides?

Some form of graphics driven, library based coding approach is likely the future as mcus get more and more powerful and the software side of the cost equation becomes more significant.

Quote
Second question, that relates somewhat to the first is if you were to want to get good at a language would you go hard at C++ or C and why?

Right now, an embedded C programmer is far more marketable than an embedded C++ programmer, although it is hard to find a C++ programmer who isn't familiar with C.

Quote
I know IDE's are a hotly debated area, but I'd like some subjective as well as objective opinions on it just the same.

I have been using CB for a long time now (10 years?). Love it for its utilitarian approach, and its small size, and its flexibility (via plugins). It is however quite limited when it comes to debugging, particularly for embedded projects.

For larger projects, I use programmer's editors, like SI, or NP+, or Sublime - the ability to see across your modules and analyze the code at source levels (SI wins hands down there) is critical to me.
================================
https://dannyelectronics.wordpress.com/
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3436
  • Country: gb
Re: C/C++ and the codeblocks IDE
« Reply #4 on: November 12, 2014, 03:15:14 pm »
I've been using codeblocks for about a year and quite happy with it. Tried eclipse first and didn't like it.
I prefer C. Never been much of a fan of C++ for embedded work.

Have you found any issues with the CodeBlocks editor?  I find that when I'm cutting and pasting lines of code, I very often end up with random bits of code pasted throughout the module.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 22035
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: C/C++ and the codeblocks IDE
« Reply #5 on: November 12, 2014, 04:03:23 pm »
Which language? It completely depends on the application domain. Use a language inappropriate for the application domain and you are wasting everybody's time and money.

Apart from that, the language is often chosen on the basis of other criteria, e.g. what does the company/team already know, or what language are the library componsnets written in.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline ehughes

  • Frequent Contributor
  • **
  • Posts: 410
  • Country: us
Re: C/C++ and the codeblocks IDE
« Reply #6 on: November 12, 2014, 04:43:02 pm »
Anyone who was C is dated or going away does not do *any* embedded programming:

Page 20:

http://images.content.ubmtechelectronics.com/Web/UBMTechElectronics/%7Ba7a91f0e-87c0-4a6d-b861-d4147707f831%7D_2013EmbeddedMarketStudyb.pdf

Java, etc has NEVER been anywhere near a position in embedded systems to take over C.

All of the other languages below qssembly are on "embedded systems" that are essentially PC's in a box. 


If you do "real" embedded (not a PC in a box), you need to know C.   There is no way around it.     It is not going away because there is a new scripting,functional,magical,etc.  language popular among the web programming and linux geeks that live in their parent's basement.

C is well understood with a long history of proven tools.   It is the only language you can currently write safety certifiable code to.  (I.E. MISRA). (C++ is close but not widely adopted as you have to strip out virtually every feature of C++ to be compliant)

For getting started,  think of a project you want to do, pick a random board (Freescale FRDM,   NXP LPC XPresso are very inexpensive) and just use the tools they give you.   Worrying about the IDE is somewhat pointless.   Worrying that something is not available on Linux is also pointless.   

Every compiler, IDE does exactly the same thing.  Learn the C build process and you be able to move to any other platform.    For example LPCXpresso with NXP is just eclipse + GCC + a debugger.  If you learn that it is not hard to move to anything else.   IF you know C, you can move to anything and make it work.

That being said, there is a lot of convergence on all of the vendors to use eclipse.  If you have real money ($5k) you purchase the Keil or IAR tools.   (They are the dominate tools in the professional world) but for the rest it is generally GCC + some front end (which tends to be eclipse).

Use whatever gets the job done.  Stick with the project even when you get frustrated.   After a bit you will find that it not that bad.

Stay away from Arduino if you every want to do something beyond LED blink programs and simple demos.    I have now been on 3 design reviews for external clients who thought they could take an Arduino and make it into a product.  They hired embedded "consultants" who promised them the world with an Arduino only to find that it simply is not for product development and they were left with a half working mess that has no transition path to manufacture.


99% of real world embedded development means you start with project specs,  pick a CPU from your existing toolbox (or find a new one),  acquiring dev board for said CPU and moving forward (start writing firmware, work on PCBs, etc).


Some Starter Videos, projects if you are interested

Bare metal bring up with the FRDM-KL25Z ($13 board):

https://community.freescale.com/docs/DOC-93960
https://community.freescale.com/docs/DOC-95170


Some projects that use FRDM but are more focused on DSP.   Intended for just out of college students who have never coded any DSP, etc who need something a little more advanced than an LED blinker to get started.

https://community.freescale.com/docs/DOC-99621


In the end ,  find an interesting project,   find a board (really doesn't matter which brand, etc) and start figuring it out. 
« Last Edit: November 12, 2014, 04:48:51 pm by ehughes »
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: C/C++ and the codeblocks IDE
« Reply #7 on: November 12, 2014, 07:44:28 pm »
The OP's question is more forward looking ("what will be the language of the future?"), and your answer is present-focused ("what is the language of now?").

Quote
Java, etc has NEVER been anywhere near a position in embedded systems to take over C.

Depending on how you define the market (or "mcu", or "embedded systems"). I don't know the specific size but if you count phones / phone apps or tv settop boxes / certain wearables, it wouldn't surprise me that Java or non-C languages have a significant market share.

and I would further assert that if you wait long enough, you will witness the certain death of any language, C included.
================================
https://dannyelectronics.wordpress.com/
 

Offline briselec

  • Regular Contributor
  • *
  • Posts: 94
  • Country: au
Re: C/C++ and the codeblocks IDE
« Reply #8 on: November 12, 2014, 09:34:20 pm »
Have you found any issues with the CodeBlocks editor?  I find that when I'm cutting and pasting lines of code, I very often end up with random bits of code pasted throughout the module.

No, I've never had that happen. I'm still using version 12.11 with the code completion plugin disabled because it doesn't play well with Linux. They were doing a complete rewrite of that plugin so it may be fixed in the latest version.
 

Offline ampdoctorTopic starter

  • Frequent Contributor
  • **
  • Posts: 266
  • Country: us
Re: C/C++ and the codeblocks IDE
« Reply #9 on: November 13, 2014, 02:18:11 am »
Thanks, lots of really good info here!

Where I'm at right now is just using codeblocks to write and compile some basic command line executables to get a feel for the language and syntax. I plan on taking an hour or so a night and working my way though the tutorial found here...

http://www.tutorialspoint.com/cprogramming/index.htm

While I don't expect it to make me an expert programmer, I'm just using it to ease the transition a bit and get my general coding chops back up to speed. Cleaning up some php code or writing a few custom CMS sites doesn't really count in my opinion.

I've looked at several dev boards and environments and the ST dev boards from mikroelektronika and the avr dragon seem to be the best contenders for entry level experimental programming. Sure I could just get a pickit or an avrisp connected to an mcu on a breadboard a little cheaper, the lure of one stop shopping with a bundled "kit" seems hard to pass up.

Whatever avenue I wind up taking, 20 years of hardware only systems design and maintenance isn't going to cut it in 2015!
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: C/C++ and the codeblocks IDE
« Reply #10 on: November 13, 2014, 05:51:24 am »
I've looked at several dev boards and environments and the ST dev boards from mikroelektronika

Well, the mikroelektronika stuff is more for posing. ST has a good collection of their own dev and eval boards. They call them Discovery kits. They are dirt-cheap and have a programmer on board (maybe even a debugger, I forgot). Typically around $20.

Quote
and the avr dragon
The dragon is only a programmer/debugger. And a bad one that is. Cheap compared to other Atmel programmer/debugger offerings from Atmel, but prone to beak down, and not even compatible with all of Atmel's controllers.

On the other hand, Atmel has cheap dev and eval boards. The all have "xplained" in their name. Most have a programmer, often even a debugger, on board. From $10 to $30.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: C/C++ and the codeblocks IDE
« Reply #11 on: November 13, 2014, 06:51:01 am »

 I plan on taking an hour or so a night and working my way though the tutorial found here...

http://www.tutorialspoint.com/cprogramming/index.htm

That actually looks like a pretty cool website for learning beginning C....    But in pink! Really?

If you're interested in learning C for embedded projects, I can highly recommend the free online embedded programming MOOC from University of Texas.  Next session will start up in January at edX HERE
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4263
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: C/C++ and the codeblocks IDE
« Reply #12 on: November 13, 2014, 07:18:33 am »
For running C or C++ on the pc I use Qt. It offers plain C/C++ and Qt library with extensive gui options (where you'd use boost for if you're using codeblocks with compiler)
And one major advantage is that there is no hassle with compilers, on any platform. Manually setting up a toolchain is not something I enjoy.

I've worked with codeblocks, it seemed like a minimalistic and outdated ide. But that might just be what you're looking for.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: C/C++ and the codeblocks IDE
« Reply #13 on: November 13, 2014, 11:50:00 am »
Quote
the ST dev boards from mikroelektronika and the avr dragon seem to be the best contenders for entry level experimental programming.

I would encourage you to take a look at the ST discovery boards, as well as the Nucleo boards. Both offer incredible value for the money, and are ready to go / all-in-one boards. The Nucleo has the added advantage of offering arduino connectors so lots of cheap shields to use.

I use CoIDE myself and have no complaint about it.

The dragon was a versatile board for its time but it offers too little for the money in today's market.
================================
https://dannyelectronics.wordpress.com/
 

Offline ampdoctorTopic starter

  • Frequent Contributor
  • **
  • Posts: 266
  • Country: us
Re: C/C++ and the codeblocks IDE
« Reply #14 on: November 14, 2014, 06:15:37 am »
Quote
That actually looks like a pretty cool website for learning beginning C....    But in pink! Really?

If you're interested in learning C for embedded projects, I can highly recommend the free online embedded programming MOOC from University of Texas.  Next session will start up in January at edX HERE
It's not bad for getting up to speed but it would probably be useless if you've got no programming experience whatsoever. WRT the edX course, I noticed that and was considering it but life for the foreseeable future is a bit hectic and unpredictable which puts me into the get a board and start mucking about in your free time camp.

For running C or C++ on the pc I use Qt. It offers plain C/C++ and Qt library with extensive gui options (where you'd use boost for if you're using codeblocks with compiler)
And one major advantage is that there is no hassle with compilers, on any platform. Manually setting up a toolchain is not something I enjoy.

I've worked with codeblocks, it seemed like a minimalistic and outdated ide. But that might just be what you're looking for.
I'm not really looking for a compiler to build windows apps, though I may get that hair up at some point. For now I just wanted something that I can practice the basics and build some kind of executable to see the result without a lot of clutter. If I can get hex and makefiles as well then all the better.

Quote
the ST dev boards from mikroelektronika and the avr dragon seem to be the best contenders for entry level experimental programming.

I would encourage you to take a look at the ST discovery boards, as well as the Nucleo boards. Both offer incredible value for the money, and are ready to go / all-in-one boards. The Nucleo has the added advantage of offering arduino connectors so lots of cheap shields to use.

I use CoIDE myself and have no complaint about it.

The dragon was a versatile board for its time but it offers too little for the money in today's market.

The number of development boards from all the mfg's give you a crazy number of options. However, it seems most of them are aimed squarely at the ARM cortex chips.  Since I'm pretty green at this point I'm leaning more toward the Atmel AVR mcu's, not because they're in any way better but rather that it's quite popular with the hackers/makers so there's a lot of resources available for dicking around. I'd also like to have the flexibility of being able to pull the chip and use it in actual projects and not be married to a specific dev board. Having said that, I'm almost tempted to order up an el cheapo isp from adafruit and get a copy of avrdude then just have at it with a breadboard and some junk box parts.

 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4392
  • Country: us
Re: C/C++ and the codeblocks IDE
« Reply #15 on: November 14, 2014, 07:23:30 am »
Quote
I'm leaning more toward the Atmel AVR mcu's, not because they're in any way better but rather that it's quite popular with the hackers/makers so there's a lot of resources available
You can hardly go off looking for "the next big thing" in programming languages, and then say you'd rather use a CPU architecture from two decades ago...  Not that the AVR isn't a pretty good chip, as long as you don't exceed 64k or so of memory space.  But "C" it will be (including "primitive" C++ bits and pieces, which I actually think can be a good thing (but don't expect your AVR embedded C++ programs to look much like the C++ they teach you for desktops.)
 

jucole

  • Guest
Re: C/C++ and the codeblocks IDE
« Reply #16 on: November 15, 2014, 12:40:43 pm »
I use codeblocks and C with a custom build script for my embedded stuff;   once you understand pointers in C you're ready to take on any language!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf