Code::Blocks Forums

User forums => Embedded development => Topic started by: martonmiklos on April 01, 2011, 09:04:52 pm

Title: MSP430 compiler did not listed
Post by: martonmiklos on April 01, 2011, 09:04:52 pm
Hello all,

I would like to use the C::B for MSP430 development using mspgcc4.
I have managed to compile the toolchain to the /op/mspgcc4 folder.
I have selected Settings -> Compiler and Debugger Settings, but the MSP430 GCC is not listed there.

I am using C::B 10.05 from ppa:
http://forums.codeblocks.org/index.php?topic=13203.0

I have linked all the mspgcc binares to the /usr/bin, but it did no helped.
Title: Re: MSP430 compiler did not listed
Post by: oBFusCATed on April 01, 2011, 09:23:38 pm
Copy the GCC compiler and change the executables in the Toolchain tab
Title: Re: MSP430 compiler did not listed
Post by: MortenMacFly on April 01, 2011, 09:24:50 pm
I have selected Settings -> Compiler and Debugger Settings, but the MSP430 GCC is not listed there.
What do you mean by that? It's not enough to compile a(ny) compiler and C::B will automatically support it. How should that work? :shock:

However, if your target compiler is interface compatible with GCC (which seems the case) you can easily make a copy of the GCC compiler and adjust the settings, primary the compiler/linker... executables accordingly.
Title: Re: MSP430 compiler did not listed
Post by: martonmiklos on April 01, 2011, 09:43:24 pm
The wiki page says that this compiler is supported:
http://wiki.codeblocks.org/index.php?title=Main_Page

This page said that this compiler should be listed too:
http://cubesat.wikidot.com/obdh-codeblocks-guide

I have a few compilers in the list (PowerPC gcc for e.g.) which I do not have installed, so I do not think that the C::B lists only the detected compilers there.
Title: Re: MSP430 compiler did not listed
Post by: MortenMacFly on April 01, 2011, 10:22:21 pm
The wiki page says that this compiler is supported:
http://wiki.codeblocks.org/index.php?title=Main_Page
If you read further you'll realise that this is Windows only. ;-) It's untested on Linux.

You can (however) try to compile c::B yourself and see if it's working on Linux, too.
Title: Re: MSP430 compiler did not listed
Post by: martonmiklos on April 01, 2011, 10:35:38 pm
@MortenMacFly
Oh yes, it is a bit late at us now, so I have missed it.

Copying the GCC compiler template, and correcting the executables path does not working, because the mspgcc has several compiler specific option just like the -mmcu option for e.g.

I have checked out the latest code, and found the related code in the compilerGNUMSP430.cpp. As I seen it is not windows only, and it is looking for the executables in the /usr/local/msp430. I have linked the neccessary content to there.
I have analyzed the code further and realized that this compiler is not enabled on Linux.
So I will hack it tomorrow.
Title: Re: MSP430 compiler did not listed
Post by: MortenMacFly on April 01, 2011, 10:41:23 pm
So I will hack it tomorrow.
I had a look into, it's actually quite simple:
Just move the inclusion of:
Code
    #include "compilerGNUMSP430.h"
out of the "#ifdef __WXMSW__" section and this should probably be it.

If it works, please report back and we can do it on trunk.

(I am using Linux only if needed you know...)
Title: Re: MSP430 compiler did not listed
Post by: martonmiklos on April 01, 2011, 11:20:50 pm
I have done with it, and compiling a sample project is working.

I have some plans:
- The supported MCU's list needs some extending. It will be easy, because I have found all the possible -mmcu options int the mspgcc's source so after some regexp playing I will add them easily.
- I will improve the default compiler path looking algorithm, because most the mspgcc4's offical installer installs itself to the /opt by default.
- I will try to hack a project wizard, whith what I could add "inhouse" programming feature using mspdebug as post build or run step.

If I will be ready I will submit my work as a patch.
Title: Re: MSP430 compiler did not listed
Post by: MortenMacFly on April 02, 2011, 09:19:17 am
If I will be ready I will submit my work as a patch.
Great. Thank you.
Title: Re: MSP430 compiler did not listed
Post by: martonmiklos on April 05, 2011, 10:47:43 pm
I know this is not the most suitable topic to ask it, but maybe you have some idea how should I implement it:
I would like to have an associative array in the wizard script, because the mspdebug needs the MCU name in different format than the msp-gcc.
I figured out that the script is written in squirrel, but the documentation of it is very poor. According to it in the 3.0 version docs it says I can create tables in JSON format, but when using this syntax it gives me an error message at the first point. The 2.0 doc's table section is completly unundestoodable by me. The C::B docs does not says anything about the squuirrel version, but I guess it uses the 2.0 syntax
Title: Re: MSP430 compiler did not listed
Post by: oBFusCATed on April 05, 2011, 11:01:07 pm
Squirrel is 2.2.something... 3.0 seems pretty new...
Title: Re: MSP430 compiler did not listed
Post by: MortenMacFly on April 06, 2011, 06:40:09 am
Squirrel is 2.2.something... 3.0 seems pretty new...
Squirrel 2.2.4 and SqPlus (for that version).
Title: Re: MSP430 compiler did not listed
Post by: VaZso on May 02, 2011, 02:35:21 am
Hello,

I've tried to setup CodeBlocks to work with MSP430 under Linux.
I have the compiler in /opt directory and I could modify the settings based on "GNU AVR GCC Compiler"
with the appropriate paths... the only thing I couldn't find is how to add/modify compiler flags.

So I would like to set the -mmcu flag, but now I can't find where can I do this.

I hope you can help me find this out.

Sorry if my question is too simple, I'm a bit tired because it is too late here now.

Thank you for any help.

Edit: Is it a solution, if I write the appropriate switch(es) under "other options" tab at compiler & debugger settings?
May it work well?
Title: Re: MSP430 compiler did not listed
Post by: doragasu on September 12, 2011, 04:12:55 pm
Hi,

Any news about this topic? Is there a way to use C::B for mspgcc under Linux?
Title: Re: MSP430 compiler did not listed
Post by: oBFusCATed on September 12, 2011, 04:29:37 pm
I have done with it, and compiling a sample project is working.

I have some plans:
- The supported MCU's list needs some extending. It will be easy, because I have found all the possible -mmcu options int the mspgcc's source so after some regexp playing I will add them easily.
- I will improve the default compiler path looking algorithm, because most the mspgcc4's offical installer installs itself to the /opt by default.
- I will try to hack a project wizard, whith what I could add "inhouse" programming feature using mspdebug as post build or run step.

If I will be ready I will submit my work as a patch.
Have you read this?
Then reread the topic, download the c::b's code, modify it accordingly and then compile it...
Title: Re: MSP430 compiler did not listed
Post by: martonmiklos on September 12, 2011, 08:08:15 pm
Hey,

Sorry for forgotting to post the patch, but I get totally fed up with the squirrel, and wxwidgets, and gave up my goals.
I got totally lost when I was unable to create an associatible array. No examples nothing nowhere on the web, and it is almost impossible to find relevant information due the common name (squirrel oh yeah).

So I have attached a patch which adds support for the msp430-gcc on Linux.
I have also attached a tar.gz which should be uncompressed to src/plugins/scriptedwizard/resources

This adds a wizard to the C::B. Creating and compiling a project works. At least to MSP430F5438, what I have tried.

I have tried to add an option to be able to program after building, but my knowledge was not enough to do it.

The C::B's squirrel parser says to the toupper function that it does not exists (if user selects the programmer). I have stripped my code to be able to parsed with a standalone squirrel (removed _T macros, and project related stuff), and it worked.

If anyone has some kind of more advanced debugging techique to create/debug scripted wizards, please let me know.
 Also generating some user feedback dialogs (messagebox, etc.) from the script would be helpful to improve the wizard, but I have not found any examples.
Title: Re: MSP430 compiler did not listed
Post by: oBFusCATed on September 12, 2011, 08:38:07 pm
Have you tried to use tables?
http://www.squirrel-lang.org/doc/squirrel2.html#d0e516
Title: Re: MSP430 compiler did not listed
Post by: doragasu on September 19, 2011, 05:11:27 pm
Thanks a lot for  help martonmiklos.

For me it's really nasty MSP430 support isn't enabled in Linux by default. Having to download, patch and compile C::B isn't the easiest and fastest way to start coding for this platform.

I will post my results if I finally compile it. (The other option I'm considering is using Eclipse).