Could compilation on the device be possible?

Discussion in 'Questions (Windows Mobile)' started by Mark Stonton, May 18, 2009.

  1. Mark Stonton

    Mark Stonton New Member Licensed User

    I have always like the idea of being able to do full development on the device, even partial (as Basic4PPC offers) is a great benefit but to complete the process would be even better. It’s not that the device is necessarily the best platform for development (it isn’t) but using just the device allows things to be tried any time, as you always carry your phone, don’t you?

    I have been puzzling over this for ages and have seen questions posted before asking whether it is possible to do the full compile on the device and the response I always remember is "the compilation process includes methods which are not supported on the device". I assume this means there is x86 code which Basic4PPC uses but has no control over.

    I did wonder whether something like DOSBox could be used to run the x86 code but knowing that one Windows component which is called is 1.5MB in size suspect this wouldn’t work as is. In the past before using Windows Mobile I used a DOS emulator on Psions (5, 7, Netbook) to develop PIC microcontroller code …. I’d write the code using a text editor running natively on the ARM based machine and then run the assembler under the DOS emulator.

    I was about to give up on the idea but after some further web searching I finally believe there MIGHT be potential for FULL development on the device which means the possibility to develop, compile and test code without having to transfer between machines.

    I’ll apologise here in case I use the wrong terminology, etc. I am an electronics design engineer with fairly limited software experience, command line type stuff rather than OS or GUI. I originally wanted something simple to allow me to write code for the PPC devices but expected it to be console type software. I ended up with Basic4PPC which does so much more (fairly easily) but am probably still getting my head around what I might describe as event driven software.

    See what you think to my thoughts below and whether it could be a possibility:

    I know csc.exe is run when compiling Basic4PPC because of the command prompt box which appears and that csc (by it's own admission ..... what it tells you if you run it ..... is Microsoft's Visual C# compiler for .NET framework). I also remember that ilasm.exe has been referred to which I have seen described as a compiler to common intermediate language (is this non-optimised compilation?). I’m assuming these executables are part (or hopefully all) of what Erel refers to as the “methods” not available on the device.

    I've come across the "Mono" project before, but it appeared again when I googled something along the lines of ' +csc.exe +"Windows Mobile" '. But interestingly this time I found a reference to msc.exe, what appears to be an open source version of csc.exe

    I understood the idea of Mono was to rewrite the .NET code as open source to allow Microsoft .NET programs to run on Linux for example. This in itself wouldn't help us compile Basic4PPC but could perhaps, if my understanding is correct, one day let us run compiled Basic4PPC code under Linux or maybe other operating systems.

    It seems, having discovered msc.exe that you could now compile code under Linux to use (mono).NET, and reading a little further, msc is tested by using it to compile 'standard' C# code and testing it both with .NET and (mono).NET. i.e. This says that if you created msc for Windows you could use it in place of csc.exe. This brings us to my theory, expanding on this idea, maybe if you created (compiled) msc for Windows Mobile then the device IDE could call this (msc.exe".ARM") where the desktop IDE calls the standard csc.exe".x86".

    Could this be enough to make full compilation on the device a possibility?

    I guess if this were possible it would be the biggest step to on-device compilation and would be fairly easy to implement (in effect very similar to the desktop). Along with this I guess there might be a few further “wants” for the device IDE, the first of which, in my mind at least, would be to support different screen/form sizes like on the desktop and along with this the need to support dimensions potentially larger than the screen the form is being designed on. (it might even give some hope to the idea that one day the IDE could run under Linux, or Windows CE or something else!)

    I shall be very interested to read any feedback on the idea!

    p.s. I like the idea of the device IDE being provided as a CAB so that a PC isn’t needed to get the code onto the device and also, as mentioned in the current beta testing, the desktop IDE to be provided in a form that can be copied to the machine rather than installed. I use the installed desktop IDE then copied to a memory stick (along with PortableApps) and used on various machines ….. if the need to install in the first place (or option to install or not) could be provided it would be a great benefit.

    Regards,

    Mark
    (XDA Zest, Touch HD, ipaq 214)
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The optimized compiler works by first converting the Basic4ppc source code into C# code and then running csc.exe which compiles the C# code into a device or a desktop executable.
    csc.exe is a windows program and it cannot run on a Windows Mobile device.
    I'm not familiar with msc.exe however Windows Mobile doesn't appear in its supported platforms list.

    As I currently see it the legacy compiler will be removed in the future from Basic4ppc and only the optimized compiler will be available. So I don't think that compiling on the device will be possible in the near future.
     
  3. Mark Stonton

    Mark Stonton New Member Licensed User

    More thoughts!

    I referred to msc.exe as a mono equivalent of csc.exe

    I've also found references to

    mcs and gcs which are compilers for 1.0 and 2.0 runtimes.

    There's a good description here and a link to sources but I'm afraid beyond me.
    http://www.mono-project.com/CSharp_Compiler#Obtaining_MCS

    The line

    "MCS is written in C# and uses heavily the .NET APIs (in particular it uses Reflection and Reflection.Emit). MCS runs on Linux with the Mono runtime and on Windows with both the .NET runtime and the Mono runtime."

    is perhaps encouraging but I probably don't fully understand what it is saying .... still wonder if this could be built/compiled for Windows Mobile.

    Regards,

    Mark
     
  4. agraham

    agraham Expert Licensed User

    Nope! The Compact Framework, even the latest version 3.5, lacks Reflection.Emit and some of the other Reflection stuff necessary to support a managed compiler.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice