| Motore di ricerca datesheet componenti elettronici |
|
AN3348 Scheda tecnica(PDF) 6 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3348 Scheda tecnica(HTML) 6 Page - STMicroelectronics |
|
6 / 10 page ![]() Functional incompatibilities AN3348 6/10 Doc ID 018510 Rev 2 that was given to the function by the old tools and it won't work with the new ones. Therefore, in normal cases users should avoid writing such a code and should change it to specific inline assembly instructions. 3.2.2 C-inline assembly interaction The user mustn't make any kind of assumptions regarding issues as register allocation, variable storage location and code location. All the interaction between the C and inline assembly should be done symbolically. The following code example is a sure way to get into troubles: tmp = accel_tbl[tmp]; #asm( alu a = d; ram p <- start_period. ) Here the user assumed (based on old tools behavior) that tmp would reside in register d. This code can be easily fixed to asm{move a,tmp@Rn; ldm p,start_period}; For more details regarding inline assembly usage please look at the Inline Assembly chapter in eTPU_Build_Tools_Reference.pdf. 3.2.3 Inline assembly functions Many users have written functions which are fully implemented using inline assembly. A few changes might be needed for these functions. Let's take as an example this code sample and see how we change it into a standard and safe code: /* fract24 mc_ctrl_pid( fract24 error, mc_ctrl_pid_t *p_pid) */ #asm MC_CTRL_PID: /* Inputs: */ /* register a ...... error */ /* register diob ... p_pid */ /* Limit error to range <MIN24, MAX24> */ if V == 0 then goto MC_CTRL_PID_I, flush. if N == 0 then goto MC_CTRL_PID_I, no_flush. … #endasm 1. All inline assembly code should reside inside a function, so first we should uncomment the function's prototype. We should also make sure that the function's name is the name which is used in order to call this function. Notice that in many cases users used to call a label at the beginning of the inline assembly but since label names are local this won't work so now we'll have to call our function with the same name of this label. The label itself might be redundant now if it is not referenced from within the function so we can remove or comment it: fract24 MC_CTRL_PID( fract24 error, mc_ctrl_pid_t *p_pid) { #asm |
|
|
Link URL |
| Lei ha avuto il aiuto da alldatasheet? [ DONATE ] |
Di alldatasheet | Richest di pubblicita | contatti | Privacy Policy | Collegamento alla scheda tecnica | scambio Link | Ricerca produttore All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |