Jump to content

Code::Blocks + mspgcc how-to.

Recommended Posts

Congratulations for the Code::Blocks implementation and the nice videos!


Going to be playing with Visual Studio too. Both of these exercises have taught me a lot so far.



There is a very nice Visual Studio plug-in for embedded computing called Visual Micro, alas limited to Arduino only.




It features software debugging by code injection. Feel free to contact its developer, Tim.


I've developed a similar template for Xcode, called embedXcode (websiteforum)




I'm looking for solutions to bring debugging capabilities.



Link to post
Share on other sites
  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

This how-to is primarily for Windows users. However, paths aside most of this information should be applicable for Linux users as well. Technically, this should also work with OSX. You will need Ener

Step 3: In this video I discuss invoking MSP430 command line tools from within the Code::Blocks IDE. First, by demonstrating how to create a simple tool from the tool menu, and then finally invoking t

Step 7. A quick explanation of mspdebug, and how the user defined Upload tool from within Code::Blocks mentioned in a previous video was setup.  

Posted Images

So, I did a bit of research ( a tiny bit ) followed by some experimentation, and it seems that debugging from within code::blocks is not going to be as easy as I had first anticipated. I can get mspdebug to accept a connection from gdb called by code::blocks, but that is about it. No memory dump, breakpoints, or anything that debugging is supposed to do works.


Granted, I know nearly ziltch about gdb, and it seems there is a ton of things I have to read before I may get this to work. So, this alone may turn into a long standing project of its own. I'll ask around a little, and see if this is going to be worthwhile overall.

Link to post
Share on other sites

I had the same experience with gdb and Xcode.


I manage to use gdmanually with two Terminal windows, but connection to Xcode is almost impossible.


I think I've actually decided to write my own intermediate tool, and while at it, I may also just implement my own build tool based on msp430-GCC/G++ too. Although Rickta59 brought to my attention that there are already GUI front ends for GDB,


So yeah I am not 100% sure how I will approach this, but whatever I do, I am not just going to rush into things to get something out there *right now*. The end goal though, is a tool that can take a few cmd line arguments, and then build, upload, and debug *your* code, through a GUI, and have nicely formatted text to to read through.


Anyway a day or two ago, I wrote up a quick prototype, to give me a better idea of what I need to do, and how. Nothing that debugs and spits debug information out nicely formatted yet though.


Got a lot on my plate at the moment, so not sure how long it will take me. . .  Need to do a lot of reading on GDB, refresh my memory on various aspects of the .NET framework, my reflow controller code needs to be finished / polished, not to mention the every day mundane tasks of life. Not to mention the videos I plan on doing still . . .

Link to post
Share on other sites


This IDE looks great ! Thanks for sharing.


But after all steps, video 1 and video 2, i got this message:




Do you have any idea ?


Sounds like you did not set up the tool chain under the toolchain executable s tabs as I described. They must be set up exactly like shown in the picture below. You do not need to worry about the debugger, and make tools. Resource compiler is also not needed.


msp430-gdb and Code::Blocks do not seem to play well with one another anyhow . . . which is one reason why i want to build my own intermediate tool for the toolchain.



Link to post
Share on other sites
Step 8. A quick overview of what a new user to the MSP430 Launchpad platform needs, in order to learn programming. Briefly cover where to find the MSP430x2xx family users guide, and a very quick explanation of the header file includes


Armed with this information we should then be able to start programming the device.


Link to post
Share on other sites

Would anyone like to see anything specific ?


I am currently working on some ideas for videos, and I am aware, or at least I have this nagging feeling that I am not doing these videos right somehow. So any comments as to how I could improve my videos would be most welcome.


 Be harsh, or not it really does not matter as long as it is constructive.

Link to post
Share on other sites
  • 1 month later...
Hi, i followed all the steps but unfortunately it didn't work.
it show me some errors( i think that may be code::blocks cannot find the libraries). 

Do you have any idea what i can do to solve the errors ?


thanks  :smile:



Link to post
Share on other sites


Hi, i followed all the steps but unfortunately it didn't work.
it show me some errors( i think that may be code::blocks cannot find the libraries). 

Do you have any idea what i can do to solve the errors ?


thanks  :smile:



Looks like a couple minor code errors:


error: '::main' must return 'int'

In function 'int main()':
error: 'P1DRI' was not declared in this scope
error: '_bis_SR_register' was not declared in this scope
error: '_delay_cycles' was not declared in this scope
For the first error, main() must be declared to "return" int -- use "int main(void)" instead of "void main(void)".  Also put a simple "return 0;" at the end of your main routine.  It will never get called which is silly but it's a convention that is required by MSPGCC.
Second error, looks like you misspelled P1DIR as "P1DRI" :smile:
Third and fourth errors, those functions have 2 underscores in front of them, not 1: "__bis_SR_register" and "__delay_cycles"
Give those a try.
Link to post
Share on other sites

thank you a lot :D 


what you said were usefull . I'm new in programing and i don't know many things. I would like to ask something else i run the program and everything ok but i can't see the result in my MSP430 :(

What can i do for that? 


these is  my code : 



#include <msp430g2553.h>
#ifndef TIMER0_A1_VECTOR
int main(void)
P1DIR = 0x40; 
P1OUT = 0; 
IFG1 &= ~OFIFG;  
__bis_SR_register(SCG1 + SCG0);
BCSCTL2 |= SELM_3 + DIVM_3; 
P1OUT = 0x40; // LED on
P1OUT = 0; // LED off
     return 0;}
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...