I'm using the F28377D. Can someone explain how I can get the expected value (anything non-zero) for shifted_value below when using the CLA?
read_adc.cla:
#include "F28x_Project.h"
#include <stdint.h>
extern uint32_t original_value;
extern uint32_t shifted_value;
uint32_t adc_value;
interrupt void Cla1Task7(void) {
adc_value = AdcaResultRegs.ADCRESULT0;
original_value = adc_value;
shifted_value = adc_value >> 1;
}
adc.c:
...
#pragma DATA_SECTION(original_value,"CLADataLS4")
uint32_t original_value;
#pragma DATA_SECTION(shifted_value,"CLADataLS4")
uint32_t shifted_value;
...
When I monitor both original_value and shifted_value in the CPU1 watch window, original_value is exactly as expected--a 12-bit value up to 4095 (so memory would seem to be being shared correctly). However, shifted_value is always zero. Of note, if shifted_value is computed by dividing by two instead of shifting right by one, the result is still zero.
Here's the relevant disassembly:
139 ;----------------------------------------------------------------------
140 ; 33 | adc_value = AdcaResultRegs.ADCRESULT0;
141 ;----------------------------------------------------------------------
142 00000000 0000! MMOVZ16 MR0,@_AdcaResultRegs ; [CPU_] |33|
00000001 7580
143 00000002 003C MLSL32 MR0,#16 ; [CPU_] |33|
00000003 7BC0
144 00000004 003C MLSR32 MR0,#16 ; [CPU_] |33|
00000005 7B80
145 00000006 0000- MMOV32 @_adc_value,MR0 ; [CPU_] |33|
00000007 74C0
146 .dwpsn file "../LLD/CLA/read_adc.cla",line 34,column 2,is_stmt,isa 0
147 ;----------------------------------------------------------------------
148 ; 34 | original_value = adc_value;
149 ;----------------------------------------------------------------------
150 00000008 0000! MMOV32 @_original_value,MR0 ; [CPU_] |34|
00000009 74C0
151 .dwpsn file "../LLD/CLA/read_adc.cla",line 35,column 2,is_stmt,isa 0
152 ;----------------------------------------------------------------------
153 ; 35 | shifted_value = adc_value >> 1;
154 ;----------------------------------------------------------------------
155 0000000a 0000 MMOVIZ MR0,#0 ; [CPU_] |35|
0000000b 7840
156 0000000c 0000! MMOV32 @_shifted_value,MR0 ; [CPU_] |35|
0000000d 74C0
On line 155, one would expect a shift instruction--not an instruction that zeroes all 32 bits of the target value. What am I missing? I'm using Code Composer 6.1.3.
Thanks in advance!