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/MSP432P401R: How can i move initialized variable to Flash?

Part Number: MSP432P401R


Tool/software: Code Composer Studio

How can i move initialized variable to Flash?

I want to move SRAM variable to Flash.

1. How can i  move variable which is in .data or in .bss (SRAM) to Flash?? Not const data which is already in Flash.

when i do this code,

#pragma DATA_SECTION(var1, ".mydata");

#pragma DATA_ALIGN(var1, 2);

int var1 = 5;

void main(void){

printf("var1 = %d\n", var1);

}

then, var1's address is in Flash but var1's value is not 5. it's value is just trash.(like -1)

How can i move variable to Flash perfectly?

2. Also, how can i move "local variable" to Flash?? If not, How can i copy it from SRAM to Flash?

void main(void){

int var2 = 10;

printf("var2 = %d\n", var2);

}

**Attention** This is a public forum