hi i start a new try. i am looking for a solution that uVision4 accept to put Variables(Parameters) of c-Code in to Asssembler Registers.
A reference to the "C166 User's Guide - Reference ASM" helped my not because this(my) problem isnot treated!
------------------------------------------------------------------------------------
_inline int vf_control( int offset, int slew, int anglespeed) { int retvalue; #pragma asm ( @w1=offset, @w2=slew, @w3=anglespeed, @4,@5 ) mov MCW,#0600H mov @5,ZEROS CoMUL @w2,@w3 CoSHL #8 CoADD @5, @w1 CoSTORE @4,MAS #pragma endasm (retvalue = @4 ) return retvalue; }
At first thanks a lot! :-)
#pragma MODV2 #include <reg167.h>
The second row is a header file -ok. But the first row?
Why are this two rows are needed?
I use XE164f Microchip do i need maybe an other header file?
In the program there are more Assembler/C functions do i have to add more #pragma lines or an other header file?
For exampel?
_inline int pt1_controller32( PT1_array *pt1_parameter, int X) { int retvalue; #pragma asm (@w1 = pt1_parameter,@w2 = X ,@3, @4, @5, @6, @7)
_inline int clarke_trans(int Phase_s, int Phase_t, int *ia) { int retvalue; #pragma asm(@w1 = Phase_s,@w2 = Phase_t,@w3 = ia, @4,@7,@8)
#pragma MODV2 - I just used this for the example code outside of any uVision project. For files of a uVision project, MODV2 will be supplied automatically via the compiler command line - it enables the MAC unit of the XExxx type of controllers.
In your case, the include file is 'XE164F.h', no other headers are required.
Your functions containing '#pragma asm (@w1...)' need to be ported to use the C166 syntax - __asm { } etc. The modified code of the mac function 'vf_control()' provided earlier should serve as a template on how this is basically done.
Ok i get it Thank you!
But i have still some more problems white a whole assembler file "start.asm". I would like to use uVision because of the great diagnostic tools in the debug mode, but it will not like i like to.
start.asm(12): error: identifier "$EXTEND2" is undefined $EXTEND2
start.asm(13): error: expected a ";" $GENONLY . . . .
$EXTEND2 $CASE $GENONLY $NOLOCALS $CHECKCPU16 $CHECKBUS18 $NOMOD166 //; disable the internal set of SFRs $STDNAMES(regxe164f.def) //; define SFRs
In the Tasking help is the following explanation.
EXTEND2
Enables support for the CX16x / SUPER-10 architecture,including support for the MAC co-processor.
i don't no why uVision donot like it.
you need to understand that the Tasking and Keil implementation of the 166-tools is completely different: Tasking - EXTEND2 --> Keil - MODV2; uVision will never accept EXTEND2.
The next problem will be with all those @SET(...), @_CALL(...) etc. macros used in the assembly language file. This needs to be converted to use the Keil macro format. Also 'LDAT' needs to be converted.
I would suggest to use c:\keil\c166\lib\Start_v3.a66 as a reference for porting, this is the standard startup file used by uVision when creating a XExxx application.
A small problem ;-) i hope so...
CoSTORE [@w4],MAS
transform to
CoSTORE [rw4],MAS
don't work, Keil uVision4 don't know this syntax "rw4" for a word regiester.
_inline int inv_park_trans(int i_d,int i_q,int phi,int *o_b) { int retvalue; # pragma asm(@w1 = i_d,@w2 = i_q,@w3 = phi, @w4 = o_b , @5, @7, @9, @8) mov @7,MCW mov MCW,#0600h shr @w3,#6 shl @w3,#1 EXTS #SEG (_sincostab),#2 mov @9,[@w3 + #SOF(_sincostab+512)] mov @8,[@w3 + #SOF(_sincostab)] CoMUL @w1,@9 CoMAC- @w2,@8 CoASHR #2 CoSTORE @5,MAS CoMUL @w1,@8 CoMAC @w2,@9 CoASHR #2 CoSTORE [@w4],MAS mov MCW,@7 #pragma endasm(retvalue = @5 ) return retvalue; }
I found the solution, its ok. @w4 = o_b
What is the problem now? Its typical c-code. The same in other files.
#ifndef _SUBROUTINES_FOC_H_ #define _SUBROUTINES_FOC_H_
Subroutines_FOC.H(646): warning: last line of file ends without a newline #endif // #endif _SUBROUTINES_FOC_H_
Controls_FOC.H(170): warning: last line of file ends without a newline Scheduler.H(489): warning: last line of file ends without a newline t end of source: internal error: assertion failed: copy_from_source_to_asm_func_buffer: bad lexical escape (D:\edg\src\lexical.c, line 6205)
What is the problem now?
It's exactly what it says:
warning: last line of file ends without a newline
How hard can that be to understand?
just an enter in all last lines of the c-code it did it!