iOS assembly code

I would like to try some ARM assembly code with apple iOS just for educational purpose. I would like to start with some in line code within Xcode.
My understanding is that I need to compile for a iOS device, for example for my iPhone, which means that I need to pay $99/year for membership.
I don’t think I can use ASM assembly code with a iOS phone simulator.
I am having an hard time on finding examples, books or documentation on ARM assembly code in Xcode env with an iPhone.
Am I doing this wrong? Maybe iOS is not the most user friendly environment to learn ARM Assembly.

  • How does the Objective-C runtime retrieve the list of classes and methods?
  • How to instruct Xcode to use yasm to compile .asm files?
  • Wrong method implementation address from otool for armv7?
  • How to deal with compiler optimization problems
  • what is the fastest FFT library for iOS/Android ARM devices?
  • Can I create a breakpoint in code in iOS, like `__asm{int 3}` on VC++, and continue execution after it's been hit?
  • 4 Solutions Collect From Internet About “iOS assembly code”

    Back up…

    What are you trying to learn? Arm assembly or iOS programming? Pick one…

    Do you have any assembly experience?

    What is it you think you are wanting to learn in arm assembly? Jump in and write some full blown gui applications? You need to learn to put immediates in registers add and or and xor and save answers in registers. then read and write some memory locations. Learn to use the stack, make calls, etc. Then write your applications in C or whatever and use asm for hand tuning or use your asm skills to debug the compiler and or code. Writing applications or operating systems, etc in asm is for folks who want to make a statement, or have a specific reason, not for educational purposes.

    Give this a few minutes or maybe half an hour, it shouldnt take very long to get through, maybe an evening if you are serious about it.
    look at the learnasm.txt file.

    It is free, open source, should work most places (linux, unix, windows, etc with a C compiler), if you are not already a programmer and dont have basic compiler tools or programming skills, then go learn a few languages (check out python the hard way, C of course, and come back to work on assembler. The lsasim thing above is NOT AN ARM, but has a lot of familiar features. Let me know how good or bad of a job I did.

    Now this IS ARM but the thumb instruction set:

    Not a tutorial but a plain, simple, instruction set simulator. It should be obvious what is going on in the simulator you can add/modify/print whatever you want to see to help with debugging. You can get your feet wet with embedded, thumb, cortex-m like, ARM registers, using gcc, gnu assembler, and/or llvm clang as cross compilers. Take one of the examples as-is then start to modify it.

    There is some leaning toward a unified ARM assembly language that works both on the ARM based cores and the thumb2 based cores. Not for all of the assembly language needed but for places where you might want to write a module of code and not have to have a lot of if thumb elses littering the code. You can certainly get your feet wet with that here and take some of that code straight to full 32 bit ARM instructions on some other platform. thumbulator is thumb only, the common instruction set between the ARM based cores and the thumb2 based cores, basically it is the portable ARM instruction set, write the code once, it works on almost all of their cores.

    You will see at github I have a number of other projects with samples that start with assembler then get into asm boot code leading into C. Many but not all ARM based. The hardware costs from $10 to $50 or so. You can for example look at the yagbat thing and get the free visual boy advance simulator and simulate 32 bit arm instructions or 16 bit thumb or whatever, and have a simulated display, etc. Or if you have the gameboy hardware or an nds or nds lite and the right cartridges you can run programs on the real hardware.

    All of the stuff I put out there is there for folks to learn from. Overcoming fears of trying something embedded for the first time, not knowing how to cross compile, etc. I learned from many other similar examples and am just returning the favor.

    If your goal is to learn iOS programming, get the kit or whatever and learn using whatever language they want you to learn, get proficient at that, learn the apis, etc. Then if you do some of the assembler stuff above then you can start to think about making calls to asm functions or inline assembler, etc, from your iOS programs. How much assembler, your choice. I wouldnt expect to see applications written in assembler for that platform I would instead search for how do I call this assembly code from my ios application or how do I do inline assembly. (dont learn inline assembly until you are good at real assembly).

    There is no reason at all to pay for access to a simulator, there are many many arm simulators out there, one in mame, arms armulator in gdb and other places, a number of gameboy advance and nintendo ds simultators, etc, etc, etc. Of course there is qemu-arm. there are more simulators than you probably are willing to take the time to try, i am about 10 years or so into it myself and not tried them all.

    learning assembly is not like C or python or java, I will write a minesweeper game to learn this language. You are learning the mechanics of moving the bits around, small steps, not writing usable applications. For example adding two 128 bit numbers using a 16 bit processor is a worthy assembly language project. Multiplying two numbers, any size, with a processor without a multiply instruction, that is another assembler type learning project. yes, I agree you CAN learn those things by calling asm from an iOS application, but if you dont already have the iOS developers kit and know how to write iOS applications, you have a lot of learning to do before you start thinking about assembler.

    If I am way off the mark with what you were asking, no problem I will gladly remove this answer…

    Even without a code signing cert, I think you should be able to go to the scheme pop-up menu (the right side of it) and choose “iOS Device”

    Once you do that, then you can choose any .c or .m (or .cpp or .mm) file in your project, open the assistant editor, and choose “Assembly” from the assistant editor jumpbar. Then you can see your source code and assembly code side by side.

    Or you can just go to Product menu and Generate Output -> assembly

    You may find it easier to start with C code, where the function calls will be much easier to follow initially than Objective-C method calls.

    What you need is an ARM development kit with a Linux-based programming toolkit. You can then install VirtualBox on your Mac, create a Linux virtual machine and install the ARM development tools on the virtual Linux machine. Make sure that when you buy an ARM dev kit, it comes with the ARM cpu, complete dev/test board, USB cables for software transfer/debugging and the complete Linux toolchain. You can find such kits for less than $99.

    Another quick introduction to ARM assembly and reverse engineering: