Tool/software: Code Composer Studio
Hi,
I ran out of RAM (had to change the linker file to assign more) so I checked the memory usage an found that the eCAP initialization took up 648 words...that's a lot for a couple lines of code. I started to wonder if this might be caused by the use of driver lib and replaced a driverlib command with a bitfield command:
ECAP_disableInterrupt(ECAP1_BASE,
(ECAP_ISR_SOURCE_CAPTURE_EVENT_1 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_2 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_3 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_4 |
ECAP_ISR_SOURCE_COUNTER_OVERFLOW |
ECAP_ISR_SOURCE_COUNTER_PERIOD |
ECAP_ISR_SOURCE_COUNTER_COMPARE));
ECAP_clearInterrupt(ECAP1_BASE,
(ECAP_ISR_SOURCE_CAPTURE_EVENT_1 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_2 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_3 |
ECAP_ISR_SOURCE_CAPTURE_EVENT_4 |
ECAP_ISR_SOURCE_COUNTER_OVERFLOW |
ECAP_ISR_SOURCE_COUNTER_PERIOD |
ECAP_ISR_SOURCE_COUNTER_COMPARE));
became:
EALLOW;
ECap1Regs.ECEINT.all = 0;
ECap1Regs.ECCLR.all = 1;
EDIS;
And the memory usage went from 648 words to 645 words. The EALLOW and EDIS instructions take up 2 words but I could bundle them together with all EALLOW protected instructions to trim that down and not repeat them for every instruction set. If this holds true for the rest of the instructions I could reduce codesize by 30-40% just by replacing instructions.
Is this an issue of my compiler settings or are the driverlib instructions just that inefficient with memory? Because at the rate I am going, I am going to run out of RAM at 25% of the planned program and will have to move this thing to flash and I really do not want to keep writing into flash every time I want to check the effects of an instruction change.
Thanks in advance
Peter