Tool/software: Code Composer Studio
I receive the next advice:
#1530-D (ULP 5.1) Detected divide operation(s). Recommend moving them to RAM during run time or not using as these are processing/power intensive
Then I follow the instructions of the next link:
https://processors.wiki.ti.com/index.php/Compiler/diagnostic_messages/MSP430/1530
But the advice still appears and I don't why. I do the next:
in rtc.h:
#pragma CODE_SECTION(ADC_getVcc,".run_from_ram") uint16_t ADC_getVcc(void);
in rtc.c:
uint16_t ADC_getVcc(void) { return (((unsigned long)1023 * (unsigned long)150) / (unsigned long) (ADC_getVref())); }
in main.c:
void main(void) { // copy processing intensive routines into RAM memcpy((void*)0x2000,(const void*)0xC400,0x0050); while() { adcresult = ADC_getVref(); } }
and in the linker command lnk_msp430fr4133:
SFR : origin = 0x0000, length = 0x0010 PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 RAM_EXECUTE : origin = 0x2000, length = 0x0050 RAM : origin = 0x2050, length = 0x0750 INFOA : origin = 0x1800, length = 0x0200 FRAM_EXECUTE : origin = 0xC400, length = 0x0050 FRAM : origin = 0xC450, length = 0x3A30 .......... .bss : {} > RAM /* Global & static vars */ .data : {} > RAM /* Global & static vars */ .TI.noinit : {} > RAM /* For #pragma noinit */ .cio : {} > RAM /* C I/O buffer */ .sysmem : {} > RAM /* Dynamic memory allocation area */ .stack : {} > RAM (HIGH) /* Software system stack */ .run_from_ram: load = FRAM_EXECUTE, run = RAM_EXECUTE .infoA (NOLOAD) : {} > INFOA /* MSP430 INFO FRAM Memory segments */
I don't put all code, however, I think that these modifications are needed to the optimization let appear.