Skip to main content
Visitor II
December 8, 2008
Question

ISR Arm or Thumb

  • December 8, 2008
  • 3 replies
  • 1046 views
Posted on December 08, 2008 at 05:27

ISR Arm or Thumb

    This topic has been closed for replies.

    3 replies

    netzAuthor
    Visitor II
    December 5, 2008
    Posted on December 05, 2008 at 06:09

    Hello,

    just another question,

    in der IAR Docu is stated:

    Quote:

    All interrupt functions must be compiled in ARM mode; if you are using

    Thumb mode, use the __arm extended keyword or the #pragma

    type_attribute=__arm directive to alter the default behavior.

    In the ST-Firmware (71x_it.c) the IRS are without __arm.

    What is the difference, what exactly could go wrong without this?

    Thanks,

    Steffen

    Visitor II
    December 6, 2008
    Posted on December 06, 2008 at 07:09

    In short, nothing will go wrong if you compile interrupt functions in THUMB mode.

    The confusion comes from the use of the term 'interrupt function.' It could mean a number of things. Apparently, the IAR mannual implies that the 'interrupt function' is called directly by the CPU to process an exception. As we know, the ARM CPU starts to process an exception handler in ARM mode.

    In contrast, the support code from ST for STR71x MCUs uses wrappers in assembly language for each ISR. Among other things, those wrappers automatically switch to THUMB mode if required (using the BX instruction.) The wrappers are in the file 71x_vect.s. Hence, the 'interrupt functions' can be compiled either in ARM or in THUMB mode.

    To be honest, I never liked the way 71x_vect.s does this. The code is too long and complicated. The fundamental reason for this is the stupid design of the EIC - the 'enhanced interrupt controller' in STR7x. I use my own wrapper which is much shorter and most likely faster.

    Regards,

    - mike

    netzAuthor
    Visitor II
    December 8, 2008
    Posted on December 08, 2008 at 05:27

    Hello Mike,

    thanks for your reply, it's very helpful.

    Steffen