•
Question about Big Endian: how to put 12 34 56 78 in address 0xf000000 0xf0000 78 56 56 34 12 0xf0000 12 34 56 78
!
"de#ne $ax%u& 100 used to: pre'o&pi(e )))))) *repro'essor )))))
! i+4 , -+7 .+- // i 1 hat are the a(ues o ,x i+4 , x+
i+5 5 4 4
, x+1 7 1 7
!9pi'a( !9pi'a( ;% speed <<<< ee e5te9arat an9a bas do( 2a2rab 7agten wana &et(a5bata benho& 50= > 500= b
5$ b
•
•
•
.+2!34!5 ,, x+ o 26 50 o o 125
EE*?$ ntera'e @ana dawart 3(a e( net w (a2et e( egaba de : A* A*,, CC w do( &awgoden e( e5te9arat Atati' ariab(es are saed in : o Data seg&ents Ata' o o Feap
•
•
•
(o'a( ariab(es are saed in : Data seg&ents o o Ata' Feap o We want to save 0x65A in the physical address 0xAAF we will use : ( ana msh mota2akeda mn el codes kanet maktoba keda belabt ! bas heya shabaha :"# $(u%$ const# 0x65A&0xAAF' o $(u%$ const# 0xAAF&0x65A' o u%$ p&(u%$# 0x65A' p&0xAAF' o u%$ p&(u%$# 0xAAF' p&0x65A' o we use .......... for variable denition to reach an optimized C code for access variables: Extern o Volatile o Static o Register o Ete!ar rabe" # ta$reebn auto o hen we use ))))) or ariab(e de'(aration , the 'o&pi(er dosnt &ae an9 opti&iGation Extern o o Ho(ati(e Atati' o o ?egister E5te9ar rabe3 , ta2reebn auto o ;% and I% Diferne'es @$u(ti &aster aw sing(e , &u(ti s(aes aw (a2aC
;%: &u(ti &asters I%: sing(e &aster and &u(ti s(aes, ha( dup(ex •
hat is the dut9 9'(e o waeor& *eriod that the signa( is a'tie o o *eriod o the waeor& ?etio ben 7agten &a5adtesh ba(i &enho& :D@i&e o the on o signa(
Function ar)umenmts -umber o* callin) *unction o Embedded development constraints: (choose more that one* 1imited prower consumption o 1imited C&2 pace o 1imited development budget o 1imited 'emor! resources o 1imited 3aga 4an!a msh fa)raha bas )an feeha )elmet o &ower : Diferen'e between Jnion and Atru'ture @e( e5te(a e &een be9a5od &e&or9 atar w a3taKed en hwa e( Jnion :D bas et2aed9 C union Fa9geb(e 'ode beta3 un'tin &atob b taree2et e( $a'ro w e( un'tion 7asa((aha 'a((ing 5 &arrat ,, e( &e&or9 siGe beta3et e( 'ode da @e((i hwa e( 7a( 9a3n9 :DC + 505 Fa9geb(e nas e( un'tion &atoba bas &n 3Ler &a'ro , b e( tare2a e( 3ade9a 9a3n9 w bardo 7asa((aha 'a((ing 5 &arat bardo w e( siGe e( 7a(a de +125 , hashra7(e (eh on phone "*rag&a used or @&sh ara e( e5te9arat :DC a((ows arious instru'tions de#ned b9 the 'o&pi(erLs 'reator to be gien to the 'o&pi(erM@"prag&a na&eCNNi this na&e is unre'ogniGed b9 the 'o&pi(er, then the "prag&a is ignored and no error resu(ts) )))))))))))) de#ne ariab(e without resere &e&or9 or it: @ana gawebt be ?egisterC Extern o o Ho(ati(e Atati' o o ?egister E5te9ar rabe3 , ta2reebn auto o "i and "endi are using or: De#ne $a'ros @de egabt9C o o 7aga &sh araha o 7aga &sh araha bardo :D Diferen'e between O(ash &e&or9 w EE*?P$ o *age o O(ash is (arger than page o EE*?P$ @de e( egaba e((i 2a(et(9 3a(eha sa(&aC o Ba29 e( e5te9arat &sh araha $aing the ariab(e stati' afe'ts: ts s'ope o o ts (ieti&e ts s'ope and (ieti&e o o t depends /an we pass structure to Function by value+ yn (w e1ra*y leh yes aw no 1shan momken ye)eblek kaa yes w kaa no # Can we pass +rra! to function b! value5 6o#+rra!es are &ointers o o 7es o
•
•
•
•
•
•
•
•
6o#+rra!es cant passed argument (fe )alam wa$e" f el gomla msh fa)rah :* "de#ne $ax%u& 100 used to: *re 'o&p(ie )))))) @e(&a wa23a &eni :DC o o *re*ro'essor )))))) @nas e( e(&a e( wa23a &eni :DC Ba29 e( e5te9arat &sh araha :D bas &aansh eeha 7aga o &a3roa (e9a :D ?ea( i&e s9ste&s reKuires dead(ine and: 7aga &sh araha o o 7aga &sh araha Ruarantee #nishing tass at the dead(ine o o Ruarantee #nishing tass beore its dead(ine hat is the &eaning o nested interrupt ;bi(it9 to serer &ore than one interrupt o o nabi(it9 to serer &ore than one interrupt Aering a new interrupt whi(e another interrupt with (ower priorit9 o was sering oo(s that is used in 'onne'ting between un'tions @e5tar9 aGa 7aga C o Ae&aphores ass o o $utexes riti'a( s9ste&s o o =an e aGa e5te9ar tan9een &sh araho& bsra7a :D he &ost suitab(e de#nition or interrupt 'ontro((er is: ; s&a(( &i'ro'ontro((er that hand(e the interrupts o o A&a(( 'ir'uit that hand(e interrupts and de#ne its priorit9 A&a(( 'ir'uit that enab(es and disab(es the interrupt o o B Diferen'es between A* and J;? @whi'h is s9n'hronour and whi'h is as9n'hronous, whi'h is &u(ti $asters whi'h is sing(e &aster, whi'h is &u(ti s(aes and whi'h is sing(e s(aesC o
•
•
•
•
•
•
A* : A9n'hronous, sing(e &aster, &u(ti s(aes, u(( dup(ex J;?: ;s9n'hronous, sing(e &aster, &u(ti s(aes, u(( dup(ex •
J;? o o o
•
A9n'hronous ;s9n'hronous ;s9n'hronous
JA;? A9n'hronous o o ;s9n'hronous ;s9n'hronous
4he use of %atchdog timer in 2+R4 (msh fa)ra el ete!arat bas shof! hwa $eh lazmeto*
A3. 4imulator can determine the time o* small *unctions+ (.F#
•
?eentrant un'tion
• •
x+x S @1TT2C ,, <<<< S &eans .P? IAB@Ieast Aigni#'ant bitC+ 0, his (ine : o o o o
•
•
Aet Bit 5 o x (ear Bit 3 o x ogg(e bit 3 o x ogg(e bit 2 o x
hi'h o the next ariab(e 'an be de#ned as o(ati(e @e( so2a( da 7assa enno aGa wa7da eeho& 9ena3o sa7, bas hwa 9as&a7 be egaba wa7da bas :DC o $e&or9 ))))))))))))))))))) Atatus register @e( no2at de a(a& wa2e3 &enni :DC o R(oba( ))))))))))))))))))))))) R(oba( ariab(e that is used in &u(tithreaded app(i'ations o
int 5a((i ba(e &n e( pointers e((i ga9a de ,, gat e( e&te7an raKa& @C (8a*9;<= aC int a= << ;n integer bC int 8a= << ; pointer to an integer 'C int 88a= << ; pointer to a pointer to an integer dC int a9;<= << ;n arra9 o 10 integers eC int 8a9;<= << ;n arra9 o 10 pointers to integers C int (8a*9;<= << ; pointer to an arra9 o 10 integers gC int (8a*(int*= << ; pointer to a un'tion a that taes an integer argu&ent and returns an integer hC int (8a9;<*(int*= << ;n arra9 o 10 pointers to un'tions that tae an integer argu&ent and return an integer
•
•
•
these nu&bers are pushed into sta' in order 1,2,3 and 5,, the #rst one wi( pop is 5 o 3 o 2 o 1 o
i+5 i @i N+ 4C write UFe((oV riteVendV Fe((o o o End o Fe((o then end
Write the "standard" MIN macro-that is, a macro that takes two arguments and returns the smaller of the two arguments.
#define MIN(A,B) ((A) < = (B) ? (A) : (B)) lw galy “<=” w “<” a5tar anhy ? El so2al da gali b el 7arf keda bas kan coice !ab"n
•
Using the #define statement, how would you declare a manifest constant that returns the number of seconds in a year !isregard lea years in your answer.
#define E$%N&'E'*EA (+ - + - 2. - "+/) #define E$%N&'E'*EA (+ - + - 2. - "+/01) o #define E$%N&'E'*EA (+ - + - 2. - "+/) o #define E$%N&'E'*EA + - + - 2. - "+/ o El 7al elli f el folder beta3 embedded C interview da msh mawgod few ala e5teyar feehom :D fa el egaba ya ema el !ola ya ema el "anya :D es!ali 7ad mn el 3eyal eli hena# ba!a o
•
i=$%5 &wit'h (i) *Case $ : 'o+t<< “$”, Case ! : 'o+t<< “!”, Case 3 : 'o+t<< “3”, Defa+lt: Co+t<< “-”, .the res+lts will be $!3o o Com/ile Error o
In34! ca3!4re $a3!4re I5% 3or!s s!a!4s o o $a3!4re analoge signals ara6e!er based on !i6er, 6eas4re signals and s3eed o