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.
cla mix asm code has error E0009
i plan use sam code save dsp loading
Link file start
PAGE 1 :
ADCARESULT : origin = 0x00000B00, length = 0x00000018
SECTIONS
....
AdcaResultRegsFile : > ADCARESULT, type=NOINIT
Link file end
cla start
struct ADCARESULT_REGS {
uint16_t soca0;
};
#pragma DATA_SECTION(ADCAa0,"AdcaResultRegsFile");
volatile struct ADCARESULT_REGS ADCAa0;
void Cla1Task1 ( void )
{
.....
BBU_FB.DspBMS_VS_AIP = ADCAa0.soca0; //it passed compiler
asm(" MMOV16 MAR0, @0x0b00");//it passed compiler
asm(" MMOV16 MAR0, @_ADCAa0.soca0"); //compiler fail
asm(" MMOV16 MAR0, @ADCAa0.soca0"); //compiler fail
}
why compiler fail
show :[E0009] Missing struct/union member or tag
please help me ,i want to cla loading use asm code ,but that can't import c code struct to online asm?
asm statements cannot interact with the C environment like that. The string in the asm statement is passed directly to the assembler, with no further processing. The assembler does not know how to process the operand ADCAa0.soca0. Thus, an error diagnostic is issued.
I'm not sure of the overall problem you want to solve, so I am unable to make any alternative suggestions.
Thanks and regards,
-George
i wish can use struct for asm ,
structure definition using c code can avoid human error.
please help me how to define structure for asm use
how to define structure for asm use
There is no way to do it in a single source file that combines C and assembly.
Here are two suggestions to consider.
First, try to avoid asm statements. Instead, use intrinsics. They look and act like C function calls. The code generated for an intrinsic is not a call to a function, but a few instructions, often just one instruction, that implement the operation. For details, please search the C28x compiler manual for the sub-chapter titled Using Intrinsics to Access Assembly Language Statements. There is a good chance that whatever you want to do can be written in terms of intrinsics.
Second, write complete functions in assembly, and call them from C. Those functions can use C struct definitions supplied in C header files. For details, please search the C28x assembly tools manual for the chapter titled Sharing C/C++ Header Files With Assembly Source.
Thanks and regards,
-George
i use C28x assembly tools manual for the chapter titled Sharing C/C++ Header Files With Assembly Source.
and at dcdc.cla add line
.cdecls C, LIST, "volatile ADCA_t DspBMS_IDATA_AIP_ADC_SOC1_address"
or at dcdc.h add line
.cdecls C, LIST, "volatile ADCA_t DspBMS_IDATA_AIP_ADC_SOC1_address"
compiler error
how to declare .cdecls at .cla code or at header file .h
key point ,i use inline asm
how to declare .cdecls at .cla code or at header file .h
That is not supported. You can use the .cdecls directive only in hand-coded assembly files. That is why I said ...
write complete functions in assembly, and call them from C
Thanks and regards,
-George