locked
Windows RT? How can I compile in 32-bit ARM

    Question

  • I'm porting some of my code to Windows RT (the ARM one). I have a lot of codecs that suddenly don't work anymore or don't work well. Some parts are written in ARM-asm, some parts are written in C but with clear consideration about number of available registers etc. Now... I see that I cannot even link 32-bit ARM code. what is that crazy insanity, that linker treats 32-bit arm as invalid???

    how can I compile c-code to 32-bit arm? How can I link 32-bit ARM into my app?


    Monday, October 28, 2013 1:53 AM

All replies

  • Hi ppsmtl,

    ARM assembly is not supported. The Visual Studio 2012 and 2013 C/C++ compilers can target ARM.

    See Supporting Windows RT and ARM processors and the Windows Store app development for Windows RT PCs white paper.

    --Rob


    Monday, October 28, 2013 6:30 PM
    Moderator
  • I'm sorry, but this answer doesn't make any sense at all. Maybe C-code isn't supported as well? (I'm not referring to longstanding ignorance of c99).

    I'm am running my asm code on Windows RT tablet at the moment of writing this post. Why else does the VS/SDK ship with armasm?

    I cannot figure out how to run ARM code in 32-bit mode and not in Thumb2. When I try to use 32-bit arm asm debugger doesn't work properly: it shows/decodes op-codes as if they were Thumb2 (I see 16 address offsets instead of 32 bit and instructions that don't make sense). I don't actually understand why, since debugger from Windows CE worked pretty well with arm, why it became so broken suddenly when ARM became almost as important as x86?! I understand that I can be pretty buggy and might show wrong assembly, but it actually executes that wrong asm if I step over the code. If don't step into the functions with debugger then they produce correct result, e.g. they work as proper ARM machine code, but if I step into with the debugger I get different result completely.


    Tuesday, October 29, 2013 4:37 AM
  • oook... I hope somebody from MS will take a look and give some qualified answer without random guesses.

    I wasted 24 hours non-stop trying to chase ghosts and get 32-bit ARM asm running on Surface RT. I wasn't able to do it, and we had to take down Surfaces from our demo in Berlin show (this week).

    I came to clear conclusion: either I need to change profession, or the Windows RT and/or the tools that microsoft provides are BROKEN. In endless research and testing I came to this conclusion. I fond only one place where such problem mentioned: Getting GCC to target Windows RT:

    Can use ARM code, but interrupt handlers will (incorrectly) throw the CPU back into THUMB mode upon return, therefore ARM code is highly unstable Because of this, THUMB2 is the preferred code format

    It's quite surprising nobody had similar issue, perhaps nobody even tries to develop some serious stuff on Windows RT?

    Even simplest stuff is broken. Assemble file as 32-bit and then dumpbin /disasm it. It will show gibberish. if you try to step through that code with debugger, it shows incorrect disassembly, and suprisingly, executes it (even though I'm 100% sure that I blx-jumped to that code in ARM state).

    Here's the same asm to show this problem: crap.asm



    Tuesday, October 29, 2013 9:29 PM
  • Hi Ppsmtl,

    Please try to keep a civil tone and clean language. Next time we'll remove the entire post rather than point-editing out profanity.

    The armasm assembler is provided for Windows CE. Arm assembly tools are not provided or supported for Windows RT. You may be able to use 3rd party tools (like GCC) to write thumb2 code and using the WinRT ABI, but this is not something Microsoft provides or supports.

    Microsoft does support writing C & C++ code and compiling to ARM for Windows RT.

    --Rob

    Tuesday, October 29, 2013 11:13 PM
    Moderator
  • armasm is part of windows rt sdk. armasm from Windows CE won't generate obj files that can be linked for Windows RT (even though, they should be acceptable IMO).

    armasm for windows rt generates object files with IMAGE_FILE_MACHINE_ARMNT header.

    armasm for wince doesn't even have that option.


    Please, ignore my questions if you don't know answers. I don't want to argue if there is armasm for windows RT, just like I don't want to argue that the sun will rise tomorrow morning.



    • Edited by ppsmtl Wednesday, October 30, 2013 8:51 PM
    Wednesday, October 30, 2013 8:50 PM
  • Sorry. You're right that we do have the armasm compiler. I was thinking about inline arm assembly.

    That said, Thumb2 and the Windows Runtime ABI are required. Windows RT always sets the CPU into Thumb2 mode and into low-endian mode. You cannot write just a code stub without providing a function interface matching the calling convention the compiler expects.

    I've taken a note that we need clearer documentation on this.

    --Rob

    Wednesday, October 30, 2013 10:10 PM
    Moderator
  • Rob, sorry if I sounded rude, was working 24hrs non stop on that surface rt thing. Not the most pleasant experience. I asked important question about inability to run 32-bit arm asm and mentioned that quote about why it's highly unstable in 32-bit arm. Just to make it clear: I use my own asm for leaf-only functions, e.g. I don't care about abi or platform calling convention since they are irrelevant in my case.

    Thursday, October 31, 2013 2:32 AM