Tool/software: Code Composer Studio
Hello all,
I have just created the default example project at the Code Composer Studio (Version: 9.3.0.00012), and added a array Variable like this:
#include <msp430.h>
const unsigned long array[5000]; /* why is this in RAM ??? */
/**
* main.c
*/
int main(void)
{
int var=0;
static unsigned long a;
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
for (; var < 500; ++var) {
a = a + array[var];
}
return (int)a;
}
Now I am kind of wondering why the variable is put to the RAM, because it is actually a constant. The error message is clear:
"../lnk_msp430f5438a.cmd", line 139: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".bss" size 0x4e24 . Available memory ranges:
RAM size: 0x4000 unused: 0x3f60 max hole: 0x3f60
My compiler flags are this:
-vmspx --code_model=large --data_model=large -Ooff --opt_for_speed=1 --use_hw_mpy=F5 --include_path="C:/tools/ti/ccs/ccs_base/msp430/include" --include_path="C:/projects/workspace_v9/MSP430F5_Test" --include_path="C:/tools/ti/ccs/tools/compiler/ti-cgt-msp430_18.12.4.LTS/include" --advice:power="all" --define=__MSP430F5438A__ -g --c99 --printf_support=minimal --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --asm_listing --verbose
And of course the Linker flags:
-vmspx --code_model=large --data_model=large -Ooff --opt_for_speed=1 --use_hw_mpy=F5 --advice:power="all" --define=__MSP430F5438A__ -g --c99 --printf_support=minimal --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --asm_listing -z -m"MSP430F5_Test.map" --heap_size=160 --stack_size=160 --cinit_hold_wdt=on -i"C:/tools/ti/ccs/ccs_base/msp430/include" -i"C:/tools/ti/ccs/ccs_base/msp430/lib/5xx_6xx_FRxx" -i"C:/tools/ti/ccs/tools/compiler/ti-cgt-msp430_18.12.4.LTS/lib" -i"C:/tools/ti/ccs/tools/compiler/ti-cgt-msp430_18.12.4.LTS/include" --reread_libs --diag_wrap=off --display_error_number --verbose_diagnostics --warn_sections --xml_link_info="MSP430F5_Test_linkInfo.xml" --use_hw_mpy=F5 --rom_model
What is the reason to put constants to RAM? I haven't seen that before, and don't want to create ROM sections to put my variables in all the time. Is there a generic linker switch/flag to put const variables automatically into ROM?
Thanks for your help!
Marco