1. Embedded systems - C translator.

Seeing as I don't write C programs and I can't be arsed to write in assembler...

Would it be possible - in principle - to write Euphoria code for an embedded system then use the C-translator with the -keep option to generate C source code then use a cross compiler to make executable code for the target system?

Assume the embedded system did not have a hardware abstraction layer, so you would need to initialise and read/write to ports directly (somehow).

Cheers, Smudger

new topic     » topic index » view message » categorize

2. Re: Embedded systems - C translator.

smudger said...

Seeing as I don't write C programs and I can't be arsed to write in assembler...

Would it be possible - in principle - to write Euphoria code for an embedded system then use the C-translator with the -keep option to generate C source code then use a cross compiler to make executable code for the target system?

Assume the embedded system did not have a hardware abstraction layer, so you would need to initialise and read/write to ports directly (somehow).

Cheers, Smudger

Would it work out of the box? No, absolutely not - unless it was a system that ran Linux/GNU (glibc) on an x86 cpu or something.

The translated C code is pretty generic and ran on a variety of C compilers, without requiring tweaking for any of them. So the translated C code would work with a new C compiler for the embedded system - but you'd still need to port the C runtime library over.

If the embedded system supports gcc (this is getting more common) then it's probably easier. You'd still need to make changes to the runtime library to get it up and running in a usable state on the new system though.

The initialising of and doing the read/write to ports directly can be done as part of the porting to the runtime library - adding these codes to the init method.

However, you could also use embedded machine code to read/write these ports and do whatever other initialisation was needed, if you wanted to. Euphoria itself has no support for reading/writing hardware ports.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Embedded systems - C translator.

OK, so Atmel do a GCC compiler for their AVR range of microcontrollers.

http://www.atmel.com/dyn/resources/prod_documents/doc32074.pdf

Obviously, I can use Euphoria to develop algorithms for some embedded code if the desired functionality is suitable for abstraction and simulation.

Presumably then I could use the Euphoria translator to make C versions of function calls and procedures? Yes? No? Maybe?

Or do you think I would be better off leveraging the knowledge gained from doing the simulation in Euphoria and writing C code from scratch?

Either way I guess I would need to learn C...

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu