This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430FR5994: Using GNU C calling assembler blowing stack

Part Number: MSP430FR5994

Tool/software: Code Composer Studio

I am using the GNU v7.3.2.154 Compiler.

Using the code below, and watching the stack pointer: Every loop iteration the stack grows by 2 bytes.

What am I missing here?

Main.c

#include <msp430.h>

#include "stacktest.h"


/**
 * main.c
 */
int main(void)
{
    int i= 0;
    ar j;

    WDTCTL = WDTPW | WDTHOLD;    // stop watchdog timer
    
    for (i=16;i>0;--i){
        test_sub(j);
    }


    return 0;
}

stacktest.h

#include "msp430fr5994.h"

typedef unsigned int ar[16];


extern void test_sub(ar);


stacktest.S

#include "msp430fr5994.h"

.global test_sub


test_sub:
    pushm.w     #8,R11
    popm.w      #8,R11
    ret

**Attention** This is a public forum