yyrkoon

Code::Blocks + mspgcc how-to.

38 posts in this topic

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.

 

Share this post


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.

Share this post


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:

 

post-32545-0-92695400-1368121073_thumb.png

Share this post


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.

Share this post


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
#define TIMER0_A1_VECTOR TIMERA1_VECTOR
#define TIMER0_A0_VECTOR TIMERA0_VECTOR
#endif
 
int main(void)
{
 
 
WDTCTL = WDTPW + WDTHOLD; 
 
P1DIR = 0x40; 
P1OUT = 0; 
BCSCTL3 |= LFXT1S_2; 
IFG1 &= ~OFIFG;  
 
__bis_SR_register(SCG1 + SCG0);
 
BCSCTL2 |= SELM_3 + DIVM_3; 
 
while(1)
{
P1OUT = 0x40; // LED on
__delay_cycles(100);
P1OUT = 0; // LED off
__delay_cycles(5000);
}
     return 0;}

Share this post


Link to post
Share on other sites

Hi

 

Thanks yyrkoon for your tutorial!

 

I've got programming up and running on Mac OS X 10.8.4 and want to add something for my fellow Mac users.

 

The tool config window should look like this:

 

Screen_Shot_2013_07_31_at_23_40_34.png

 

Then the Code::Blocks console will read something like this:

Launching tool 'Upload': /usr/local/msp430/mspdebug/mspdebug rf2500 --force-reset "prog /Users/jacob/Engineering/CodeBlocks/msprf24-rx/bin/Debug/msprf24-rx.elf" (in /Users/jacob/Engineering/CodeBlocks/msprf24-rx/bin/Debug)
stdout> MSPDebug version 0.20 - debugging tool for MSP430 MCUs
stdout> Copyright (C) 2009-2012 Daniel Beer <dlbeer@gmail.com>
stdout> This is free software; see the source for copying conditions.  There is NO
stdout> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
stdout> 
stdout> Trying to open interface 1 on 006
stdout> Initializing FET...
stdout> FET protocol version is 30066536
stdout> Configured for Spy-Bi-Wire
stdout> Sending reset...
stdout> Set Vcc: 3000 mV
stdout> Device ID: 0x2553
stdout>   Code start address: 0xc000
stdout>   Code size         : 16384 byte = 16 kb
stdout>   RAM  start address: 0x200
stdout>   RAM  end   address: 0x3ff
stdout>   RAM  size         : 512 byte = 0 kb
stdout> Device: MSP430G2553/G2403
stdout> Code memory starts at 0xc000
stdout> Number of breakpoints: 2
stdout> Chip ID data: 25 53
stdout> Erasing...
stdout> Programming...
stdout> Writing 2038 bytes at c000 [section: .text]...
stderr> 
stdout> Writing   32 bytes at ffe0 [section: .vectors]...
stdout> Done, 2070 bytes total
stdout> 
Tool execution terminated with status 0

 

 

Which means your Launchpad MSP430 is now programmed and running :-)

Share this post


Link to post
Share on other sites

Thank you! Copy and translate to Russian: http://www.shelezyakin.ru/?p=816

I've learned about yyrkoon's "how-to" from shluzzzoid. And installed the CB and mspgcc. Thank you guys!

 

Being a newbee in MSP430 MCUs, I like the GRACE program which I installed as standalone tool. It helped me very much to configure MCU's periphery and obtain several init C-files.

Now I want to use GRACE-generated files in my CODE::BLOCKS project. And to do it by "late linking": any time I decide to change smth in MCU periphery, I'd like to do it in GRACE, then refresh generated files and just remake the CODE::BLOCKS project. So GRACE project is used not once as a init code source, but is kept in the CB project forever and may be changed.

Is it sensible at all?

 

I've organised a common folder for GRACE and CB projects, included all GRACE-generated files in CB project and tried to compile. Compiler shows errors... Seemingly I have to arrange proper paths for header and lib files. And I cannot figure it out - what libraries do GRACE use? What path have I to add in CD compiler settings to use GRACE files?

 

Note: the CD paths are as yyrkoon proposed - in HighTech folder.

Share this post


Link to post
Share on other sites

 Hi,

Compiling template I get this error message

#include int main(){ return 0;}
..\main.c|1|error: #include expects "FILENAME" or <FILENAME>|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|


CodeBlock version : 12.11

 

Any idea to help me ?

 

Salutations

Share this post


Link to post
Share on other sites

This still works with the latest versions of Energia, and code::bocks. Need to test further but so far so good.

Share this post


Link to post
Share on other sites

Well, by "works" It compiled code, without errors Have to setup and upload to a board  still . . .

Share this post


Link to post
Share on other sites

Everything still works fine with the latest version of code::blocks, and the first version of energia on Windows 10 x64 pro. In fact, the launchpad is recognized straight out of the box, without installing drivers. That is, at least for the purpose of flashing binaries to the launchpad.

 

IN fact I've just flashed three TSSOP-20 parts, using the launchpad using a ZIP socket adapter + 20 pin TSSOP to DIP socket adapter.

Frida likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now