What Cortex-M4 register holds function return values under GCC?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • What Cortex-M4 register holds function return values under GCC?

    By default SES uses the GCC for compilation. In all of the Segger documentation and the GCC website, I can't find any discussion of what processor registers are used to store function parameters and return values when compiling for the Cortex-M4. I had thought I had seen in print that R3 was used for the return value, but I can't find what resource I had seen that in. Looking at compiled code, return values get copied between R0 and R3, so it is not clear which register is supposed to be the official location of the return value. Does anyone know where this information is officially stated?
  • Hi Eggman,

    Please have a look at the ARM ABI (Application Binary Interface) and ARM PCS (Procedure Call Standard)
    Any standard ARM compiler is using the above mentioned standard.

    Regards,

    Souhail
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.