Alternative languages for GCC ?

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everybody,
I know it is a bit weird and I do not want to start a flame war about languages, but I would like to use some other language beside C and ASM for programming AVR.
This is not mainly for a valid technical reason, but, you know, my full time job is programming C#, C++ and C, so for my hobby I would prefer something else... 8)

Quick to the point, I want to share with you my brief experience.
I tried to use bingo's script also for building a fortran cross-compiler but -alas- it failed.
So I started to look around and found the -maybe obsolete but interesting- f2c fortran77 to C converter.

I'm doing some experiments with a C main program and fortran 77 external subroutines and it seems to work..

moreover, fortran 77 code reminds of my youthness :shock:

I tried Ada (avr-ada) but unfortunately I was unable to build the compiler, it's a pity since it is a fascinating project.
I know that Ada-core now supports avr cross compilation but I'm afraid only for registered user, maybe someone here know more, I would really like to see Ada on the avr.

Then I started looking for possible Pascal / Modula support, apart from commercial compilers I found two interesting free translators, the first (and more ancient) is p2c, with pascal and partial Modula-2 support, the other is XDS, with ISO Modula-2 and also Oberon.

I would like to know if there are other guys interested in such crazy tasks, generally speaking it seems to me that the "Language X translator to C" approach is the best suited for our task and simpler to do than building a GCC cross compiler with support for other languages.

Hi again
Paolo Bashir

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ISTR there was at least one issue of WinAVR with a working copy of avr-ada in it.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also, believe it or not, GNU Modula 2 has been built for generating code for the AVR.

http://www.nongnu.org/gm2/

The person heading up the efforts for GM2 is a friend of mine. University prof in the UK.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bashir1961 wrote:

I would like to know if there are other guys interested in such crazy tasks, generally speaking it seems to me that the "Language X translator to C" approach
Paolo Bashir

the native mode version of Zbasic translates that structured Basic to C. see zbasic.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Several years ago I developed an AVR development board which my highschool was going to use for microcontroller classes. A part of the project was some research into different programming languages which my school could use. One of the more promising languages was a BASIC interpreter or compiler. I forgot the name but it was a pretty common development environment at that time. (And free for small projects).

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

One of the more promising languages was a BASIC interpreter or compiler. I forgot the name but it was a pretty common development environment at that time.

Bascom by any chance? But the OP here was looking for GCC front-ends that could bolt onto the GCC backend I think. I'm not sure there is a BASIC front end that can be used for AVR is there? (though there is FORTRAN)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hello,
thanks to everybody for the answers, unfortunately I'm a bit busy in this period, so I stopped (sigh) avr experiments.

Don't get me wrong but I'd rather avoid Basic (again, it reminds me my daytime job), and yes, I initially am looking for some other Gcc front-end to attach to the working avr backend but only because it is -apparently- a feasible task.

An alternative Pascal compiler could be an interesting project but requires far too much effort for me, the pascal to C approach (p2c) is promising, should I find more time to devote to this task I will share with you any results.

Thanks again
Paolo Bashir

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wrote a "high level assembler" with a Modula 2 syntax many years ago for the Motorola 6800, then the 65C02, and finally the SGS Thompson 62E10. Now I use the Atmel AVR series exclusively, but have not had the time to port this assembler to the AVR.
Does anyone have a document on how the list file hex codes are generated, especially branch calculations and offsets. This is usually the most painful part of the "port".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is reputed to be version of forth for AVR. Hard to get much different from your day job than that! I don't believe that it involves gcc in any way.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JCommLAB wrote:
I wrote a "high level assembler" with a Modula 2 syntax many years ago for the Motorola 6800, then the 65C02, and finally the SGS Thompson 62E10. Now I use the Atmel AVR series exclusively, but have not had the time to port this assembler to the AVR.
Sounds like fun - not my kind of fun, but fun for somebody. :twisted:
JCommLAB wrote:
Does anyone have a document on how the list file hex codes are generated, especially branch calculations and offsets. This is usually the most painful part of the "port".
I'm not exactly sure what you are asking for here. The AVR intruction set is available here. The Intel Hex format is described here (WikiPedia) and here (PDF).

I of course would recommend getting each datasheet for each AVR type you intend to support. They can be found here. I suppose you could rip off the part description files (in XML) from AVR Studio as long as you never intend to commercially release your code. These reside in \AVR Tools\Partdescriptionfiles.

Also, to make debugging easier, you might want to emit your code in the ELF format that AVR Studio, avrdude, and other tools use as input. I have no idea where the AVR-specific information on that format exists, but others on the forum do.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!