How Pigmeo works

From Pigmeo Development Wiki

Jump to: navigation, search

To understand how pigmeo works we need to understand how .NET works

How .NET works

When you want to write an application in C#, Visual Basic .NET, C++/CLI or any other .NET language, first of all you write the source code. Then it is compiled to CIL/IL/MSIL, the .NET intermediate language (similar to some kind of assembly language), and it is stored as a .exe file containing CIL bytecodes (as in java). Those bytecodes are binary representations of the instruction set defined by CIL. Note that these .exe files are not Windows executables, they just have the same extension.

The CIL bytecodes contained within the .NET executable (the .exe file) are then compiled to machine code by the CLR (when the user runs it), the .NET virtual machine, and then executed by the processor. Note that CIL doesn't target a defined hardware architecture, so any virtual machine (CLR) on any architecture and any operating system can compile and run .NET executables.

Common .NET implementations are Mono, Microsoft .NET implementation, DotGNU, Rotor...

So it works like this:

[C# / VB.NET / C++/CLI / Boo / Chrome / J# / Nemerle / Ruby.NET / IronScheme / IronPython / IKVM.NET / any other language that is compiled to CIL] => compiler => .exe + libraries in the GAC => Virtual Machine (CLR) => machine code => processor


How Pigmeo works

If we want to run our application on a microcontroller or any kind of embedded system, we can run a CLR on it and let the CLR compile and run the CIL bytecodes, as .NET Micro Framework does. But it requires lots of resources, so Pigmeo generates the machine code on a common computer.

When developing .NET applications for microcontrollers using Pigmeo you write the source code and compile it to CIL bytecodes as usually. Then Pigmeo Compiler takes your .exe file, mixes it with the required libraries and coverts only the useful parts from those files to the assembly language for the target architecture.

Once you've got your application in assembly language you can assemble it using any of the available assemblers and get your application compiled to machine code ready for being sent to a microcontroller using a programmer (like PIC³PROG or PICkit).

When your application has been sent to your microcontroller you can run it as usually.

As a summary:

[C# / VB.NET / C++/CLI / Boo / Chrome / J# / Nemerle / Ruby.NET / IronScheme / IronPython / IKVM.NET / any other language that is compiled to CIL] => compiler => .exe + libraries in the GAC => Pigmeo Compiler => assembly language for the target architecture => Assembler => machine code => any microcontroller programmer => the microcontroller's processor

Personal tools