2007-07-31 10:41 AM
2007-07-28 01:17 AM
Hi, I have old project compiled with Hiware. This old project is maked with editor Softec. I want translate my source in Visual Develop of ST.
Problem! My funcs RAMPA use *int in this mode: void Rampa (volatile unsigned int *PWM, unsigned int val, unsigned char flag, unsigned char anta) { static unsigned int TempPWM; TempPWM = *PWM; ..... In old project this function is compiled fine and the code ASM is: TempPWM = *PWM; LD X,_Rampap3 LD A,(1,X) <--look this LD X,[_Rampap3] <--and this LD TempPWM:1,A LD TempPWM,X In new project, with Visual Develop, with same option for compiler ( FLAGS = -Ms -Cc -Cq -Lasm=%n.lst ) the function is compiled in this mode: TempPWM = *PWM; LD X,#1 CALL Rampa:265 LD A,([_LEX.w],X) <-- ??? LD Y,A CALL Rampa:265 LD X,[_LEX.w] LD A,Y LD TempPWM:1,A LD TempPWM,X and not compile! I have this error: ERROR L2410: Unresolved external __LEX (imported from funcs.o) Why the compiler use LEX indirect access? Why the compiler change if I have used same options? Advice? :o :) Thanks you!2007-07-29 11:07 PM
Hi Marco,
with my MetroWerks compiler (Version 1.1) I'll get exactly the same assembler code as in your first example. In your second example, PWM seems to be a pointer that points to a NEAR variable (16-bits addressing). With a subroutine call this behaviour only might appear when using extended large memory model (flag = -Mx) but not when using small memory model(flag = -Ms). So please check your memory model - or do you use the code outside a subroutine???? Regards, WoRo2007-07-31 10:41 AM
Thanks for your help!
I have try to change memory model but I have the same error! I must change my funcs...I cannot use pointer in my funcs very good for change all PWM register: Rampa(&DCR0,... --> void Rampa (volatile unsigned int *PWM,... Rampa(&DCR1,... Rampa(&DCR2,... Rampa(&DCR3,... :-[ Thanks again! bye