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.

MSP430FR5739: MSP430 compiler error declaring const array of const pointers

Part Number: MSP430FR5739

I am getting a compiler error using the MSP430 compiler (TI v21.6.1.LTS), but when I test the code using an online GDB compiler here (link), it doesn't seem to have a problem.

I am trying to declare a const array of const pointers to volatile uint16_t. Here's a paired-down version of the code I'm trying to build in CCS:

#define BUFF_SIZE 8
volatile int BufferA[BUFF_SIZE] = {0};
volatile int BufferB[BUFF_SIZE] = {0};

volatile int * const BUFFER_A_START = BufferA;
volatile int * const BUFFER_B_START = BufferB;

const volatile int * const arrayOfConstPointers[2] = {BUFFER_A_START, BUFFER_B_START};

int main(void)
{
    // I'm okay the #145-D warning since it's not the problem I'm trying to solve:
	int * ptr = arrayOfConstPointers[0];
	*ptr = 4;

	return 0;
}

... but the compiler gives me an error for the declaration of arrayOfConstPointers on line 8: "expression must have a constant value".

Is there some special rule regarding consts for the TI compiler?

Also I'm aware you can use RUN_START in the linker command file to do something like this, but that was giving me other problems which I'll save for another post if there's no way to do what I'm trying here.

Thanks!

**Attention** This is a public forum