This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MCB2100 and assembly program

Anyone can let me know where I can find assembly program for all the basic interface on MCB 2100 evaluation board.

Parents Reply Children
  • Shivaram,
    The best thing for you to do is:
    * Read and understand the processor specifications and the usage of its registers.
    * Compile a C program that you understand without any optimizations.
    * Look at the assembly using your debugger or observe the listing files.
    * You need to understand the processor architecture in order to understand the "internal concepts".

  • That's an excellent aim!

    Try the books listed here: http://www.keil.com/books/armbooks.asp

    For details about the ARM architecture, go to http://www.arm.com

    For details about a specific ARM-based processor, go to the manufacturer's website; eg, http://www.standardics.nxp.com

  • No, assembly is not required to understand the "internal concepts" of a processor.

    Assembly language may be required to write the glue logic before you enter a C function, since the C compiler may not have special keywords to generate the correct prologue/epilogue for the exception handlers.

    You could even write most of the initialization code directly in C, if you could live with the incompatibilities that such a init function would enter without zero-initialized and initialized variables and with large parts of the RTL forbidden to call. However, such a concept would kill the compiler vendor with support calls - people who would assume that anything was allowed before the initialization was done and the environment fully C-compliant...

  • I have done programming in C for all the interface, but not at all satisfied even though i got output. I just want to know if ARM is user friendly like our 8051, which has its own instruction set, Would like to write program using those instruction set and want to combine C and assembly to see what happens during compilation and generation of OPCODE.
    I am using keil. But can u tell me how to generate thumb opcodes instead of 32bit opcodes

  • Shivaram,
    be careful: there are very serious limitations on what inline assembly can do with the RealView compiler. refer to your assembler documentation for further information. what you can and should do is use the __asm declaration before a function itself. this makes the function an embedded assembly function, that is 100% assembly without any limitation almost and still called like a normal C function.
    you can also experiment with pure assembly modules.
    but why are you so obsessed with assembly rather than writing in C? you can force thumb opcodes using the right pragma:

    #pragma thumb
    

    (I think).
    if I were you - I'd write it all in C. if you need something "exotic" - like saving the context of the processor - assembly is indeed what you'd want. keep it simple, efficient and functional.

  • A friend of mine works in NXP. During a conversation I asked him "in user mode the default is thumb mode and in exception mode it converts itself ARM mode". then how is the opcode fetching done. He told me that there is 2 different opcodes generated for ARM and thumb when we compile 1 single program and are stored in different location. Processor takes the respective opcodes depending on the mode of working. So that means it generates thumb opcodes also. I want to see where they are stored because i have seen thumb opcode and ARM opcode are different in the dis-assambly window. both are entirely different. that is the reason i want to write program in assembly using the instruction set which uses branch and link instructions.

  • Shivaram,
    What is the functional advantage of doing that? Why do you even care? writing in assembly means your code is unlikely to be portable - did you think of this?

  • "I just want to know if ARM is user friendly like our 8051"

    You only think the 8051 is "user friendly" because you are used to it!

    The ARM just seems "less friendly" because you are not used to it.

    Take a look at this thread, where someone new to the 8051 is complaining how unfriendly he finds it: http://www.keil.com/forum/docs/thread12364.asp

    Having said that, the ARM is a more complex beast than an 8051 - so it's bound to take longer to really get to grips with it!

    Trying to treat it as just a bigger 8051 is probably not helpful, though...!

  • No, your functions do not get compiled into both Arm and Thumb mode.

    The compiler can generate stub functions for making a Thumb function call an ARM function and reverse, but that is just adjustments to make the call work.

    If your flash is big enough, and you want the extra performance, you can compile all of your own code in ARM mode. The code will still need trunking to access Thumb-mode library functions.

  • Ok I agree to certain extent. but if i use __ARM the opcodes generated are different than generated without it. I saw the opcode difference. But I just want to write asm program for simple peripherals. Any suggestion on where I can get the instruction set of ARM or any program that i can analyse written for ARM7.

    Thanks everyone for their input and special thanks to Andy for bringing the 8051 concept.

  • Yes - I've already given them!

    In addition, of course, you will also need to study the ARM Assembler Manual:

    http://www.keil.com/support/man/docs/armasm/

  • Maybe this series of articles might help you:

    Building Bare-Metal ARM Systems with GNU: Part 1 - 8
    By Miro Samek, Quantum Leaps Embedded.com "

    There are also links to other resources...