EmbeddedRelated.com
Forums

Basic compiler for MSP430

Started by Stephan Portier February 22, 2010
Hello,

I wanted to ask users for something. Is there any interest in a basic
compiler for msp430 series?

I want to write a basic or Pascal compiler for this chip and wanted to know
if users really have interest or no.

Regards



Beginning Microcontrollers with the MSP430

Hi,

> I wanted to ask users for something. Is there any interest in a basic
> compiler for msp430 series?
>
> I want to write a basic or Pascal compiler for this chip and wanted to
> know if users really have interest or no.

You want to make a business out of this? Good luck! It's hard work.
Writing the compiler is the easy bit. Writing the runtime support (float +
double, for instance), writing a debugger, writing the flashing code,
supporting multiple families, two code generators for MSP430 and MSP430X,
writing the memory maps, writing the documentation...

Now, if it's a simple open source project, by all means, knock yourself out!

However, all TI's libraries are written in C--so how would you integrate
those? And what about an RTOS?

Makes me feel queasy just thinking about this stuff.

However you look at the embedded world these days, C has won.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for EFM32, STM32, LPC1000, SAM9, and more!

Basic is just a subset of C (or opposite :-). Probably a Basic to C converter
will do the job (like this one http://bcx-basic.sourceforge.net/ ).
However, switching from Basic to C is not a big deal for a human... ;-).
C is standard for microcontrollers, everybody is using C, so why using a
language with the same features, but a little different syntax?
Because it is teached in school? Why does the school not teach C?

M.

Paul is right. There is no commercial mileage in it.

Many moons ago I used to write & sell (!?) BASIC interpreters optimised for
embedded systems.
Am I rich now? Err, no.

I also wrote a TurboPascal IDE/compiler system to write Windows apps...
shortly BEFORE Borland came out with theirs.
Mine even allowed Windows apps to be debugged via single step etc ...
unlike V1 of Turbo Pascal for Windows.
Err, who had the marketing muscle to own the market and make the money? Not
me.

Now, if it's an academic exercise, you will learn a lot from writing a
compiler for a decent language.
Or a compiler targeted at a problem domain.

----- Original Message -----
From: Paul Curtis
To: m...
Sent: Monday, February 22, 2010 4:35 PM
Subject: RE: [msp430] Basic compiler for MSP430

Hi,

> I wanted to ask users for something. Is there any interest in a basic
> compiler for msp430 series?
>
> I want to write a basic or Pascal compiler for this chip and wanted to
> know if users really have interest or no.

You want to make a business out of this? Good luck! It's hard work.
Writing the compiler is the easy bit. Writing the runtime support (float +
double, for instance), writing a debugger, writing the flashing code,
supporting multiple families, two code generators for MSP430 and MSP430X,
writing the memory maps, writing the documentation...

Now, if it's a simple open source project, by all means, knock yourself out!

However, all TI's libraries are written in C--so how would you integrate
those? And what about an RTOS?

Makes me feel queasy just thinking about this stuff.

However you look at the embedded world these days, C has won.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for EFM32, STM32, LPC1000, SAM9, and more!

hi Stephan...
I think most of embeded systems programmers use C compiler...

but... what about of a graphic compiler? at least a basic peripheral components like UART or PWM configuration in a graphical environment..

it could to produce C code to use with standard C programming...









Something like Freescale CodeWarrior Beans modules would be nice for the
MSP. You just drag'n'drop a module to the project, attach to the
processor, set a few switches and it creates all the init codes and
other auxiliary routines...

Calin

On 22/2/2010 16:16, Alexander Espinosa wrote:
>
> hi Stephan...
> I think most of embeded systems programmers use C compiler...
>
> but... what about of a graphic compiler? at least a basic peripheral
> components like UART or PWM configuration in a graphical environment..
>
> it could to produce C code to use with standard C programming...
>
>


Hello Paul,

I waited for your answer ;)

I know its a very hard work. Writing the compiler itself is not an easy
thing. Now adding all other stuff is a very time consuming task.

This is why I posted here, I wanted to know if there is any interest in such
tool.

I personally use a lot C even on little chips (like PIC or AVR).

Basic is a nice language for hobbists, but definitely not suited to
professional users or professional projects, especially because it lacks
some data structures like Pointers and pointers to functions (to be able to
write RTOS cleanly). If I had to implement all that on a language to just
make it able to do what C already do, its a no sense.

As for importing C libs, its almost impossible because it needs to
implement all C conventions (regs for passing params, allocate regs with C
convention to keep r12..r15 for scratch, ) and to implement all needed
universal formats (ELF mainly) to be able to link with existing object
generated files.



All this is a really very hard work (and this is only the COMPILER part, the
easy part as you mentioned).

This is why I wanted the feedback of the community (and specially YOU cause
I know your experience with dev tools selling).



Thanks to everybody here J
Best regards

Stephan



De : m... [mailto:m...] De la part de
Paul Curtis
Envoy: lundi 22 frier 2010 17:36
: m...
Objet : RE: [msp430] Basic compiler for MSP430





Hi,

> I wanted to ask users for something. Is there any interest in a basic
> compiler for msp430 series?
>
> I want to write a basic or Pascal compiler for this chip and wanted to
> know if users really have interest or no.

You want to make a business out of this? Good luck! It's hard work.
Writing the compiler is the easy bit. Writing the runtime support (float +
double, for instance), writing a debugger, writing the flashing code,
supporting multiple families, two code generators for MSP430 and MSP430X,
writing the memory maps, writing the documentation...

Now, if it's a simple open source project, by all means, knock yourself out!

However, all TI's libraries are written in C--so how would you integrate
those? And what about an RTOS?

Makes me feel queasy just thinking about this stuff.

However you look at the embedded world these days, C has won.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for EFM32, STM32, LPC1000, SAM9, and more!



Hello Stephan,

If your target audience is hobbyists and maybe fast prototyping/ad-hoc
solutions wouldn't it be an option to also consider an Arduino port for
MSP430? I heard it is the best since sliced bread. Never worked with it
though, but they define their own C-like language.

Just my 2 cents,

Hans

On Tue, 23 Feb 2010 07:12:58 +0100
"Stephan Portier" wrote:

> Hello Paul,
>
> I waited for your answer ;)
>
> I know its a very hard work. Writing the compiler itself is not an easy
> thing. Now adding all other stuff is a very time consuming task.
>
> This is why I posted here, I wanted to know if there is any interest in such
> tool.
>
> I personally use a lot C even on little chips (like PIC or AVR).
>
> Basic is a nice language for hobbists, but definitely not suited to
> professional users or professional projects, especially because it lacks
> some data structures like Pointers and pointers to functions (to be able to
> write RTOS cleanly). If I had to implement all that on a language to just
> make it able to do what C already do, its a no sense.
>
> As for importing C libs, its almost impossible because it needs to
> implement all C conventions (regs for passing params, allocate regs with C
> convention to keep r12..r15 for scratch, ) and to implement all needed
> universal formats (ELF mainly) to be able to link with existing object
> generated files.
>
>
>
> All this is a really very hard work (and this is only the COMPILER part, the
> easy part as you mentioned).
>
> This is why I wanted the feedback of the community (and specially YOU cause
> I know your experience with dev tools selling).
>
>
>
> Thanks to everybody here J
>
>
> Best regards
>
> Stephan
>
>
>
> De : m... [mailto:m...] De la part de
> Paul Curtis
> Envoy: lundi 22 frier 2010 17:36
> : m...
> Objet : RE: [msp430] Basic compiler for MSP430
>
>
>
>
>
> Hi,
>
> > I wanted to ask users for something. Is there any interest in a basic
> > compiler for msp430 series?
> >
> > I want to write a basic or Pascal compiler for this chip and wanted to
> > know if users really have interest or no.
>
> You want to make a business out of this? Good luck! It's hard work.
> Writing the compiler is the easy bit. Writing the runtime support (float +
> double, for instance), writing a debugger, writing the flashing code,
> supporting multiple families, two code generators for MSP430 and MSP430X,
> writing the memory maps, writing the documentation...
>
> Now, if it's a simple open source project, by all means, knock yourself out!
>
> However, all TI's libraries are written in C--so how would you integrate
> those? And what about an RTOS?
>
> Makes me feel queasy just thinking about this stuff.
>
> However you look at the embedded world these days, C has won.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks V2 is out for EFM32, STM32, LPC1000, SAM9, and more!
>
>
>
>
>
>
>
--
hans

Stephan,

> I waited for your answer ;)
>
> I know its a very hard work. Writing the compiler itself is not an easy
> thing. Now adding all other stuff is a very time consuming task.

I suggest you google "MSP430 Basic Compiler". When you do, see what I
posted in 2004:

http://osdir.com/ml/hardware.texas-instruments.msp430.discuss/2004-02/msg001
82.html

> This is why I posted here, I wanted to know if there is any interest in
> such [a] tool.

I implemented a BASIC front end onto our intermediate representation that
all our compilers generate, making it a first-class citizen of the MSP430
Development Tools world. That is, the BASIC compiler was as good as the C
compiler as it shared code generation, linked with C code, and had a full
complement of runtime support courtesy of the C compiler. And full debug
support, full floating point, and so on.

Question: did we take it to market?

> Basic is a nice language for hobbists, but definitely not suited to
> professional users or professional projects, especially because it lacks
> some data structures like Pointers and pointers to functions (to be able
> to write RTOS cleanly). If I had to implement all that on a language to
> just make it able to do what C already do, its a no sense.

Actually, there are a lot of BASIC compilers about offering exactly those
features. One of the companies I was a consultant at used MS VB to command
the displays on screens in hundreds of betting shops across the UK and
Ireland. VB has its faults, but now MS has made it work pretty darn well
using CLR.

> As for importing C libs, its almost impossible because it needs to
> implement all C conventions (regs for passing params, allocate regs with
> C convention to keep r12..r15 for scratch, ) and to implement all needed
> universal formats (ELF mainly) to be able to link with existing object
> generated files.

Yeah. It helps of you already have all that stuff just laying around... ;-)

> All this is a really very hard work (and this is only the COMPILER part,
> the easy part as you mentioned).
>
> This is why I wanted the feedback of the community (and specially YOU
> cause I know your experience with dev tools selling).

There will be more on this topic soon. Not for MSP430, but certainly you'll
see something quite different from us when it's de-cloaked.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks V2 is out for EFM32, STM32, LPC1000, SAM9, and more!

This is an interesting prospect. If the goal is to make a "hobby" compiler, than maybe you're trying to create a solution without a problem. The truth is that MSP430 is really not a hobbyist device. It's NOT optimized in the least for being "easy" or inexpensive from a startup cost point of view (I know, GCC, bla bla bla). It is also hard for a beginner to debug. It IS optimized for extremely low power and low parts-count with its nicely inegrated peripherals (which IS good for hobbyists).

BASIC ("Beginners" All-purpose Symbolic Instruction Code) requires a fair amount of resource to support the run-time interpreter. Plus, it thrives for beginners who have a nice display (like my old black-and-white TV hooked to my TRS-80) to show them that they have a syntax error on line 110.

Pascal on the other hand may actually make sense. Pascal was specifically designed as a teaching language. An important difference for this discussion is that it is a compiled language (not interpreted like BASIC), so a lot of the burden that BASIC carries is taken care of at compile time. If I remember correctly, you can easily "plug-in" libraries, which in this case could be those which support the MSP430 peripherals.

But, as another poster suggested, a graphical "language" may make the most sense if the goal is for hobbyists or even students (although not for teaching programming). It could convert "blocks" which represent timers, ADC, etc. into C code, and you may actually end up with a reasonably efficient program.

Have fun with this project.

Stuart

--- In m..., "Stephan Portier" wrote:
>
> Hello,
>
> I wanted to ask users for something. Is there any interest in a basic
> compiler for msp430 series?
>
> I want to write a basic or Pascal compiler for this chip and wanted to know
> if users really have interest or no.
>
>
>
> Regards
>
>
>
>
>