Something went wrong. Try again.
Completely reimplimented in zig (eventually)
Something went wrong. Try again.
Java
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265package com.microchip.mplab.ipecmd.commandline;
import com.fasterxml.jackson.core.JsonProcessingException;import com.fasterxml.jackson.databind.JsonNode;import com.fasterxml.jackson.databind.ObjectMapper;import com.microchip.crownking.Pair;import com.microchip.crownking.edc.Region;import com.microchip.crownking.mplabinfo.DeviceSupport;import com.microchip.crownking.mplabinfo.DeviceSupportException;import com.microchip.crownking.mplabinfo.FamilyDefinitions.Family;import com.microchip.crownking.mplabinfo.FamilyDefinitions.SubFamily;import com.microchip.mplab.crownkingx.xMemoryPartition;import com.microchip.mplab.crownkingx.xPIC;import com.microchip.mplab.crownkingx.xRegion;import com.microchip.mplab.crownkingx.xMemTraits.WordTraits;import com.microchip.mplab.ipecmd.common.SharedData;import com.microchip.mplab.ipecmd.common.TableGenerator;import com.microchip.mplab.ipecmd.displays.MemoryView;import com.microchip.mplab.ipelib.IPELibrary;import com.microchip.mplab.ipelib.PackUtils;import com.microchip.mplab.ipelib.device.CDevice;import com.microchip.mplab.ipelib.toolsupport.ToolType;import com.microchip.mplab.lib.scripting.MapWithDefaults;import com.microchip.mplab.libs.RI4ToolsController.DataClasses.PtgImageInfo;import com.microchip.mplab.libs.packmanagerservice.interfaces.MPLABPackContext;import com.microchip.mplab.libs.packmanagerservice.interfaces.PackRelease;import com.microchip.mplab.libs.toolpacksupport.interfaces.ToolPackRelease;import com.microchip.mplab.logger.MPLABLogger;import com.microchip.mplab.mdbcore.RealICETool.utils.RIExceptions;import com.microchip.mplab.mdbcore.assemblies.Assembly;import com.microchip.mplab.mdbcore.checksum.common.BufferChecksumHelper.MemoryRegion;import com.microchip.mplab.mdbcore.memory.MemoryModel;import com.microchip.mplab.mdbcore.memory.MultiPartition;import com.microchip.mplab.mdbcore.memory.MultiPartition.MODE;import com.microchip.mplab.mdbcore.memory.memorytypes.ProgramMemory;import com.microchip.mplab.mdbcore.pa.service.commands.FirmwareInfo;import com.microchip.mplab.mdbcore.pm5.service.commands.responses.Pm5Versions;import com.microchip.mplab.mdbcore.pm5.service.utils.ServiceQueryException;import com.microchip.mplab.mdbcore.sqtpenv.SQTPEnvironment.SQTPError;import java.io.BufferedReader;import java.io.File;import java.io.IOException;import java.io.InputStreamReader;import java.io.RandomAccessFile;import java.io.UnsupportedEncodingException;import java.net.Socket;import java.nio.file.Files;import java.nio.file.Path;import java.nio.file.Paths;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Arrays;import java.util.Date;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.Optional;import java.util.Properties;import java.util.Scanner;import java.util.Map.Entry;import java.util.logging.Level;import org.openide.util.Exceptions;import org.openide.util.Lookup.Result;
public class CmdApp { private MemoryView memoryView; private CDevice deviceInfo; private ToolPackFinder finder; private xPIC picdevicedb; private Socket serverSocket; private IPELibrary ipeLibrary; private long m_OperationFlags = 0L; private int m_EnvironmentSelectionFlags = 0; private int m_MemorySelectionFlags = 0; private int m_ReadMemorySelectionFlags = 0; private int m_VerifyMemorySelectionFlags = 0; private String m_DeviceString = ""; private boolean isMCP = false; private String m_FormatedDeviceString = ""; private ArrayList connectedToolList; private boolean displayToolList = false; private String activeToolSelection = ""; private String activeToolSerialNo = ""; private boolean activeToolSelected = false; private String m_HexFilePath = ""; private String m_ReadHexFilePath = ""; private char m_LogLevel = '0'; private String m_LogFilePath = ""; private String m_SQTPNumFilePath = ""; private String m_EnvironmentString = ""; private boolean m_SnoSelected = false; private SharedData sharedData; private boolean m_isToolMustFlag = false; private String m_vddMinVoltage = "0.0"; private String m_vddMaxVoltage = "0.0"; private String m_vddNominalVoltage = "0.0"; private String m_vddAppVoltage = "0.0"; private String m_vppVoltage = "0.0"; private String m_voltageValue = "0.0"; private long m_PgmMemRangeStartAddress = 0L; private long m_PgmMemRangeEndAddress = 0L; private long m_EEMemRangeStartAddress = 0L; private long m_EEMemRangeEndAddress = 0L; private long m_bootMemRangeStartAddress = 0L; private long m_bootMemRangeEndAddress = 0L; private long m_CfgMemRangeStartAddress = 0L; private long m_CfgMemRangeEndAddress = 0L; private long m_AuxMemRangeStartAddress = 0L; private long m_AuxMemRangeEndAddress = 0L; private String parseErrorMsg = ""; private boolean setDefaultValue = false; private String manualFirmwarePath = ""; private String pm3Path4mCard = ""; private boolean m_SafeMode = false; private String m_ReprogramFilePath = ""; private boolean bRedoFlag = false; private long lPassCount = 0L; private String saveEnv_Desc = "None"; private String saveEnv_MiscFile = ""; private boolean exe_flag = false; private boolean jar_flag = false; private String m_PreservePgmStartAddress = ""; private String m_PreservePgmEndAddress = ""; private String m_PreservePgmAddrRange = ""; private String m_PgmMemSpecificRangeStartAddress = ""; private String m_PgmMemSpecificRangeEndAddress = ""; private String m_PreserveEEPROMAddrRange = ""; private File envFile; private String ptgImage = ""; private String packInfo = ""; private String toolPackVersion = ""; private int m_MemorySelection = 0; private boolean m_SerialNoExist = false; private String serialport = ""; private boolean isSerialcom = false; private long calibration_data = 0L; private long m_BigpgmMemRangeStartAddress = 0L; private long m_BigpgmMemRangeEndAddress = 0L; private boolean BigA = false; private boolean displayProgMemRange = false; private List<PackRelease> packReleases; private String sCustomDFPDirPath = ""; private String m_PTGImageName = ""; private int m_ICD4_or_PK4_Setting = 0; private String m_ICD4_or_PK4_LEDBrightnessValue = "5"; private String m_ICD4_or_PK4_PGC = "Pull Down"; private String m_ICD4_or_PK4_PGD = "Pull Down"; private String m_ICD4_or_PK4_PGCValue = "4.7"; private String m_ICD4_or_PK4_PGDValue = "4.7"; private String m_ICD4_or_PK4_Speed = "Max"; private int m_AVRSAMSupport = 0; private int m_SPLSettingSupport = 0; private String m_AICE_SpeedValue = "0.100"; private String m_AICE_interface = "JTAG"; private int m_JTAGComnSupport = 0; private String m_JTAG_interface = "JTAGComn"; private int m_AVR_HighVoltageActivation = 0; private String m_AVRHighVoltageActivationValue = ""; private String m_Commn_interface = "JTAG"; private String m_CommSpeedValue = "0.100"; private int m_ChipEraseSupport = 0; private String m_ChipEraseDefaultKey = "0xffffffff,0xffffffff,0xffffffff,0xffffffff"; private String m_ChipEraseType = "ChipEraseAll"; private String m_DeviceActions = ""; private String m_DevActionFuncName = ""; private int m_DFPSettingSupport = 0; private int m_ChecksumSupport = 0; private int m_OTPPgmmingSupport = 0; private int m_PTGImage = 0; private final List<String> pCommands = Arrays.asList( "-ula", "-ulp", "-ule", "-ugae", "-usae", "-ude", "-ugfi", "-ute", "-ups", "-ugl", "/ula", "/ulp", "/ule", "/ugae", "/usae", "/ude", "/ugfi", "/ute", "/ups", "/ugl" ); private final String fakeDeviceForPM5Assembly = "PIC10F200"; private boolean isFakeAssemblyRequired = false; private boolean isPM5orPACommand = false; private List<String> paramsAdaptersList = new ArrayList<>(); private List<String> adaptersList = new ArrayList<>(); private String pm5orPaEnvironment = ""; private List<String> paramsPm5MainSerialList = new ArrayList<>(); private String pm5MainSerial = ""; private boolean isLaCmdActive = false; private boolean isLeCmdActive = false; private boolean isSaeCmdActive = false; private boolean isGaeCmdActive = false; private boolean isTeCmdActive = false; private boolean isDeCmdActive = false; private boolean isGfiCmdActive = false; private boolean isLpm5CmdActive = false; private boolean isPrgStatsCmdActive = false; private boolean isGetLogCmdActive = false;
public CmdApp() { this.sharedData = SharedData.getSingletonObject(); this.m_OperationFlags = 0L; }
public CmdApp(Socket serverSocket) { this.sharedData = SharedData.getSingletonObject(); this.serverSocket = serverSocket; }
private boolean initApplication(String formatedDeviceName) { if (this.isFakeAssemblyRequired && formatedDeviceName.isEmpty()) { formatedDeviceName = "PIC10F200"; }
return this.CreateAssembly(formatedDeviceName); }
private Map<String, String> FetchPackInfo(String packInfo) { Map<String, String> packInfoKeyValuePair = new HashMap<>(); String[] packProperties = packInfo.split(","); if (packProperties != null && packProperties.length > 2) { packInfoKeyValuePair.put("PackName", packProperties[0]); packInfoKeyValuePair.put("PackVersion", packProperties[1]); packInfoKeyValuePair.put("PackVendor", packProperties[2]); }
return packInfoKeyValuePair; }
private boolean getDeviceNameFromPM3File() { char cmdIdentifier = '-'; boolean retVal = true; if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) { cmdIdentifier = this.m_EnvironmentString.charAt(0); if (cmdIdentifier == 'C' || cmdIdentifier == 'c') { String extType = this.sharedData.getExtention(this.m_EnvironmentString.substring(1)); if (extType != null && (extType.compareToIgnoreCase("pm3") == 0 || extType.compareToIgnoreCase("pen") == 0)) { this.m_FormatedDeviceString = this.ipeLibrary.getDeviceNameInEnv(this.m_EnvironmentString.substring(1));
try { this.m_SQTPNumFilePath = this.ipeLibrary.getSqtpFileNameInEnv(this.m_EnvironmentString.substring(1)); } catch (UnsupportedEncodingException var11) { Exceptions.printStackTrace(var11); } } else { int start = this.m_EnvironmentString.substring(1).replace("\\", "/").lastIndexOf(47); String fileName = this.m_EnvironmentString.substring(1).substring(start + 1); this.envFile = new File(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pm3"); if (this.envFile.exists()) { this.m_FormatedDeviceString = this.ipeLibrary.getDeviceNameInEnv(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pm3");
try { this.m_SQTPNumFilePath = this.ipeLibrary.getSqtpFileNameInEnv(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pm3"); } catch (UnsupportedEncodingException var10) { Exceptions.printStackTrace(var10); } } else if (!this.exe_flag) { this.envFile = new File(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pen"); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
this.m_FormatedDeviceString = this.ipeLibrary.getDeviceNameInEnv(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pen");
try { this.m_SQTPNumFilePath = this.ipeLibrary.getSqtpFileNameInEnv(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pen"); } catch (UnsupportedEncodingException var9) { Exceptions.printStackTrace(var9); } } } } else if (cmdIdentifier == 'P' || cmdIdentifier == 'p') { String extType = this.sharedData.getExtention(this.m_EnvironmentString.substring(1)); if (extType != null && extType.compareToIgnoreCase("pm3") == 0) { this.pm3Path4mCard = this.ipeLibrary.GetPM3EnvironmentFromPM3SDCard("MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1), true);
try { this.m_SQTPNumFilePath = this.ipeLibrary.getSqtpFileNameInEnv("MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1)); } catch (UnsupportedEncodingException var8) { Exceptions.printStackTrace(var8); } } else { if (extType != null && extType.compareToIgnoreCase("pen") == 0) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
this.envFile = new File(this.m_EnvironmentString.substring(1)); this.pm3Path4mCard = this.ipeLibrary .GetPM3EnvironmentFromPM3SDCard("MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1) + "/" + this.envFile.getName() + ".pm3", true);
try { this.m_SQTPNumFilePath = this.ipeLibrary .getSqtpFileNameInEnv("MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1) + "/" + this.envFile.getName() + ".pm3"); } catch (UnsupportedEncodingException var7) { Exceptions.printStackTrace(var7); } }
this.m_FormatedDeviceString = this.ipeLibrary.getDeviceNameInEnv(this.pm3Path4mCard); if (this.m_FormatedDeviceString.contentEquals("")) { this.sharedData.quitAndSendErrorCode("", CommandCodes.OPFAILURE); return false; }
retVal = this.CreateAssembly(this.m_FormatedDeviceString); if (!this.processToolAndCreateDebuggerSession()) { return false; } } }
return retVal; }
private String getFullToolIdentifierBySno(String sNo) { String retVal = ""; this.connectedToolList = this.ipeLibrary.getCurrentAvailableToolList(); if (this.connectedToolList != null) { if (this.connectedToolList.isEmpty()) { retVal = ""; } else { for (int iLoop = 0; iLoop < this.connectedToolList.size(); iLoop++) { if (this.getSerialNoOrName(this.connectedToolList.get(iLoop).toString(), true).compareToIgnoreCase(sNo) == 0) { retVal = this.connectedToolList.get(iLoop).toString(); break; } } } } else { retVal = ""; }
return retVal; }
private String getFullToolIdentifierName(String shortName) { String retVal = ""; if (this.connectedToolList != null) { if (this.connectedToolList.isEmpty()) { retVal = ""; } else { for (int iLoop = 0; iLoop < this.connectedToolList.size(); iLoop++) { if (this.getSerialNoOrName(this.connectedToolList.get(iLoop).toString(), false).compareToIgnoreCase(shortName) == 0) { retVal = this.connectedToolList.get(iLoop).toString(); if (shortName.compareToIgnoreCase("PM3") == 0) { retVal = this.connectedToolList.get(iLoop).toString(); } break; } } } } else { retVal = ""; }
return retVal; }
private String getFullToolIdentifierByID(int index) { String retVal = ""; if (this.connectedToolList != null) { if (this.connectedToolList.isEmpty()) { retVal = ""; } else if (this.connectedToolList.size() > index && index >= 0) { retVal = this.connectedToolList.get(index).toString(); } else { retVal = ""; } }
return retVal; }
private void displayToolList() { if (this.connectedToolList != null) { if (this.connectedToolList.isEmpty()) { this.sharedData.printScreen("IPECMD.NOTOOLS_CONNECTED"); } else { this.sharedData.IPEPrint("Available Tool List"); this.sharedData.IPEPrint("-------------------");
for (int iLoop = 0; iLoop < this.connectedToolList.size(); iLoop++) { this.sharedData.IPEPrint(Integer.toString(iLoop + 1) + " " + this.connectedToolList.get(iLoop).toString()); } } } else { this.sharedData.printScreen("IPECMD.NOTOOLS_CONNECTED"); } }
private boolean isVerifyDeviceIDB4Program() { boolean retFlag = false; if (this.isOperationFlagSet(CommandCodes.VERIFY_DEVICEID_B4_PROGRAM)) { retFlag = true; }
return retFlag; }
private boolean isToolRequiredSwitchPresent() { boolean retFlag = false; if (this.isOperationFlagSet(CommandCodes.DEVICE_IDREVISION_READ) || this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE) && this.activeToolSelection.equalsIgnoreCase("PM3") || this.isOperationFlagSet(CommandCodes.PTG_SUPPORT) || this.isOperationFlagSet(CommandCodes.PROGRAM_MEMORY_RANGE) || this.isOperationFlagSet(CommandCodes.REPORGRAM_MEMORY) || this.isOperationFlagSet(CommandCodes.BATCH_PROCESSING) || this.isOperationFlagSet(CommandCodes.READ_TARGET) || this.isOperationFlagSet(CommandCodes.BLANK_CHECK_DEVICE) || this.isOperationFlagSet(CommandCodes.DEVICE_ID_READ) || this.isOperationFlagSet(CommandCodes.DOWNLOAD_FIRMWARE) || this.isOperationFlagSet(CommandCodes.DISPLAY_PM3_CHECKSUM) || this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) || this.isOperationFlagSet(CommandCodes.READ_INTO_HEX) || this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) || this.isOperationFlagSet(CommandCodes.ERASE_FLASH) || this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE) || this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION) || this.isReadMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION) || this.isReadMemoryRegionFlagSet(CommandCodes.M_CFG_REGION) || this.isReadMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION) || this.isReadMemoryRegionFlagSet(CommandCodes.M_ID_REGION)) { retFlag = true; }
return retFlag; }
private boolean validateToolName(String tName) { boolean retVal = false; if (tName.compareToIgnoreCase("RICE") == 0 || tName.compareToIgnoreCase("ICD3") == 0 || tName.compareToIgnoreCase("PK3") == 0 || tName.compareToIgnoreCase("PM3") == 0 || tName.compareToIgnoreCase("PKOB") == 0 || tName.compareToIgnoreCase("ICD4") == 0 || tName.compareToIgnoreCase("ICD5") == 0 || tName.compareToIgnoreCase("PK4") == 0 || tName.compareToIgnoreCase("PK5") == 0 || tName.compareToIgnoreCase("AICE") == 0 || tName.compareToIgnoreCase("SNAP") == 0 || tName.compareToIgnoreCase("PKOB4") == 0 || tName.compareToIgnoreCase("Edbg") == 0 || tName.compareToIgnoreCase("MEdbg") == 0 || tName.compareToIgnoreCase("NEdbg") == 0 || tName.compareToIgnoreCase("ICE4") == 0 || tName.compareToIgnoreCase("J32") == 0 || tName.compareToIgnoreCase("PKBASIC") == 0 || tName.compareToIgnoreCase("PM5PA") == 0 || tName.compareToIgnoreCase("PM5") == 0) { retVal = true; }
return retVal; }
private int getNoOfToolConnected(String toolName) { int counter = 0; if (this.activeToolSelection.equalsIgnoreCase("PM3")) { if (this.isSerialcom && !this.serialport.equals("5")) { this.ipeLibrary.UpdateSerialTools(); this.connectedToolList = this.ipeLibrary.querySerialToolList(); } else { this.connectedToolList = this.ipeLibrary.getCurrentAvailableToolList(); } } else { this.connectedToolList = this.ipeLibrary.getCurrentAvailableToolList(); }
if (this.connectedToolList != null) { for (int iLoop = 0; iLoop < this.connectedToolList.size(); iLoop++) { if (this.getSerialNoOrName(this.connectedToolList.get(iLoop).toString(), false).compareToIgnoreCase(toolName) == 0) { counter++; } } }
return counter; }
public static String formatATDeviceName(String deviceName) { ArrayList<String> deviceList = null;
try { DeviceSupport deviceSupport = DeviceSupport.getInstance(); if (deviceSupport != null) { String[] listOfParts = deviceSupport.getDeviceNames(); if (listOfParts != null) { for (String temp : new ArrayList<>(Arrays.asList(listOfParts))) { if (deviceName.compareToIgnoreCase(temp) == 0) { return temp; } } } }
return null; } catch (DeviceSupportException var6) { return null; } }
private boolean formatDeviceName() { boolean retVal = true; String DeviceString = ""; if (this.m_DeviceString.length() == 0) { return false; } else { if ((this.m_DeviceString.charAt(0) != '3' || this.m_DeviceString.charAt(1) != '3') && (this.m_DeviceString.charAt(0) != '3' || this.m_DeviceString.charAt(1) != '0')) { if (this.m_DeviceString.substring(0, 4).compareToIgnoreCase("25LC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("25C") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("25A") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("93A") != 0 && this.m_DeviceString.substring(0, 4).compareToIgnoreCase("93LC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("93C") != 0 && this.m_DeviceString.substring(0, 4).compareToIgnoreCase("24FC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("24A") != 0 && this.m_DeviceString.substring(0, 4).compareToIgnoreCase("24LC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("24C") != 0 && this.m_DeviceString.substring(0, 4).compareToIgnoreCase("11AA") != 0 && this.m_DeviceString.substring(0, 4).compareToIgnoreCase("11LC") != 0) { if (this.m_DeviceString.substring(0, 2).compareToIgnoreCase("25") != 0 && this.m_DeviceString.substring(0, 2).compareToIgnoreCase("19") != 0 || this.m_DeviceString.substring(0, 4).compareToIgnoreCase("25LC") == 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("25A") == 0) { if (this.m_DeviceString.substring(0, 2).compareToIgnoreCase("PS") != 0) { if (this.m_DeviceString.substring(0, 5).compareToIgnoreCase("RFPIC") == 0) { DeviceString = "rfPIC"; this.m_DeviceString = this.m_DeviceString.substring(5); } else if (this.m_DeviceString.substring(0, 3).compareToIgnoreCase("MCV") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("SST") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("HCS") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("MCS") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("WBZ") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("WLR") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("CEC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("MEC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("EEC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("DEC") != 0 && this.m_DeviceString.substring(0, 3).compareToIgnoreCase("LAN") != 0 && this.m_DeviceString.substring(0, 2).compareToIgnoreCase("34") != 0) { if (this.m_DeviceString.substring(0, 2).compareToIgnoreCase("AT") == 0 || this.m_DeviceString.substring(0, 2).compareToIgnoreCase("AV") == 0) { String retDevName = formatATDeviceName(this.m_DeviceString); if (retDevName != null) { this.m_DeviceString = retDevName; } } else if (this.m_DeviceString.substring(0, 3).compareToIgnoreCase("USB") != 0) { DeviceString = "PIC"; } } } } else { DeviceString = "MCP"; this.isMCP = true; } } } else { DeviceString = "dsPIC"; }
this.m_FormatedDeviceString = DeviceString + this.m_DeviceString; return retVal; } }
private String getSerialNoOrName(String toolInfo, boolean isSno) { String retVal = ""; String[] toolInfoSno = null; if (toolInfo != null && !toolInfo.equals("")) { toolInfoSno = toolInfo.split(":"); if (toolInfoSno != null) { if (isSno) { retVal = toolInfoSno[1].substring(1); } else { retVal = toolInfoSno[0].trim().substring(0, toolInfoSno[0].trim().length() - 5); if (retVal.contains("Real ICE")) { retVal = "RICE"; } else if (retVal.contains("PICkit3")) { retVal = "PK3"; } else if (retVal.contains("ICD 3")) { retVal = "ICD3"; } else if (retVal.equalsIgnoreCase("PKOB nano")) { retVal = "NEDBG"; } else if (retVal.contains("PM3")) { retVal = "PM3"; } else if (retVal.contains("PKOB") && !retVal.contains("PKOB4")) { retVal = "PKOB"; } else if (retVal.contains("PKOB SKDE")) { retVal = "PKOS"; } else if (retVal.contains("PICkit2")) { retVal = "PK2"; } else if (retVal.contains("ICD 4")) { retVal = "ICD4"; } else if (retVal.contains("ICD 5")) { retVal = "ICD5"; } else if (retVal.contains("ICE 4")) { retVal = "ICE4"; } else if (retVal.contains("PICkit 4")) { retVal = "PK4"; } else if (retVal.contains("PICkit 5")) { retVal = "PK5"; } else if (retVal.contains("Atmel-ICE")) { retVal = "AICE"; } else if (retVal.contains("Snap")) { retVal = "SNAP"; } else if (retVal.contains("PKOB4") || retVal.contains("PKoB4")) { retVal = "PKOB4"; } else if (retVal.equalsIgnoreCase("EDBG")) { retVal = "EDBG"; } else if (retVal.equalsIgnoreCase("mEDBG")) { retVal = "MEDBG"; } else if (retVal.equalsIgnoreCase("J-32")) { retVal = "J32"; } else if (retVal.equalsIgnoreCase("PICkit Basic")) { retVal = "PKBASIC"; } else if (retVal.equalsIgnoreCase("PM5 Program Adapter")) { retVal = "PM5PA"; } else if (retVal.equalsIgnoreCase("PM5")) { retVal = "PM5"; } else { retVal = "INVD"; } } } }
return retVal; }
private boolean isICD4_or_PK4_FlagSet(int flag) { boolean retVal = false; int ret = this.m_ICD4_or_PK4_Setting & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isChipErase_FlagSet(int flag) { boolean retVal = false; int ret = this.m_ChipEraseSupport & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isAVRSettingFlagSet(int flag) { boolean retVal = false; int ret = this.m_AVRSAMSupport & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isJTAGComnFlagSet(int flag) { boolean retVal = false; int ret = this.m_JTAGComnSupport & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isHighVoltageActivationSet(int flag) { boolean retVal = false; int ret = this.m_AVR_HighVoltageActivation & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isSPLMemorySettingFlagSet(int flag) { boolean retVal = false; int ret = this.m_SPLSettingSupport & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isCustomDFPPathSet(int flag) { boolean retVal = false; int ret = this.m_DFPSettingSupport & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isChecksumSet(int flag) { boolean retVal = false; int ret = this.m_ChecksumSupport & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean IsPTGImageFlagSet(int flag) { boolean retVal = false; int ret = this.m_PTGImage & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isOTPPgmmingSupport(int flag) { boolean retVal = false; int ret = this.m_OTPPgmmingSupport & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isEnvironmentFlagSet(int flag) { boolean retVal = false; int ret = this.m_EnvironmentSelectionFlags & flag; if (ret > 0) { retVal = true; }
return retVal; }
public boolean isMiscelleneousCommand() { boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.DISPLAY_PM3_HELP) || this.isOperationFlagSet(CommandCodes.DISPLAY_TOOLS_HELP) || this.isOperationFlagSet(CommandCodes.DISPLAY_IPECMD_HELP) || this.isOperationFlagSet(CommandCodes.DFP_VERSION_SWITCH) || this.isOperationFlagSet(CommandCodes.TOOL_PACK_VERSION_SWITCH)) { int errorCode = this.sharedData.getLastErrorCode(); if (errorCode == CommandCodes.OP_MISC) { retVal = true; } }
return retVal; }
private boolean isOperationFlagSet(long flag) { boolean retVal = false; long ret = this.m_OperationFlags & flag; if (ret > 0L) { retVal = true; }
return retVal; }
private boolean isMemoryRegionFlagSet(int flag) { boolean retVal = false; int ret = this.m_MemorySelectionFlags & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isReadMemoryRegionFlagSet(int flag) { boolean retVal = false; int ret = this.m_ReadMemorySelectionFlags & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isVerifyMemoryRegionFlagSet(int flag) { boolean retVal = false; int ret = this.m_VerifyMemorySelectionFlags & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean isUserSelectedMemoryRegionFlagSet(int flag) { boolean retVal = false; int ret = this.m_MemorySelection & flag; if (ret > 0) { retVal = true; }
return retVal; }
private boolean initializeTargetSystem() { boolean retBackMode = false; boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET)) { if (!this.checkEnvironmentConflict()) { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; }
retBackMode = this.setDeviceNameFromEnvironmentFile(); } else if (!this.formatDeviceName()) { if (this.displayToolList) { this.connectedToolList = this.ipeLibrary.queryToolList(); this.displayToolList(); this.sharedData.quitAndSendErrorCode("", CommandCodes.OP_MISC); return false; }
if (!this.checkFakeAssemblyRequirement()) { this.sharedData.quitAndSendErrorCode("Device is not selected", CommandCodes.OPFAILURE); return false; } } else if (this.activeToolSelection.equalsIgnoreCase("PM5PA") || this.activeToolSelection.equalsIgnoreCase("PM5")) { String folderPath = System.getProperty("user.home") + "/PTG"; File folder = new File(folderPath); if (!folder.exists() && !folder.mkdir()) { return false; }
this.sharedData.setCoreParameters("environment.location", folderPath); this.sharedData.setCoreParameters("environmentname", this.m_FormatedDeviceString); }
if (!this.initApplication(this.m_FormatedDeviceString)) { this.sharedData .quitAndSendErrorCode( this.sharedData.getStringFromBundle("IPECMD.DEVICENOTFOUND") + this.m_FormatedDeviceString + "\n" + this.sharedData.getStringFromBundle("IPECMD.DFPWARNING"), CommandCodes.INVALID_CMDLINE_ARG ); return false; } else { if (this.ipeLibrary.isARMDeviceInAssembly() && ( this.isChipErase_FlagSet(CommandCodes.CHIPERASE_KEY) || this.isChipErase_FlagSet(CommandCodes.CHIPERASE_TYPE) || this.isOperationFlagSet(CommandCodes.DEVICE_ACTIONS) )) { this.ipeLibrary.initScript(); }
return retVal; } }
public boolean ProcessSQTP() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.SQTP_SELECTED) && !this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE) && !this.m_SQTPNumFilePath.equals("")) { SQTPError sqtpErr = this.ipeLibrary.loadSQTPFile(this.m_SQTPNumFilePath); if (sqtpErr == SQTPError.FILE_EXHAUSTED) { this.sharedData.quitAndSendErrorCode("No more SQTP numbers are available in the selected file", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.INVALID_FILE) { this.sharedData.quitAndSendErrorCode("Invalid SQTP File", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.INVALID_USER_PARAMETER) { this.sharedData.quitAndSendErrorCode("Failed to load SQTP file", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.OTHER_ERROR) { this.sharedData.quitAndSendErrorCode("Failed to load SQTP file", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.SUCCESS) { this.sharedData.IPEPrint("SQTP file loaded successfully"); return true; }
if (sqtpErr == SQTPError.NO_FILE_FOUND) { this.sharedData.quitAndSendErrorCode("No file found", CommandCodes.OPFAILURE); return false; } }
return retVal; }
public boolean UpdateSQTPFileIfProgramSuccess() { boolean retVal = true; if ((this.isOperationFlagSet(CommandCodes.SQTP_SELECTED) || this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) && !this.m_SQTPNumFilePath.equals("")) { SQTPError sqtpErr = this.ipeLibrary.loadNextSQTPSequence(this.m_SQTPNumFilePath); if (sqtpErr == SQTPError.FILE_EXHAUSTED) { this.sharedData.quitAndSendErrorCode("No more SQTP numbers are available in the selected file", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.INVALID_FILE) { this.sharedData.quitAndSendErrorCode("Invalid SQTP File", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.INVALID_USER_PARAMETER) { this.sharedData.quitAndSendErrorCode("Failed to load SQTP file", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.OTHER_ERROR) { this.sharedData.quitAndSendErrorCode("Failed to load SQTP file", CommandCodes.OPFAILURE); return false; }
if (sqtpErr == SQTPError.SUCCESS) { this.sharedData.IPEPrint("SQTP file loaded successfully"); return true; }
if (sqtpErr == SQTPError.NO_FILE_FOUND) { this.sharedData.quitAndSendErrorCode("No file found", CommandCodes.OPFAILURE); return false; } }
return retVal; }
private boolean generateGoldenFiles() { int retStatus = 0; boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.EXPORT_INTO_HEX) && this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { ArrayList<String> hexFilesList = new ArrayList<>(); String[] hexFiles = this.m_HexFilePath.split(";"); if (hexFiles.length > 0) { for (String hexFile : hexFiles) { hexFilesList.add(hexFile); } } else { hexFilesList.add(this.m_HexFilePath); }
retStatus = this.ipeLibrary.loadHexFile(hexFilesList, false); if (retStatus == -1) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_HEXFILE"), CommandCodes.FILE_OPEN_ERROR); return false; } else { if (retStatus == 1) { if (!this.isOperationFlagSet(CommandCodes.NOCLEAR_DEBUG_BIT)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.DBG_WARNING"), CommandCodes.OPFAILURE); return false; }
this.sharedData.printScreen("IPECMD.DBG_WARNING_CONT"); }
if (this.isOperationFlagSet(CommandCodes.DISPLAY_CHECKSUM)) { String retCSM = this.ipeLibrary.getChecksum(); if (retCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.printScreen("IPECMD.NOSUPPORT_CSM_DISP"); } else { this.sharedData.IPEPrint("Checksum = " + retCSM); } }
if (this.isOperationFlagSet(CommandCodes.CRC32_CHECKSUM)) { File hexPath = new File(this.m_HexFilePath); if (hexPath.exists()) { String retCSM = this.ipeLibrary.getcrc32FileChecksum(hexPath); if (retCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.printScreen("IPECMD.NOSUPPORT_CSM"); } else { this.sharedData.IPEPrint("CRC32 = " + retCSM); } } }
if (!this.ProcessSQTP()) { return false; } else { String tempFileName = this.m_HexFilePath.substring(0, this.m_HexFilePath.length() - 4); tempFileName = tempFileName + "testIO.hex"; this.ipeLibrary.exportHexFile(tempFileName); this.sharedData.IPEPrint("Exported to : " + tempFileName); this.sharedData.quitAndSendErrorCode("", CommandCodes.OPSUCCESS); return false; } } } else { return retVal; } }
private boolean loadHexFileToMemory(boolean imageTransferToPM3) { int retStatus = 0; boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { if (this.isOperationFlagSet(CommandCodes.NOCLEAR_DEBUG_BIT)) { ArrayList<String> hexFilesList = new ArrayList<>(); String[] hexFiles = this.m_HexFilePath.split(";"); if (hexFiles.length > 0) { for (String hexFile : hexFiles) { hexFilesList.add(hexFile); } } else { hexFilesList.add(this.m_HexFilePath); }
retStatus = this.ipeLibrary.loadHexFile(hexFilesList, false); if (retStatus == 1) { this.sharedData.printScreen("IPECMD.DBG_WARNING_CONT"); } } else { ArrayList<String> hexFilesListx = new ArrayList<>(); String[] hexFilesx = this.m_HexFilePath.split(";"); if (hexFilesx.length > 0) { for (String hexFile : hexFilesx) { hexFilesListx.add(hexFile); } } else { hexFilesListx.add(this.m_HexFilePath); }
retStatus = this.ipeLibrary.loadHexFile(hexFilesListx, true); }
if (retStatus == -1) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_HEXFILE"), CommandCodes.FILE_OPEN_ERROR); return false; }
if (this.activeToolSelection.equalsIgnoreCase("PM3") && !this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET) && !this.BigA && !this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) && imageTransferToPM3) { this.sharedData.IPEPrint("Transfering image to PM3..."); boolean retTransferImageStatus = this.ipeLibrary.transferImageToPM3(); if (!retTransferImageStatus) { this.sharedData.quitAndSendErrorCode("Unable to Transfer the Image", CommandCodes.OPFAILURE); return false; } } }
return retVal; }
private boolean showToolList() { boolean retVal = true; if (this.displayToolList) { this.connectedToolList = this.ipeLibrary.queryToolList(); this.displayToolList(); this.sharedData.quitAndSendErrorCode("", CommandCodes.OP_MISC); return false; } else { return retVal; } }
private boolean processToolAndCreateDebuggerSession() { String retToolValue = ""; boolean retVal = true; if (this.activeToolSelected) { if (this.m_SnoSelected) { retToolValue = this.getFullToolIdentifierBySno(this.activeToolSerialNo); if (retToolValue.equals("")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NO_SNO_EXIST"), CommandCodes.INVALID_CMDLINE_ARG); return false; }
this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.SEL_TOOL_SNO") + this.activeToolSerialNo); } else { int count = this.getNoOfToolConnected(this.activeToolSelection); if (count > 1 && this.jar_flag && !this.activeToolSelection.equalsIgnoreCase("pm5pa")) { this.displayToolList(); this.sharedData.IPEPrint("More than one " + this.activeToolSelection + " is connected"); this.sharedData.IPEPrint("Please enter your choice:"); int choice = 0;
try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String retInput = br.readLine(); if (!this.sharedData.isNumeric(retInput)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"), CommandCodes.INVALID_CMDLINE_ARG); return false; }
choice = Integer.parseInt(retInput); } catch (IOException var7) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"), CommandCodes.INVALID_CMDLINE_ARG); return false; }
retToolValue = this.getFullToolIdentifierByID(choice - 1); if (retToolValue.equals("")) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.INV_INPUT")); } } else { if (!this.isSerialcom && count > 1 && this.exe_flag) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.MUTIPLETOOL"), CommandCodes.INVALID_CMDLINE_ARG); return false; }
if (!this.isSerialcom && this.exe_flag && this.activeToolSelection.compareToIgnoreCase("PM3") == 0) { retToolValue = "PM3 S.No : None (VID 04D8, PID A001)"; } else { retToolValue = this.getFullToolIdentifierName(this.activeToolSelection); if (retToolValue.equals("")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NO_PRM_EXIST"), CommandCodes.INVALID_PROGRAMMER); return false; } } } } }
if (retToolValue.compareToIgnoreCase("") != 0) { if (this.isSerialcom) { retToolValue = "PM3 COM" + this.serialport; boolean retDbgVal = this.ipeLibrary.createDebuggerSession(retToolValue); if (!retDbgVal) { this.sharedData .quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.COM_OPEN_ERROR") + " " + this.serialport, CommandCodes.COM_OPEN_ERROR); return false; } } else { boolean retDbgVal = this.ipeLibrary.createDebuggerSession(retToolValue); if (!retDbgVal) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.DBG_SESSION_FAILED"), CommandCodes.OPFAILURE); return false; } }
return retVal; } else { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.DBG_SESSION_FAILED"), CommandCodes.OPFAILURE); return false; } }
private void batchModeOperation() { try { this.bRedoFlag = false; if (this.isOperationFlagSet(CommandCodes.BATCH_PROCESSING)) { this.lPassCount++; this.sharedData.IPEPrint("\nBatch Mode Count : " + this.lPassCount); this.sharedData.IPEPrint("\n\nBatch Mode: Press Enter to repeat the same operation ! Enter (quit) or (q) to abort the operation"); Scanner scanner = new Scanner(System.in); String readString = scanner.nextLine(); if (readString.equals("")) { this.bRedoFlag = true; } else if (!readString.equalsIgnoreCase("q") && !readString.equalsIgnoreCase("quit")) { this.sharedData.setLastErrorCode(1); this.sharedData.IPEPrint("\n\nBatch Mode: Invalid entry !!! Exiting Batch Mode."); } else { this.sharedData.IPEPrint("\n\nBatch Mode: Exiting Batch Mode..."); this.sharedData.setLastErrorCode(1); this.bRedoFlag = false; } } } catch (Exception var3) { } }
private void reprogramTarget() { if (this.isOperationFlagSet(CommandCodes.REPORGRAM_MEMORY)) { this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_AllMEM_REGION_SELECTED; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_DEVICE; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ERASE_FLASH; } }
private void getPK5PTGImageList() { try { List<PtgImageInfo> pK5PTGImageList = this.ipeLibrary.getPK5PTGImageList(); if (pK5PTGImageList != null && pK5PTGImageList.isEmpty()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND"), CommandCodes.OPFAILURE); } else { List<String> headersList = new ArrayList<>(); headersList.add("Image Name"); headersList.add("Total Count"); headersList.add("Pass Count"); List<List<String>> rowsList = new ArrayList<>(); TableGenerator tableGenerator = new TableGenerator();
for (PtgImageInfo ptgInfo : pK5PTGImageList) { String imageName = ptgInfo.getImageName(); int totalProgramCount = ptgInfo.getTotalProgramCount(); int totalPassProgramCount = ptgInfo.getTotalProgramPassCount(); List<String> row = new ArrayList<>(); row.add(imageName); row.add(String.valueOf(totalProgramCount)); row.add(String.valueOf(totalPassProgramCount)); rowsList.add(row); }
this.sharedData.IPEPrint(tableGenerator.generateTable(headersList, rowsList)); } } catch (RIExceptions var11) { MPLABLogger.mplog.log(Level.INFO, "Exception ", (Throwable)var11); } }
private boolean eraseTarget() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.ERASE_FLASH)) { if (this.activeToolSelection.equalsIgnoreCase("PM3") && this.isSEESST()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NO_ERASE_FLASH_FOR_DEV"), CommandCodes.OPFAILURE); return false; }
if (!this.ipeLibrary.eraseTarget()) { if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.ERASE_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.ERASE_FAILED"), CommandCodes.OPFAILURE); return false; } }
return retVal; }
private boolean loadReprogramHexFile() { int retStatus = 0; boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.REPORGRAM_MEMORY)) { ArrayList<String> hexFilesList = new ArrayList<>(); String[] hexFiles = this.m_HexFilePath.split(";"); if (hexFiles.length > 0) { for (String hexFile : hexFiles) { hexFilesList.add(hexFile); } } else { hexFilesList.add(this.m_HexFilePath); }
retStatus = this.ipeLibrary.loadHexFile(hexFilesList, false); if (retStatus == -1) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_HEXFILE"), CommandCodes.FILE_OPEN_ERROR); return false; }
if (retStatus == 1) { if (!this.isOperationFlagSet(CommandCodes.NOCLEAR_DEBUG_BIT)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.DBG_WARNING"), CommandCodes.OPFAILURE); return false; }
this.sharedData.printScreen("IPECMD.DBG_WARNING_CONT"); } }
return retVal; }
public boolean checkBasicOperationForConnect() { boolean retVal = false; if (this.activeToolSelection.equalsIgnoreCase("PM3")) { retVal = true; } else { if (this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) || this.isOperationFlagSet(CommandCodes.READ_TARGET) || this.isOperationFlagSet(CommandCodes.ERASE_FLASH) || this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE) || this.isOperationFlagSet(CommandCodes.BLANK_CHECK_DEVICE)) { if (( this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") ) && this.isOperationFlagSet(CommandCodes.PTG_SUPPORT)) { return false; }
return true; }
if (this.isOperationFlagSet(CommandCodes.JUST_CONNECT)) { return true; }
if (this.isDeviceIDInfo()) { return true; } }
return retVal; }
private boolean programTarget() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { if (this.isOperationFlagSet(CommandCodes.PROGRAM_MEMORY_RANGE)) { if (this.m_PgmMemSpecificRangeStartAddress.length() == 0) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("program"); this.m_PgmMemSpecificRangeStartAddress = ((Long)memRange.first).toString(); }
this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); this.sharedData.setCoreParameters("memories.programmemory.start", this.m_PgmMemSpecificRangeStartAddress); Pair<Boolean, String> resp1 = this.ipeLibrary.isValidpgmStartAddress(this.m_PgmMemSpecificRangeStartAddress); Pair<Boolean, String> resp2 = this.ipeLibrary.isValidpgmEndAddress(this.m_PgmMemSpecificRangeEndAddress); if (!(Boolean)resp1.first) { this.sharedData.quitAndSendErrorCode((String)resp1.second, CommandCodes.OPFAILURE); return false; }
if (!(Boolean)resp2.first) { this.sharedData.quitAndSendErrorCode((String)resp2.second, CommandCodes.OPFAILURE); return false; }
this.sharedData.setCoreParameters("memories.programmemory.end", this.m_PgmMemSpecificRangeEndAddress); }
if (!this.ipeLibrary.programTarget()) { if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.PGRM_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.PGRM_FAILED"), CommandCodes.OPFAILURE); return false; }
this.programSuccessUpdate(); if (!this.UpdateSQTPFileIfProgramSuccess()) { return false; } } else if (this.sharedData.getJtagArgNotUsedFlag()) { retVal = false; this.sharedData.setLastErrorCode(CommandCodes.OPFAILURE); }
return retVal; }
private void programSuccessUpdate() { String tool = ""; if (this.activeToolSelection.equalsIgnoreCase("PM3")) { tool = "PM3"; }
if (this.activeToolSelection.equalsIgnoreCase("RICE")) { tool = "REALICE"; }
if (this.activeToolSelection.equalsIgnoreCase("PK3")) { tool = "PICKIT3"; }
if (this.activeToolSelection.equalsIgnoreCase("ICD3")) { tool = "ICD3"; }
if (this.activeToolSelection.equalsIgnoreCase("ICD4")) { tool = "ICD4"; }
if (this.activeToolSelection.equalsIgnoreCase("ICD5")) { tool = "ICD5"; }
if (this.activeToolSelection.equalsIgnoreCase("ICE4")) { tool = "ICE4"; }
if (this.activeToolSelection.equalsIgnoreCase("SNAP")) { tool = "SNAP"; }
if (this.activeToolSelection.equalsIgnoreCase("AICE")) { tool = "AICE"; }
if (this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { tool = "PICKITBASIC"; }
this.sharedData.IPEPrint(tool + " Program Report"); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd, HH:mm:ss"); Date date = new Date(); this.sharedData.IPEPrint(dateFormat.format(date)); this.sharedData.IPEPrint("Device Type:" + this.ipeLibrary.getXPICDeviceInfo().getName()); this.sharedData.IPEPrint("Program Succeeded."); }
private boolean readTarget() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.READ_TARGET)) { retVal = this.readEntireTarget(); }
if (this.isOperationFlagSet(CommandCodes.READ_INTO_HEX)) { if (this.isOperationFlagSet(CommandCodes.PROGRAM_MEMORY_RANGE)) { if (this.readProgramMemoryRange()) { retVal = this.readTargetIntoHex(true); } else { retVal = false; } } else { retVal = this.readTargetIntoHex(false); } } else if (this.m_ReadMemorySelectionFlags != 0) { this.setReadMemoryRegionToRead(); retVal = this.readSpecificRegionFromTarget(); }
return retVal; }
private boolean readEntireTarget() { boolean retVal = true; if (this.ipeLibrary.useAllExecutableRegions()) { String range = this.ipeLibrary.getProgramMemoryRange(); this.sharedData.setCoreParameters("memories.programmemory.ranges", range); this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); }
if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { String errMsg = this.ipeLibrary.getPartitionMisMatchErrorMsg(); this.sharedData.IPEPrint(errMsg); String[] errMsgTokens = errMsg.split(" "); if (errMsgTokens[7].contains("Dual")) { this.sharedData.IPEPrint("Please use -OT to switch to dual-partition mode."); } else { this.sharedData.IPEPrint("Please remove -OT from the arguments."); }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; } else if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; } else { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; } } else { this.sharedData.IPEPrint("Read successfully."); return retVal; } }
private boolean readTargetIntoHex(boolean isRangeRead) { boolean retVal = true; if (this.ipeLibrary.useAllExecutableRegions()) { String range = this.ipeLibrary.getProgramMemoryRange(); this.sharedData.setCoreParameters("memories.programmemory.ranges", range); this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); }
if (isRangeRead) { if (!this.ipeLibrary.exportHexFile(this.m_ReadHexFilePath)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.EXPORT_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Hex file exported to : " + this.m_ReadHexFilePath); } else { if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.ipeLibrary.isDeviceCodeProtected()) { this.sharedData.IPEPrint("Device is code protected! Program memory may be invalid."); }
this.sharedData.IPEPrint("Read successfully."); if (!this.ipeLibrary.exportHexFile(this.m_ReadHexFilePath)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.EXPORT_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Hex file exported to : " + this.m_ReadHexFilePath); }
return retVal; }
private boolean readSpecificRegionFromTarget() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.READ_INTO_HEX)) { return true; } else { if (this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { if (this.setDefaultValue) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("program"); if (memRange == null) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
this.m_PgmMemRangeStartAddress = (Long)memRange.first; this.m_PgmMemRangeEndAddress = (Long)memRange.second; } else { this.sharedData.setCoreParameters("memories.programmemory.start", String.valueOf(Long.toHexString(this.m_PgmMemRangeStartAddress))); this.sharedData.setCoreParameters("memories.programmemory.end", String.valueOf(Long.toHexString(this.m_PgmMemRangeEndAddress))); }
if (!this.ipeLibrary.isValidRange(this.m_PgmMemRangeStartAddress, this.m_PgmMemRangeEndAddress, "program")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); this.sharedData.IPEPrint("Program Memory"); if (!this.memoryView.showProgramMemory(this.m_PgmMemRangeStartAddress, this.m_PgmMemRangeEndAddress)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_AUXILIARY_REGION)) { if (this.setDefaultValue) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("auxiliary"); if (memRange == null) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
this.m_AuxMemRangeStartAddress = (Long)memRange.first; this.m_AuxMemRangeEndAddress = (Long)memRange.second; }
if (!this.ipeLibrary.isValidRange(this.m_AuxMemRangeStartAddress, this.m_AuxMemRangeEndAddress, "auxiliary")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); this.sharedData.IPEPrint("Auxiliary Memory"); if (!this.memoryView.showAuxiliaryData(this.m_AuxMemRangeStartAddress, this.m_AuxMemRangeEndAddress)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION)) { if (this.setDefaultValue) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("boot"); if (memRange == null) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
this.m_bootMemRangeStartAddress = (Long)memRange.first; this.m_bootMemRangeEndAddress = (Long)memRange.second; }
if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); this.sharedData.IPEPrint("Boot Memory"); if (!this.memoryView.showBootFlashData(this.m_bootMemRangeStartAddress, this.m_bootMemRangeEndAddress)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION)) { String memType = "eeprom"; if (this.ipeLibrary.isEEMemory()) { memType = "eeprom"; } else { if (!this.ipeLibrary.isFlashData()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
memType = "flash"; }
if (this.setDefaultValue) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange(memType); if (memRange == null) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
this.m_EEMemRangeStartAddress = (Long)memRange.first; this.m_EEMemRangeEndAddress = (Long)memRange.second; } else { Family family = this.ipeLibrary.getXPICDeviceInfo().getFamily(); if (family == Family.DSPIC30 || family == Family.DSPIC33 || family == Family.PIC24) { this.m_EEMemRangeStartAddress = this.m_EEMemRangeStartAddress + (Long)this.ipeLibrary.getXPICDeviceInfo().getEEDataRange().first; this.m_EEMemRangeEndAddress = this.m_EEMemRangeEndAddress + (Long)this.ipeLibrary.getXPICDeviceInfo().getEEDataRange().first; } }
if (!this.ipeLibrary.isValidRange(this.m_EEMemRangeStartAddress, this.m_EEMemRangeEndAddress, memType) && memType.compareToIgnoreCase("eeprom") == 0) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); if (memType.compareToIgnoreCase("eeprom") == 0) { this.sharedData.IPEPrint("EEPROM Memory"); if (!this.memoryView.showEEMemory(this.m_EEMemRangeStartAddress, this.m_EEMemRangeEndAddress)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } } else if (memType.compareToIgnoreCase("flash") == 0) { this.sharedData.IPEPrint("Flash Memory"); if (!this.memoryView.showFlashData(this.m_EEMemRangeStartAddress, this.m_EEMemRangeEndAddress)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } } }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_ID_REGION)) { if (this.setDefaultValue) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("user"); if (memRange == null) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; }
this.m_PgmMemRangeStartAddress = (Long)memRange.first; this.m_PgmMemRangeEndAddress = (Long)memRange.second; }
if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); this.sharedData.IPEPrint("ID Memory"); if (!this.memoryView.showUserIDinUI()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_CFG_REGION)) { if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); this.sharedData.IPEPrint("Configuration Memory"); if (!this.memoryView.showConfigMemory(this.m_EEMemRangeStartAddress, this.m_EEMemRangeEndAddress)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; } }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_DIA)) { if (this.ipeLibrary.hasDIAMemory()) { if (!this.ipeLibrary.readTarget()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); this.sharedData.IPEPrint("Device Information Area"); if (!this.memoryView.showDIAMemory()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } } else { this.sharedData.quitAndSendErrorCode("The selected device does not contains DIA memory region.", CommandCodes.OPFAILURE); } }
return retVal; } }
private boolean readProgramMemoryRange() { String pgmMemEndAddr = ""; if (this.m_PgmMemSpecificRangeEndAddress != null) { if (!this.m_PgmMemSpecificRangeEndAddress.contains("0x") && !this.m_PgmMemSpecificRangeEndAddress.contains("0X")) { pgmMemEndAddr = this.m_PgmMemSpecificRangeEndAddress; } else { pgmMemEndAddr = this.m_PgmMemSpecificRangeEndAddress.substring(2); } }
boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.PROGRAM_MEMORY_RANGE) && this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { if (this.m_PgmMemSpecificRangeStartAddress.length() == 0) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("program"); this.m_PgmMemSpecificRangeStartAddress = ((Long)memRange.first).toString(); }
this.sharedData.setCoreParameters("memories.programmemory.start", this.m_PgmMemSpecificRangeStartAddress); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); Pair<Boolean, String> resp1 = this.ipeLibrary.isValidpgmStartAddress(this.m_PgmMemSpecificRangeStartAddress); Pair<Boolean, String> resp2 = this.ipeLibrary.isValidpgmEndAddress(this.m_PgmMemSpecificRangeEndAddress); if (!(Boolean)resp1.first) { this.sharedData.quitAndSendErrorCode((String)resp1.second, CommandCodes.OPFAILURE); return false; }
if (!(Boolean)resp2.first) { this.sharedData.quitAndSendErrorCode((String)resp2.second, CommandCodes.OPFAILURE); return false; }
this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); this.sharedData.setCoreParameters("memories.programmemory.start", this.m_PgmMemSpecificRangeStartAddress); this.sharedData.setCoreParameters("memories.programmemory.end", this.m_PgmMemSpecificRangeEndAddress); }
if (this.isOperationFlagSet(CommandCodes.PROGRAM_MEMORY_RANGE) && this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { if (this.m_PgmMemSpecificRangeStartAddress.length() == 0) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("program"); this.m_PgmMemSpecificRangeStartAddress = ((Long)memRange.first).toString(); }
this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); this.sharedData.setCoreParameters("memories.programmemory.start", this.m_PgmMemSpecificRangeStartAddress); Pair<Boolean, String> resp1x = this.ipeLibrary.isValidpgmStartAddress(this.m_PgmMemSpecificRangeStartAddress); Pair<Boolean, String> resp2x = this.ipeLibrary.isValidpgmEndAddress(this.m_PgmMemSpecificRangeEndAddress); if (!(Boolean)resp1x.first) { this.sharedData.quitAndSendErrorCode((String)resp1x.second, CommandCodes.OPFAILURE); return false; }
if (!(Boolean)resp2x.first) { this.sharedData.quitAndSendErrorCode((String)resp2x.second, CommandCodes.OPFAILURE); return false; }
this.sharedData.setCoreParameters("memories.programmemory.end", this.m_PgmMemSpecificRangeEndAddress); if (!this.ipeLibrary.readTarget()) { if (this.ipeLibrary.isPartitionMisMatch()) { this.sharedData .IPEPrint( "Operation aborted. Target device memory configuration = DUAL PARTITION. Current memory configuration = SINGLE PARTITION. Please use -OT for multi-partition devices." ); this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.READ_FAILED"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Read successfully."); if (this.displayProgMemRange) { this.sharedData.IPEPrint("Program Memory"); long startAddr = Long.parseLong(this.m_PgmMemSpecificRangeStartAddress); long endAddr = Long.parseLong(pgmMemEndAddr, 16); if (!this.memoryView.showProgramMemory(startAddr, endAddr)) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } } }
return retVal; }
private boolean verifyTarget() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE)) { if (!this.toolSupportForVerifyBlankcheck()) { this.sharedData .quitAndSendErrorCode( "Verify does not support for selected Device : " + this.m_DeviceString + " and Tool : " + this.activeToolSelection, CommandCodes.OPFAILURE ); return false; }
if (this.isOperationFlagSet(CommandCodes.PROGRAM_MEMORY_RANGE)) { if (this.m_PgmMemSpecificRangeStartAddress.length() == 0) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("program"); this.m_PgmMemSpecificRangeStartAddress = ((Long)memRange.first).toString(); }
this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); this.sharedData.setCoreParameters("memories.programmemory.start", this.m_PgmMemSpecificRangeStartAddress); Pair<Boolean, String> resp1 = this.ipeLibrary.isValidpgmStartAddress(this.m_PgmMemSpecificRangeStartAddress); Pair<Boolean, String> resp2 = this.ipeLibrary.isValidpgmEndAddress(this.m_PgmMemSpecificRangeEndAddress); if (!(Boolean)resp1.first) { this.sharedData.quitAndSendErrorCode((String)resp1.second, CommandCodes.OPFAILURE); return false; }
if (!(Boolean)resp2.first) { this.sharedData.quitAndSendErrorCode((String)resp2.second, CommandCodes.OPFAILURE); return false; }
this.sharedData.setCoreParameters("memories.programmemory.end", this.m_PgmMemSpecificRangeEndAddress); }
this.sharedData.IPEPrint(this.activeToolSelection + " Verify Report"); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd, HH:mm:ss"); Date date = new Date(); this.sharedData.IPEPrint(dateFormat.format(date)); this.sharedData.IPEPrint("Device Type:" + this.ipeLibrary.getXPICDeviceInfo().getName()); if (!this.ipeLibrary.verifyTarget()) { if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode("", this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode("", CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Verify Succeeded."); }
return retVal; }
private boolean blankCheck() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.BLANK_CHECK_DEVICE)) { if (this.isAVRSAM()) { this.sharedData.quitAndSendErrorCode("Blankcheck does not support for AVR/SAM Devices", CommandCodes.OPFAILURE); return false; }
if (this.activeToolSelection.equalsIgnoreCase("PM3") && this.isSEESST()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NO_BC_FOR_DEV"), CommandCodes.OPFAILURE); return false; }
if (!this.toolSupportForVerifyBlankcheck()) { this.sharedData .quitAndSendErrorCode( "Blankcheck does not support for selected Device : " + this.m_DeviceString + " and Tool : " + this.activeToolSelection, CommandCodes.OPFAILURE ); return false; }
if (!this.ipeLibrary.blankCheck()) { if (this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode("", this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.quitAndSendErrorCode("", CommandCodes.OPFAILURE); return false; } }
return retVal; }
private boolean isAVRSAM() { boolean ret = false; this.picdevicedb = this.ipeLibrary.getXPICDeviceInfo(); if (this.picdevicedb != null) { ret = this.picdevicedb.getFamily() == Family.ARM32BIT || this.picdevicedb.getFamily() == Family.AVR; }
return ret; }
private boolean isSEESST() { boolean ret = false; this.picdevicedb = this.ipeLibrary.getXPICDeviceInfo(); if (this.picdevicedb != null) { ret = this.picdevicedb.getFamily() == Family.SST || this.picdevicedb.getFamily() == Family.SEE; }
return ret; }
private void setTargetPower() { if (this.exe_flag) { if (this.activeToolSelection.equalsIgnoreCase("PM3") && !this.isOperationFlagSet(CommandCodes.POWERUP_TARGET)) { this.sharedData.setCoreParameters("poweroptions.powerenable", "true"); } else if (( this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") ) && this.isOperationFlagSet(CommandCodes.POWERUP_TARGET)) { this.sharedData.setCoreParameters("poweroptions.powerenable", "true"); } else { this.sharedData.setCoreParameters("poweroptions.powerenable", "false"); } } else if (( this.activeToolSelection.equalsIgnoreCase("PM3") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || !this.activeToolSerialNo.isEmpty() ) && this.isOperationFlagSet(CommandCodes.POWERUP_TARGET)) { this.sharedData.setCoreParameters("poweroptions.powerenable", "true"); } else { this.sharedData.setCoreParameters("poweroptions.powerenable", "false"); } }
private void setEraseAllb4Pgm() { if (this.isOperationFlagSet(CommandCodes.ERASE_BEFORE_PROGRAM)) { this.sharedData.setCoreParameters("programoptions.eraseb4program", "false"); } else { this.sharedData.setCoreParameters("programoptions.eraseb4program", "true"); } }
private void disableBluetoothforPk5() { if (this.isOperationFlagSet(CommandCodes.SPECIAL_SETTING)) { if (this.isSPLMemorySettingFlagSet(CommandCodes.PK5_DISBLE_BT)) { this.sharedData.setCoreParameters("bluetoothsetting", "off"); } else { this.sharedData.setCoreParameters("bluetoothsetting", this.sharedData.getCoreParameters().getProperty("bluetoothsetting", "do.not.change")); } } }
private void setPTGImage() { String ptgDirectoryPath = ""; if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT)) { String wd = System.getProperty("user.home"); File ptgDirectory = new File(wd + "/PTG"); if (!ptgDirectory.exists()) { if (ptgDirectory.mkdir()) { ptgDirectoryPath = ptgDirectory.getAbsolutePath(); } } else { ptgDirectoryPath = ptgDirectory.getAbsolutePath(); }
this.sharedData.setCoreParameters("programmerToGoFilePath", ptgDirectoryPath.replace("\\", "/") + "/" + this.ptgImage); if (this.activeToolSelection.equalsIgnoreCase("PK3")) { this.sharedData.setCoreParameters("programmertogo.imagename", this.ptgImage); } else if (this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5")) { if (this.isOperationFlagSet(CommandCodes.SENDIMAGEPTG)) { this.sharedData.setCoreParameters("ptgSendImage", "true"); this.sharedData.setCoreParameters("ptgProgramImage", "false"); } else if (this.isOperationFlagSet(CommandCodes.PROGRAMDEVICEPTG)) { this.sharedData.setCoreParameters("ptgSendImage", "true"); this.sharedData.setCoreParameters("ptgProgramImage", "true"); } } } }
private void setCalibrationData() { if (this.isOperationFlagSet(CommandCodes.CALIBRATION_MEMORY)) { this.sharedData.setCoreParameters("programoptions.programcalmem", "true"); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("program"); Long addrs = (Long)memRange.second - 1L; int bytesPW = (int)this.ipeLibrary.getXPICDeviceInfo().getMemTraits().getCodeWordTraits().getWordSize(); byte[] dataBytes = new byte[bytesPW];
for (int y = 0; y < bytesPW; y++) { dataBytes[y] = (byte)(this.calibration_data & 255L); this.calibration_data >>= 8; }
this.ipeLibrary.setCalibrationdatatoMemory(addrs, bytesPW, dataBytes); } }
private void setSerialPort(String serialport) { if (this.isSerialcom && !serialport.equals("5")) { this.sharedData.setCoreParameters("com.port", "true"); this.sharedData.setCoreParameters("COM", "COM" + serialport); } else { this.sharedData.setCoreParameters("com.port", "false"); } }
private void setUserSelectedMemoryRegions() { if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT)) { if (this.m_MemorySelection == 0) { this.sharedData.setCoreParameters("AutoSelectMemRanges", "auto"); this.sharedData.setCoreParameters("memories.programmemory", "true"); this.sharedData.setCoreParameters("memories.eeprom", "true"); this.sharedData.setCoreParameters("memories.id", "true"); this.sharedData.setCoreParameters("memories.configurationmemory", "true"); this.sharedData.setCoreParameters("memories.bootflash", "false"); this.sharedData.setCoreParameters("memories.aux", "false"); } else { this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); this.sharedData.setCoreParameters("memories.programmemory", "false"); this.sharedData.setCoreParameters("memories.eeprom", "false"); this.sharedData.setCoreParameters("memories.id", "false"); this.sharedData.setCoreParameters("memories.configurationmemory", "false"); this.sharedData.setCoreParameters("memories.bootflash", "false"); this.sharedData.setCoreParameters("memories.aux", "false"); }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.sharedData.setCoreParameters("memories.programmemory", "true"); }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION)) { this.sharedData.setCoreParameters("memories.eeprom", "true"); }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_ID_REGION)) { this.sharedData.setCoreParameters("memories.id", "true"); }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_CFG_REGION)) { this.sharedData.setCoreParameters("memories.configurationmemory", "true"); }
this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); } }
private boolean setVoltageSpecificProperties() { if (this.isOperationFlagSet(CommandCodes.LOW_VOLTAGE_PROGRAM) && this.isOperationFlagSet(CommandCodes.HIGH_VOLTAGE_MCLR)) { this.sharedData .quitAndSendErrorCode("Invalid input, both switches are mutually exclusive, so use only one switch to set voltage property", CommandCodes.OPFAILURE); return false; } else { if (this.isGen4PM3ToolSelected()) { if (this.ipeLibrary.hasHighVoltageMCLR()) { this.sharedData.setCoreParameters("programoptions.pgmentry.voltage", "high"); } else { this.sharedData.setCoreParameters("programoptions.pgmentry.voltage", "low"); } } else { if (this.ipeLibrary.hasLVP()) { this.sharedData.setCoreParameters("programoptions.uselvpprogramming", "true"); } else { this.sharedData.setCoreParameters("programoptions.uselvpprogramming", "false"); }
if (this.ipeLibrary.hasHighVoltageMCLR()) { this.sharedData.setCoreParameters("programoptions.usehighvoltageonmclr", "true"); } else { this.sharedData.setCoreParameters("programoptions.usehighvoltageonmclr", "false"); }
if (this.ipeLibrary.hasLVP() && this.ipeLibrary.hasHighVoltageMCLR() && !this.isOperationFlagSet(CommandCodes.LOW_VOLTAGE_PROGRAM) && !this.isOperationFlagSet(CommandCodes.HIGH_VOLTAGE_MCLR)) { this.sharedData.setCoreParameters("programoptions.usehighvoltageonmclr", "true"); this.sharedData.setCoreParameters("programoptions.uselvpprogramming", "false"); } }
if (this.isOperationFlagSet(CommandCodes.HIGH_VOLTAGE_MCLR)) { if (this.isGen4PM3ToolSelected()) { if (this.ipeLibrary.hasHighVoltageMCLR()) { this.sharedData.setCoreParameters("programoptions.pgmentry.voltage", "high"); } } else if (this.ipeLibrary.hasHighVoltageMCLR()) { this.sharedData.setCoreParameters("programoptions.usehighvoltageonmclr", "true"); this.sharedData.setCoreParameters("programoptions.uselvpprogramming", "false"); } }
if (this.isOperationFlagSet(CommandCodes.LOW_VOLTAGE_PROGRAM)) { if (this.isGen4PM3ToolSelected()) { if (this.ipeLibrary.hasHighVoltageMCLR()) { this.sharedData.setCoreParameters("programoptions.pgmentry.voltage", "low"); } } else if (this.ipeLibrary.hasLVP()) { this.sharedData.setCoreParameters("programoptions.uselvpprogramming", "true"); this.sharedData.setCoreParameters("programoptions.usehighvoltageonmclr", "false"); } }
return true; } }
private boolean isGen4PM3ToolSelected() { boolean isGen4Tool = false; if (this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKOB4") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("PM3")) { isGen4Tool = true; }
return isGen4Tool; }
private boolean toolSupportForVerifyBlankcheck() { String toolID = null; toolID = this.ipeLibrary.GetPlatformMeta().getID(); return !toolID.isEmpty() ? !toolID.equalsIgnoreCase(ToolType.NEdbg.getToolId()) : false; }
private void setDebugBitFlag() { if (this.isOperationFlagSet(CommandCodes.NOCLEAR_DEBUG_BIT)) { this.ipeLibrary.setDebugBitFlag(true); } else { this.ipeLibrary.setDebugBitFlag(false); } }
private boolean getMemoryChecksum() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.DISPLAY_CHECKSUM)) { String retCSM = this.ipeLibrary.getChecksum(); if (retCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NOSUPPORT_CSM_DISP"), CommandCodes.OPFAILURE); return false; }
this.sharedData.IPEPrint("Checksum = " + retCSM); }
if (this.isOperationFlagSet(CommandCodes.CRC32_CHECKSUM)) { File hexPath = new File(this.m_HexFilePath); if (hexPath.exists()) { String retCSM = this.ipeLibrary.getcrc32FileChecksum(hexPath); if (retCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.printScreen("IPECMD.NOSUPPORT_CSM"); } else { this.sharedData.IPEPrint("CRC32 = " + retCSM); } } }
return retVal; }
private boolean hasChecksum() { boolean bHasChecksum = false;
try { if (this.ipeLibrary.hasChecksum()) { this.sharedData.IPEPrint("Legacy Checksum Support = Yes"); bHasChecksum = true; } else { this.sharedData.IPEPrint("Legacy Checksum Support = No"); bHasChecksum = false; } } catch (Exception var3) { MPLABLogger.mplog.log(Level.INFO, var3.toString()); }
return bHasChecksum; }
private boolean getBufferChecksumOperation() { boolean retVal = true;
try { Map<MemoryRegion, Long> bufferChecksums = this.ipeLibrary.getBufferChecksum(); if (bufferChecksums != null && !bufferChecksums.isEmpty()) { this.sharedData.IPEPrint("Buffer Checksum:");
for (Entry<MemoryRegion, Long> entry : bufferChecksums.entrySet()) { String regionName = entry.getKey().toString(); Long checksumValue = entry.getValue(); this.sharedData.IPEPrint(" " + regionName + " = 0x" + Long.toHexString(checksumValue).toUpperCase()); } } else { this.sharedData.IPEPrint("Buffer Checksum: N/A"); retVal = false; } } catch (Exception var7) { MPLABLogger.mplog.log(Level.INFO, "Error getting buffer checksum: " + var7.toString()); this.sharedData.IPEPrint("Buffer Checksum: Error - " + var7.getMessage()); retVal = false; }
return retVal; }
private void setVDDFirst() { if (this.isOperationFlagSet(CommandCodes.VDD_FIRST)) { this.sharedData.setCoreParameters("programoptions.testmodeentrymethod", "VDDFirst"); } else { this.sharedData.setCoreParameters("programoptions.testmodeentrymethod", "VPPFirst"); } }
private void setOTPProgrammingForCECSupport() { if (this.isOTPPgmmingSupport(CommandCodes.OTP_CECDEVICE)) { this.ipeLibrary.setOTPForCECDevice(true); } }
private boolean setOTPProgramMode() { boolean retVal = true; this.sharedData.setCoreParameters("programoptions.programuserotp", "false"); if (this.isOperationFlagSet(CommandCodes.SPECIAL_SETTING) && this.isSPLMemorySettingFlagSet(CommandCodes.SPL_MEM_USER_OTP) && this.ipeLibrary != null) { if (this.ipeLibrary.isATDeviceInAssembly()) { this.sharedData.quitAndSendErrorCode("OTP not supported for AVR/SAM", CommandCodes.OPFAILURE); retVal = false; } else if (this.ipeLibrary.getXPICDeviceInfo().getMainPartition().hasUserOTP()) { this.sharedData.setCoreParameters("programoptions.programuserotp", "true"); } else { this.sharedData.quitAndSendErrorCode("OTP not supported for this device", CommandCodes.OPFAILURE); retVal = false; } }
return retVal; }
private boolean setOTPConfigFuseProgramMode() { boolean retVal = false; boolean hasOTPFuseConfig = false; this.sharedData.setCoreParameters("programoptions.program.otpconfig", "false"); if (this.isOperationFlagSet(CommandCodes.SPECIAL_SETTING) && this.isSPLMemorySettingFlagSet(CommandCodes.SPL_OTP_FUSE_CONFIG) && this.ipeLibrary != null) { this.picdevicedb = this.ipeLibrary.getXPICDeviceInfo(); if (Optional.ofNullable(this.picdevicedb).isPresent() && this.picdevicedb.getMainPartition().hasDCR()) { hasOTPFuseConfig = this.picdevicedb.getMainPartition().getDCRRegions().stream().map(xRegion::new).anyMatch(Region::isOTP); if (hasOTPFuseConfig) { this.sharedData.setCoreParameters("programoptions.program.otpconfig", "true"); retVal = true; } else { this.sharedData.quitAndSendErrorCode("OTP fuse bit configuration not supported for the selected device", CommandCodes.OPFAILURE); retVal = false; } } }
return retVal; }
private boolean getCPOffChecksum() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.SPECIAL_SETTING) && this.isSPLMemorySettingFlagSet(CommandCodes.SPL_CP_OFF_CSM) && this.ipeLibrary != null) { if (this.ipeLibrary.isATDeviceInAssembly()) { this.sharedData.quitAndSendErrorCode("CP OFF Checksum is not supported for AVR/SAM", CommandCodes.OPFAILURE); retVal = false; } else { String retCPOFFCSM = this.ipeLibrary.getUnprotectedCsum(); if (retCPOFFCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NOSUPPORT_CSM"), CommandCodes.OPFAILURE); retVal = false; } else { this.sharedData.IPEPrint("CP=OFF Checksum: " + retCPOFFCSM); } } }
return retVal; }
private boolean isDeviceIDInfo() { boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.DEVICE_ID_READ) && !this.activeToolSelection.equalsIgnoreCase("PM3")) { retVal = true; }
return retVal; }
private void setLogFileInfo() { String[] tmpLoggingLevels = new String[]{"OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST"}; if (this.isOperationFlagSet(CommandCodes.SPECIAL_SETTING) && this.isSPLMemorySettingFlagSet(CommandCodes.SPL_LOGFILE)) { int logPos = Character.getNumericValue(this.m_LogLevel); String newValue = tmpLoggingLevels[logPos]; MPLABLogger.setLogFileName(this.m_LogFilePath); if ("OFF".equals(newValue)) { MPLABLogger.setLogLevel(Level.OFF); }
if ("SEVERE".equals(newValue)) { MPLABLogger.setLogLevel(Level.SEVERE); }
if ("WARNING".equals(newValue)) { MPLABLogger.setLogLevel(Level.WARNING); }
if ("INFO".equals(newValue)) { MPLABLogger.setLogLevel(Level.INFO); }
if ("CONFIG".equals(newValue)) { MPLABLogger.mplog.setLevel(Level.CONFIG); }
if ("FINE".equals(newValue)) { MPLABLogger.setLogLevel(Level.FINE); }
if ("FINER".equals(newValue)) { MPLABLogger.setLogLevel(Level.FINER); }
if ("FINEST".equals(newValue)) { MPLABLogger.setLogLevel(Level.FINEST); } } }
private boolean setAVRSpecificSettings() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.COMMUNICATION_SUPPORT) && this.ipeLibrary != null) { if (this.activeToolSelection.equalsIgnoreCase("J32") && this.ipeLibrary.isAVRDeviceInAssembly()) { this.sharedData.quitAndSendErrorCode("The selected device and tool combination does not support, invalid input", CommandCodes.OPFAILURE); retVal = false; } else if (!this.ipeLibrary.isATDeviceInAssembly() && !this.ipeLibrary.isPIC32DeviceInAssembly()) { this.sharedData .quitAndSendErrorCode("The selected device and tool combination does not support communication interface, invalid input", CommandCodes.OPFAILURE); retVal = false; } else { if (!this.activeToolSelection.equalsIgnoreCase("ICD4") && !this.activeToolSelection.equalsIgnoreCase("ICD5") && !this.activeToolSelection.equalsIgnoreCase("ICE4") && !this.activeToolSelection.equalsIgnoreCase("PK4") && !this.activeToolSelection.equalsIgnoreCase("PK5") && !this.activeToolSelection.equalsIgnoreCase("SNAP") && !this.activeToolSelection.equalsIgnoreCase("AICE") && !this.activeToolSelection.equalsIgnoreCase("Edbg") && !this.activeToolSelection.equalsIgnoreCase("MEdbg") && !this.activeToolSelection.equalsIgnoreCase("NEdbg") && !this.activeToolSelection.equalsIgnoreCase("J32") && !this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.sharedData.quitAndSendErrorCode("AVR/SAM supported tool not found", CommandCodes.OPFAILURE); } else { if (this.isAVRSettingFlagSet(CommandCodes.AT_INTERFACE)) { if (this.ipeLibrary.isPIC32DeviceInAssembly() && this.activeToolSelection.equalsIgnoreCase("J32")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INVALID_J32INTERFACE"), CommandCodes.OPFAILURE); retVal = false; } else { this.sharedData.setCoreParameters("communication.interface", this.m_Commn_interface); } }
if (this.isAVRSettingFlagSet(CommandCodes.AT_SPEED)) { if (this.activeToolSelection.equalsIgnoreCase("J32")) { if (this.ipeLibrary.isARMDeviceInAssembly()) { this.m_CommSpeedValue = "4"; } else { this.m_CommSpeedValue = "12"; } }
this.sharedData.setCoreParameters("communication.speed", this.m_CommSpeedValue); }
if (this.isJTAGComnFlagSet(CommandCodes.JTAG_INTERFACE)) { if (this.activeToolSelection.equalsIgnoreCase("J32")) { if (this.ipeLibrary.isARMDeviceInAssembly() && this.m_JTAG_interface.contains("2wire")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INVALID_J32INTERFACE"), CommandCodes.OPFAILURE); retVal = false; }
this.sharedData.setCoreParameters("communication.interface", this.m_JTAG_interface); } else { this.sharedData.setCoreParameters("communication.interface.jtag", this.m_JTAG_interface); } }
if (this.isHighVoltageActivationSet(CommandCodes.AT_NOHV)) { this.sharedData.setCoreParameters("communication.activationmode", this.m_AVRHighVoltageActivationValue); }
if (this.isHighVoltageActivationSet(CommandCodes.AT_SimpleHV)) { this.sharedData.setCoreParameters("communication.activationmode", this.m_AVRHighVoltageActivationValue); }
if (this.isHighVoltageActivationSet(CommandCodes.AT_UserPowerToggle)) { this.sharedData.setCoreParameters("communication.activationmode", this.m_AVRHighVoltageActivationValue); }
if (this.isChipErase_FlagSet(CommandCodes.CHIPERASE_KEY)) { if (this.ipeLibrary.getPythonFileStatus()) { this.sharedData.setCoreParameters("x.erase.key", this.m_ChipEraseDefaultKey); retVal = true; } else { this.sharedData.quitAndSendErrorCode("The selected device and tool combination does not support Chip Erase Key", CommandCodes.OPFAILURE); retVal = false; } }
if (this.isChipErase_FlagSet(CommandCodes.CHIPERASE_TYPE)) { if (this.ipeLibrary.getPythonFileStatus()) { this.sharedData.setCoreParameters("x.erase.type", this.m_ChipEraseType); retVal = true; } else { this.sharedData.quitAndSendErrorCode("The selected device and tool combination does not support Chip Erase Type", CommandCodes.OPFAILURE); retVal = false; } }
if (this.isOperationFlagSet(CommandCodes.DEVICE_ACTIONS)) { if (this.ipeLibrary.getPythonFileStatus()) { if (this.m_DeviceActions.isEmpty()) { this.listDeviceActions(); this.sharedData.setLastErrorCode(CommandCodes.OP_MISC); retVal = false; } else if (!this.validateDeviceActions(this.m_DeviceActions)) { this.sharedData.quitAndSendErrorCode("Invalid Device Action Input ", CommandCodes.OPFAILURE); retVal = false; } } else { this.sharedData.quitAndSendErrorCode("The selected device and tool combination does not support Device Actions", CommandCodes.OPFAILURE); retVal = false; } }
if (this.isOperationFlagSet(CommandCodes.RESET_BEFORE_AFTER_PROGRAM)) { if (this.ipeLibrary.isARMDeviceInAssembly() || this.ipeLibrary.isPIC32DeviceInAssembly()) { this.sharedData.setCoreParameters("programoptions.resetafterprogram", "false"); retVal = true; } } else { this.sharedData.setCoreParameters("programoptions.resetafterprogram", "true"); } }
this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); if (this.ipeLibrary.getPythonFileStatus()) { this.ipeLibrary.runner.put("settings", new MapWithDefaults(this.sharedData.getCoreParameters())); } } }
return retVal; }
private void setICD4_or_PK4_Setting() { if (this.isOperationFlagSet(CommandCodes.ICD4_PK4_SETTIING)) { if (!this.activeToolSelection.equalsIgnoreCase("ICD4") && !this.activeToolSelection.equalsIgnoreCase("ICD5") && !this.activeToolSelection.equalsIgnoreCase("ICE4") && !this.activeToolSelection.equalsIgnoreCase("PK4") && !this.activeToolSelection.equalsIgnoreCase("PK5") && !this.activeToolSelection.equalsIgnoreCase("SNAP") && !this.activeToolSelection.equalsIgnoreCase("PKBASIC") && !this.activeToolSelection.equalsIgnoreCase("PKOB4")) { this.sharedData.quitAndSendErrorCode("Programmer not found", CommandCodes.OPFAILURE); } else { if (this.isICD4_or_PK4_FlagSet(CommandCodes.ICD4_PK4_SPEED)) { this.sharedData.setCoreParameters("programoptions.pgmspeed", this.m_ICD4_or_PK4_Speed); }
if (this.isICD4_or_PK4_FlagSet(CommandCodes.ICD4_PK4_LED)) { this.sharedData.setCoreParameters("programoptions.ledbrightness", this.m_ICD4_or_PK4_LEDBrightnessValue); }
if (this.isICD4_or_PK4_FlagSet(CommandCodes.ICD4_PK4_PGC)) { this.sharedData.setCoreParameters("programoptions.pgcconfig", this.m_ICD4_or_PK4_PGC); }
if (this.isICD4_or_PK4_FlagSet(CommandCodes.ICD4_PK4_PGD)) { this.sharedData.setCoreParameters("programoptions.pgdconfig", this.m_ICD4_or_PK4_PGD); }
if (this.isICD4_or_PK4_FlagSet(CommandCodes.ICD4_PK4_PGCV)) { this.sharedData.setCoreParameters("programoptions.pgcresistor.value", this.m_ICD4_or_PK4_PGCValue); }
if (this.isICD4_or_PK4_FlagSet(CommandCodes.ICD4_PK4_PGDV)) { this.sharedData.setCoreParameters("programoptions.pgdresistor.value", this.m_ICD4_or_PK4_PGDValue); } } } }
private void setDefaultVerifyDeviceIDB4Program() { this.sharedData.setCoreParameters("programoptions.deviceidcheck", "true"); }
private void setVDDMin() { if (this.isOperationFlagSet(CommandCodes.VDD_MIN)) { this.sharedData.setCoreParameters("poweroptions.vddnom.value", this.m_vddMinVoltage); } }
private void setVDDMax() { if (this.isOperationFlagSet(CommandCodes.VDD_MAX)) { this.sharedData.setCoreParameters("poweroptions.vddapp.value", this.m_vddMaxVoltage); } }
private void setVPPVoltage() { if (this.isOperationFlagSet(CommandCodes.VPP)) { this.sharedData.setCoreParameters("poweroptions.vpp.value", this.m_vppVoltage); } }
private void setVDDNominal() { if (this.isOperationFlagSet(CommandCodes.VDD_NOMINAL)) { this.sharedData.setCoreParameters("poweroptions.vddnom.value", this.m_vddNominalVoltage); } }
private void setVDDApp() { if (this.isOperationFlagSet(CommandCodes.VDD_APP)) { this.sharedData.setCoreParameters("poweroptions.vddapp.value", this.m_vddAppVoltage); } }
private void setVoltageValue() { if (this.isOperationFlagSet(CommandCodes.POWERUP_TARGET) && !this.activeToolSelection.equalsIgnoreCase("PM3")) { this.sharedData.setCoreParameters("voltagevalue", this.m_voltageValue); } }
private void setPowerCycleForTarget() { if (this.isOperationFlagSet(CommandCodes.RELEASE_FROM_RESET)) { this.ipeLibrary.ReleaseFromReset(); } else { this.ipeLibrary.HoldInReset(); } }
private boolean preserveUserIDWhileProgramming() { boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.PRESERVE_USER_ID_PROG)) { this.sharedData.setCoreParameters("programoptions.preserveuserid", "true"); }
return retVal; }
private boolean preserveEPROMWhileProgramming() { boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.PRESERVE_EPROM_PROG)) { this.sharedData.setCoreParameters("programoptions.preserveeeprom", "true"); if (this.m_PreserveEEPROMAddrRange.isEmpty()) { this.sharedData.IPEPrint("Preserve EEPROM range not provided"); return false; }
if (this.ValidateEERangeAddresses(this.m_PreserveEEPROMAddrRange)) { this.sharedData.getCoreParameters().setProperty("programoptions.preserveeeprom.ranges", this.m_PreserveEEPROMAddrRange); retVal = true; } else { retVal = false; } }
return retVal; }
private boolean preserveProgrammemory() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.PRESERVE_PROG_MEMORY)) { if (this.m_PgmMemSpecificRangeStartAddress.length() == 0 || this.m_PgmMemSpecificRangeEndAddress.length() == 0) { Pair<Long, Long> memRange = this.ipeLibrary.getMemoryRange("program"); long startAddr = (Long)memRange.first; this.m_PgmMemSpecificRangeStartAddress = "0x" + Long.toHexString(startAddr); long endAddr = (Long)memRange.second - 1L; this.m_PgmMemSpecificRangeEndAddress = "0x" + Long.toHexString(endAddr); }
this.sharedData.setCoreParameters("memories.programmemory.start", this.m_PgmMemSpecificRangeStartAddress); this.sharedData.setCoreParameters("memories.programmemory.end", this.m_PgmMemSpecificRangeEndAddress); this.sharedData .setCoreParameters("memories.programmemory.ranges", this.m_PgmMemSpecificRangeStartAddress + "-" + this.m_PgmMemSpecificRangeEndAddress); this.sharedData.setCoreParameters("programoptions.preserveprogramrange", "true"); this.sharedData.setCoreParameters("programoptions.preserveprogramrange.start", ""); this.sharedData.setCoreParameters("programoptions.preserveprogramrange.end", ""); Pair<Boolean, String> resp = this.ipeLibrary.isValidPreservepgmRangeAddresses(this.m_PreservePgmAddrRange); if (!(Boolean)resp.first) { this.sharedData.quitAndSendErrorCode((String)resp.second, CommandCodes.OPFAILURE); return false; }
this.sharedData.setCoreParameters("programoptions.preserveprogram.ranges", this.m_PreservePgmAddrRange); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); }
return retVal; }
private void manualFirmwareUpdate() { this.sharedData.setCoreParameters("ToolFirmwareOption.UseLatestFirmware", "true"); if (this.isOperationFlagSet(CommandCodes.DOWNLOAD_FIRMWARE)) { if (!this.manualFirmwarePath.equals("")) { this.sharedData.setCoreParameters("ToolFirmwareOption.UseLatestFirmware", "false"); }
this.manualFirmwarePath = this.manualFirmwarePath.replace("\\", "/"); this.sharedData.setCoreParameters("ToolFirmwareFilePath", this.manualFirmwarePath); } }
private boolean getDeviceID() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.DEVICE_ID_READ)) { if (this.isActiveToolPM3()) { String retCSM = this.ipeLibrary.getDeviceID(); if (retCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.quitAndSendErrorCode("", this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.IPEPrint(retCSM); } else { String var3 = this.ipeLibrary.getDeviceID(); } }
return retVal; }
private boolean getPM3DeviceIDRevision() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.DEVICE_IDREVISION_READ)) { if (!this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode("Device ID Revision not found", CommandCodes.OPFAILURE); return false; }
String retCSM = this.ipeLibrary.getPM3DeviceIDRevision(); if (retCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.quitAndSendErrorCode("", this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.IPEPrint("Device ID Revision= " + retCSM); }
return retVal; }
private boolean getPM3DeviceChecksum() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.DISPLAY_PM3_CHECKSUM)) { if (!this.isActiveToolPM3()) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NOSUPPORT_CSM"), CommandCodes.OPFAILURE); return false; }
String retCSM = this.ipeLibrary.getPM3DeviceChecksum(); if (retCSM.compareToIgnoreCase("N/A") == 0) { this.sharedData.quitAndSendErrorCode("", this.ipeLibrary.getPM3ErrorCode()); return false; }
this.sharedData.IPEPrint("Checksum = " + retCSM); }
return retVal; }
private boolean displaySize() { boolean retval = true; if (this.isOperationFlagSet(CommandCodes.DISPLAY_DEVICE_SIZE)) { if (this.Checkifdeviceisbig()) { this.sharedData.IPEPrint("MPLAB PM3 cannot receive complete image"); retval = false; } else { this.sharedData.IPEPrint("MPLAB PM3 can receive complete image"); retval = true; } }
return retval; }
private boolean displayHelp() { boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.DISPLAY_PM3_HELP)) { this.displayPM3Help(); this.sharedData.quitAndSendErrorCode("", CommandCodes.OP_MISC); } else if (this.isOperationFlagSet(CommandCodes.DISPLAY_TOOLS_HELP)) { this.displayOtherToolsHelp(); this.sharedData.quitAndSendErrorCode("", CommandCodes.OP_MISC); } else if (this.isOperationFlagSet(CommandCodes.DISPLAY_IPECMD_HELP)) { this.displayIpecmdHelp(); this.sharedData.quitAndSendErrorCode("", CommandCodes.OP_MISC); }
return retVal; }
private void listDFPVersion() { MPLABPackContext latestPack = PackUtils.getPackUtils().getInstalledLatestCompatibleDFP(this.m_FormatedDeviceString); if (latestPack != null) { String packName = latestPack.getName(); this.packReleases = PackUtils.getPackUtils().getInstalledCompatiblePackReleases(packName, this.m_FormatedDeviceString); this.sharedData.IPEPrint("DFP Versions for " + this.m_FormatedDeviceString + ":");
for (PackRelease installedPack : this.packReleases) { this.sharedData.IPEPrint(packName + "," + installedPack.getVersion() + "," + installedPack.getVendor()); } } else { this.sharedData .quitAndSendErrorCode("Unable to locate DFP, Please install required pack by using the Pack Manager in MPLAB X IDE/IPE", CommandCodes.OPFAILURE); } }
public boolean checkForValidDFP(String packInfo) { Map<String, String> packInfoKeyValuePair = null; String packName = ""; String packVersion = ""; String packVendor = ""; boolean isValidPackName = false; boolean isValidPackVersion = false; boolean isDFPPackValid = false; packInfoKeyValuePair = this.FetchPackInfo(packInfo); if (packInfoKeyValuePair != null && packInfoKeyValuePair.size() > 2) { packName = packInfoKeyValuePair.get("PackName"); packVersion = packInfoKeyValuePair.get("PackVersion"); packVendor = packInfoKeyValuePair.get("PackVendor"); String pName = PackUtils.getPackUtils().getInstalledLatestCompatibleDFP(this.m_FormatedDeviceString).getName(); if (pName != null && !pName.isEmpty()) { this.packReleases = PackUtils.getPackUtils().getInstalledCompatiblePackReleases(packName, this.m_FormatedDeviceString); if (pName.equalsIgnoreCase(packName)) { isValidPackName = true; }
for (PackRelease installedPack : this.packReleases) { if (installedPack.getVersion().equalsIgnoreCase(packVersion) && installedPack.getVendor().equalsIgnoreCase(packVendor)) { isValidPackVersion = true; break; } }
if (isValidPackName && isValidPackVersion) { isDFPPackValid = true; } } }
return isDFPPackValid; }
private void listToolPackVersion() { String toolID = null; toolID = this.sharedData.getPlatformToolID(this.activeToolSelection); this.finder = new ToolPackFinder(toolID, this.m_FormatedDeviceString); List<String> listOfToolPacks = this.finder.getListOfToolPacks(); if (listOfToolPacks != null && listOfToolPacks.isEmpty()) { this.sharedData.IPEPrint("No Tool Pack found"); } else { listOfToolPacks.forEach(s -> this.sharedData.IPEPrint("Tool Pack Version : " + s)); } }
public boolean checkForValidToolPack(String toolPackVersion) { boolean isValidToolPack = false; String toolID = null; toolID = this.sharedData.getPlatformToolID(this.activeToolSelection); this.finder = new ToolPackFinder(toolID, this.m_FormatedDeviceString); List<String> toolPackList = this.finder.getListOfToolPacks(); if (toolPackList != null && !toolPackList.isEmpty()) { for (int i = 0; i < toolPackList.size(); i++) { if (toolPackList.get(i).equalsIgnoreCase(toolPackVersion)) { isValidToolPack = true; break; } } }
return isValidToolPack; }
private void setMemoryRegionToProgram() { if (this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { if (this.m_MemorySelectionFlags == 0) { this.sharedData.setCoreParameters("AutoSelectMemRanges", "auto"); this.sharedData.setCoreParameters("programoptions.eraseb4program", "true"); this.sharedData.setCoreParameters("memories.programmemory", "true"); this.sharedData.setCoreParameters("memories.eeprom", "true"); this.sharedData.setCoreParameters("memories.id", "true"); this.sharedData.setCoreParameters("memories.configurationmemory", "true"); this.sharedData.setCoreParameters("memories.bootflash", "true"); this.sharedData.setCoreParameters("memories.aux", "true"); } else { this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); this.sharedData.setCoreParameters("memories.programmemory", "false"); this.sharedData.setCoreParameters("memories.eeprom", "false"); this.sharedData.setCoreParameters("memories.id", "false"); this.sharedData.setCoreParameters("memories.configurationmemory", "false"); this.sharedData.setCoreParameters("memories.bootflash", "false"); this.sharedData.setCoreParameters("memories.aux", "false"); this.sharedData.setCoreParameters("programoptions.donoteraseauxmem", "false"); this.sharedData.setCoreParameters("memories.flashdata", "false"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.sharedData.setCoreParameters("memories.programmemory", "true"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION)) { this.sharedData.setCoreParameters("memories.eeprom", "true"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_ID_REGION)) { this.sharedData.setCoreParameters("memories.id", "true"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_CFG_REGION)) { this.sharedData.setCoreParameters("memories.configurationmemory", "true"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION)) { this.sharedData.setCoreParameters("memories.bootflash", "true"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_AUXILIARY_REGION)) { this.sharedData.setCoreParameters("memories.aux", "true"); this.sharedData.setCoreParameters("programoptions.donoteraseauxmem", "true"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_FLASH_DATA)) { this.sharedData.setCoreParameters("memories.flashdata", "true"); }
if (this.isMemoryRegionFlagSet(CommandCodes.M_AllMEM_REGION_SELECTED)) { this.sharedData.setCoreParameters("memories.programmemory", "true"); this.sharedData.setCoreParameters("memories.eeprom", "true"); this.sharedData.setCoreParameters("memories.id", "true"); this.sharedData.setCoreParameters("memories.bootflash", "true"); this.sharedData.setCoreParameters("memories.configurationmemory", "true"); this.sharedData.setCoreParameters("memories.aux", "true"); }
this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); } }
private void setMemoryregionsforEnvironment() { if (this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET) && this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE)) { this.sharedData.setCoreParameters("AutoSelectMemRanges", "auto"); this.sharedData.setCoreParameters("programoptions.eraseb4program", "true"); this.sharedData.setCoreParameters("memories.programmemory", "true"); this.sharedData.setCoreParameters("memories.eeprom", "true"); this.sharedData.setCoreParameters("memories.id", "true"); this.sharedData.setCoreParameters("memories.bootflash", "true"); this.sharedData.setCoreParameters("memories.configurationmemory", "true"); this.sharedData.setCoreParameters("memories.aux", "true"); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); } }
private void setMemoryRegionToVerify() { if (this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE)) { if (this.m_VerifyMemorySelectionFlags != 0) { this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); this.sharedData.setCoreParameters("memories.programmemory", "false"); this.sharedData.setCoreParameters("memories.eeprom", "false"); this.sharedData.setCoreParameters("memories.id", "false"); this.sharedData.setCoreParameters("memories.configurationmemory", "false"); this.sharedData.setCoreParameters("memories.bootflash", "false"); this.sharedData.setCoreParameters("memories.aux", "false"); }
if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.sharedData.setCoreParameters("memories.programmemory", "true"); }
if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION)) { this.sharedData.setCoreParameters("memories.eeprom", "true"); }
if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_ID_REGION)) { this.sharedData.setCoreParameters("memories.id", "true"); }
if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_CFG_REGION)) { this.sharedData.setCoreParameters("memories.configurationmemory", "true"); }
if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION)) { this.sharedData.setCoreParameters("memories.bootflash", "true"); }
if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_AUXILIARY_REGION)) { this.sharedData.setCoreParameters("memories.aux", "true"); }
if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_AllMEM_REGION_SELECTED)) { this.sharedData.setCoreParameters("memories.programmemory", "true"); this.sharedData.setCoreParameters("memories.eeprom", "true"); this.sharedData.setCoreParameters("memories.id", "true"); this.sharedData.setCoreParameters("memories.bootflash", "true"); this.sharedData.setCoreParameters("memories.configurationmemory", "true"); this.sharedData.setCoreParameters("memories.aux", "true"); }
this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); } }
private void setReadMemoryRegionToRead() { if (this.m_ReadMemorySelectionFlags == 0) { this.sharedData.setCoreParameters("AutoSelectMemRanges", "auto"); } else { this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.sharedData.setCoreParameters("memories.programmemory", "true"); }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION)) { this.sharedData.setCoreParameters("memories.eeprom", "true"); }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_ID_REGION)) { this.sharedData.setCoreParameters("memories.id", "true"); }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_CFG_REGION)) { this.sharedData.setCoreParameters("memories.configurationmemory", "true"); }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION)) { this.sharedData.setCoreParameters("memories.bootflash", "true"); }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_AUXILIARY_REGION)) { this.sharedData.setCoreParameters("memories.aux", "true"); }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_AllMEM_REGION_SELECTED)) { this.sharedData.setCoreParameters("memories.programmemory", "true"); this.sharedData.setCoreParameters("memories.eeprom", "true"); this.sharedData.setCoreParameters("memories.id", "true"); this.sharedData.setCoreParameters("memories.bootflash", "true"); this.sharedData.setCoreParameters("memories.configurationmemory", "true"); this.sharedData.setCoreParameters("memories.aux", "true"); }
this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); }
private boolean isActiveToolPM3() { return this.activeToolSelection.compareToIgnoreCase("PM3") == 0; }
private boolean performUpdateFirmware() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.DOWNLOAD_FIRMWARE)) { retVal = this.ipeLibrary.justConnect(); }
return retVal; }
private boolean setDeviceNameFromEnvironmentFile() { boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET)) { if (!this.formatDeviceName() && !this.getDeviceNameForLoadEnv()) { this.m_FormatedDeviceString = "PIC18F4580"; }
retVal = true; }
return retVal; }
private boolean getDeviceNameForLoadEnv() { boolean retVal = false; char cmdIdentifier_2 = '-'; if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) { cmdIdentifier_2 = this.m_EnvironmentString.charAt(0); if (cmdIdentifier_2 == 'C' || cmdIdentifier_2 == 'c') { String extType = this.sharedData.getExtention(this.m_EnvironmentString.substring(1)); if (extType == null || extType.compareToIgnoreCase("pm3") != 0 && extType.compareToIgnoreCase("pen") != 0) { int start = this.m_EnvironmentString.substring(1).replace("\\", "/").lastIndexOf(47); String fileName = this.m_EnvironmentString.substring(1).substring(start + 1); this.envFile = new File(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pm3"); if (this.envFile.exists()) { this.m_FormatedDeviceString = this.ipeLibrary.getDeviceNameInEnv(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pm3"); } else if (!this.exe_flag) { this.envFile = new File(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pen"); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
this.m_FormatedDeviceString = this.ipeLibrary.getDeviceNameInEnv(this.m_EnvironmentString.substring(1) + "/" + fileName + ".pen"); } } else { this.m_FormatedDeviceString = this.ipeLibrary.getDeviceNameInEnv(this.m_EnvironmentString.substring(1)); }
if (this.m_FormatedDeviceString.equals("")) { this.sharedData.quitAndSendErrorCode("", CommandCodes.OPFAILURE); return false; }
retVal = true; } }
return retVal; }
private boolean checkLoadEnvironmentEnabled() { boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET) && this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) { retVal = true; }
return retVal; }
private boolean checkEnvironmentConflict() { boolean ErrorCode = true; if (this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET)) { if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE)) { if (this.m_DeviceString.length() == 0) { this.parseErrorMsg = "Could not find device."; ErrorCode = false; }
if (!this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { this.parseErrorMsg = "A hex file must be selected when saving an environment."; ErrorCode = false; } } else if (!this.isEnvironmentFlagSet(CommandCodes.M_ENV_COPY) && !this.isEnvironmentFlagSet(CommandCodes.M_ENV_DELETE) && !this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD) && this.isEnvironmentFlagSet(CommandCodes.M_ENV_VIEW)) { } }
return ErrorCode; }
private String setPlatformToolID() { String toolID = ""; if (this.ipeLibrary != null && !this.activeToolSelection.isEmpty()) { String platformToolID = this.ipeLibrary.getPlatformToolIDFromActualTool(this.activeToolSelection); this.ipeLibrary.setPlatformMeta(platformToolID); toolID = this.ipeLibrary.GetPlatformMeta().getID(); this.sharedData.setCoreParameters("tool.id", toolID); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); }
return toolID; }
private boolean performEnvironmentProcess() { boolean retVal = true; char subcmdIdentifier = '-'; String m_srcEnvName = "none"; String m_dstEnvName = "none"; String m_srcPM3FilePath = null; String m_destPM3FilePath = null; retVal = this.ipeLibrary.createSQTPEnvironmentSession(); if (this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET)) { if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_COPY)) { int splitCharLoc = 0;
for (int i = 0; i < this.m_EnvironmentString.length(); i++) { if (this.m_EnvironmentString.charAt(i) == '*') { splitCharLoc = i; break; } }
m_srcPM3FilePath = this.m_EnvironmentString.substring(0, splitCharLoc); m_destPM3FilePath = this.m_EnvironmentString.substring(splitCharLoc + 1); subcmdIdentifier = m_srcPM3FilePath.charAt(0); if (subcmdIdentifier != 'C' && subcmdIdentifier != 'c') { if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { if (!this.activeToolSelection.equalsIgnoreCase("PM3")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND"), CommandCodes.OPFAILURE); return false; }
String extType = this.sharedData.getExtention(m_srcPM3FilePath); if (extType != null && extType.compareToIgnoreCase("pm3") == 0) { m_srcEnvName = m_srcPM3FilePath.substring(1); m_srcPM3FilePath = "MPLAB PM3 Card"; } else { if (extType != null && extType.compareToIgnoreCase("pen") == 0) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
this.envFile = new File(m_srcPM3FilePath); m_srcEnvName = m_srcPM3FilePath.substring(1) + "/" + m_srcPM3FilePath.substring(1) + ".pm3"; m_srcPM3FilePath = "MPLAB PM3 Card"; } } } else { String extType = this.sharedData.getExtention(m_srcPM3FilePath); if (extType != null && (extType.compareToIgnoreCase("pm3") == 0 || extType.compareToIgnoreCase("pen") == 0)) { this.envFile = new File(m_srcPM3FilePath.substring(1)); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
m_srcEnvName = m_srcPM3FilePath.substring(1); m_srcPM3FilePath = m_srcPM3FilePath.substring(1); } else { int start = m_srcPM3FilePath.substring(1).replace("\\", "/").lastIndexOf(47); String fileName = m_srcPM3FilePath.substring(1).substring(start + 1); this.envFile = new File(m_srcPM3FilePath.substring(1) + "/" + fileName + ".pm3"); if (this.envFile.exists()) { m_srcEnvName = m_srcPM3FilePath.substring(1) + "/" + fileName + ".pm3"; m_srcPM3FilePath = m_srcPM3FilePath.substring(1) + "/" + fileName + ".pm3"; } else if (!this.exe_flag) { this.envFile = new File(m_srcPM3FilePath.substring(1) + "/" + fileName + ".pen"); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
m_srcEnvName = m_srcPM3FilePath.substring(1) + "/" + fileName + ".pen"; m_srcPM3FilePath = m_srcPM3FilePath.substring(1) + "/" + fileName + ".pen"; } } }
subcmdIdentifier = m_destPM3FilePath.charAt(0); if (subcmdIdentifier != 'C' && subcmdIdentifier != 'c') { if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { if (!this.activeToolSelection.equalsIgnoreCase("PM3")) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND"), CommandCodes.OPFAILURE); return false; }
m_dstEnvName = m_destPM3FilePath.substring(1); m_destPM3FilePath = "MPLAB PM3 Card"; } } else { this.envFile = new File(m_destPM3FilePath.substring(1)); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Destination directory does not exists", CommandCodes.OPFAILURE); return false; }
m_destPM3FilePath = m_destPM3FilePath.substring(1); }
retVal = this.ipeLibrary.copyEnvironment(m_srcPM3FilePath, m_destPM3FilePath, m_srcEnvName, m_dstEnvName); } else if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) { subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (subcmdIdentifier == 'C' || subcmdIdentifier == 'c') { m_srcPM3FilePath = this.m_EnvironmentString.substring(1); String extType = this.sharedData.getExtention(m_srcPM3FilePath); if (extType != null && (extType.compareToIgnoreCase("pm3") == 0 || extType.compareToIgnoreCase("pen") == 0)) { this.envFile = new File(m_srcPM3FilePath); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
retVal = this.ipeLibrary.loadEnvironment(m_srcPM3FilePath); } else { int start = this.m_EnvironmentString.substring(1).replace("\\", "/").lastIndexOf(47); String fileName = this.m_EnvironmentString.substring(1).substring(start + 1); this.envFile = new File(m_srcPM3FilePath + "/" + fileName + ".pm3"); if (this.envFile.exists()) { retVal = this.ipeLibrary.loadEnvironment(m_srcPM3FilePath + "/" + fileName + ".pm3"); } else if (!this.exe_flag) { this.envFile = new File(m_srcPM3FilePath + "/" + fileName + ".pen"); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
retVal = this.ipeLibrary.loadEnvironment(m_srcPM3FilePath + "/" + fileName + ".pen"); } } } else if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { m_srcPM3FilePath = "MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1); retVal = this.ipeLibrary.loadEnvironment(this.pm3Path4mCard); }
if (this.activeToolSelection.equalsIgnoreCase("PM3") && !this.BigA) { boolean retTransferImageStatus = this.ipeLibrary.transferImageToPM3(); if (!retTransferImageStatus) { this.sharedData.quitAndSendErrorCode("Unable to Transfer the Image", CommandCodes.OPFAILURE); return false; } } } else if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE)) { String saveEnv_SQTPFile = ""; if (this.isOperationFlagSet(CommandCodes.SQTP_SELECTED)) { saveEnv_SQTPFile = this.m_SQTPNumFilePath; }
String extType = this.sharedData.getExtention(this.m_EnvironmentString.substring(1)); boolean isPM3 = true; if (!this.activeToolSelection.equalsIgnoreCase("PM3")) { isPM3 = false; }
if (extType == null) { }
if (extType != null) { if (extType.compareToIgnoreCase("pm3") == 0) { isPM3 = true; } else if (extType.compareToIgnoreCase("pen") == 0) { isPM3 = false; } }
m_srcPM3FilePath = this.m_EnvironmentString.substring(1); File tempLocater = new File(m_srcPM3FilePath); String folderLocation = tempLocater.getParent(); String enName; if (extType == null || extType.compareToIgnoreCase("pm3") != 0 && extType.compareToIgnoreCase("pen") != 0) { enName = tempLocater.getName(); } else { enName = this.sharedData.getFileNameOnly(tempLocater.getName()); }
if (enName == null) { }
subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (subcmdIdentifier == 'C' || subcmdIdentifier == 'c') { retVal = this.ipeLibrary.saveEnvironment(folderLocation, enName, isPM3, saveEnv_SQTPFile, this.saveEnv_MiscFile, this.saveEnv_Desc); } else if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { if (extType != null && extType.compareToIgnoreCase("pen") == 0) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NO_PENFILE"), CommandCodes.OPFAILURE); return false; }
m_srcPM3FilePath = "MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1); retVal = this.ipeLibrary.saveEnvironment(m_srcPM3FilePath, enName, isPM3, saveEnv_SQTPFile, this.saveEnv_MiscFile, this.saveEnv_Desc); } } else if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_DELETE)) { subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (subcmdIdentifier == 'C' || subcmdIdentifier == 'c') { m_srcPM3FilePath = this.m_EnvironmentString.substring(1); String extTypex = this.sharedData.getExtention(m_srcPM3FilePath); if (extTypex != null && (extTypex.compareToIgnoreCase("pm3") == 0 || extTypex.compareToIgnoreCase("pen") == 0)) { this.envFile = new File(m_srcPM3FilePath); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
retVal = this.ipeLibrary.deleteEnvironment(m_srcPM3FilePath); } else { int start = this.m_EnvironmentString.substring(1).replace("\\", "/").lastIndexOf(47); String fileName = this.m_EnvironmentString.substring(1).substring(start + 1); this.envFile = new File(m_srcPM3FilePath + "/" + fileName + ".pm3"); if (this.envFile.exists()) { retVal = this.ipeLibrary.deleteEnvironment(m_srcPM3FilePath + "/" + fileName + ".pm3"); } else if (!this.exe_flag) { this.envFile = new File(m_srcPM3FilePath + "/" + fileName + ".pen"); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
retVal = this.ipeLibrary.deleteEnvironment(m_srcPM3FilePath + "/" + fileName + ".pen"); } } } else if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { m_srcPM3FilePath = "MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1); String extTypex = this.sharedData.getExtention(m_srcPM3FilePath); if (extTypex != null && extTypex.compareToIgnoreCase("pm3") == 0) { retVal = this.ipeLibrary.deleteEnvironment(m_srcPM3FilePath); } else { if (extTypex != null && extTypex.compareToIgnoreCase("pen") == 0) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
this.envFile = new File(m_srcPM3FilePath); retVal = this.ipeLibrary.deleteEnvironment(m_srcPM3FilePath + "/" + this.envFile.getName() + ".pm3"); } } } else if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_VIEW)) { subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (subcmdIdentifier == 'C' || subcmdIdentifier == 'c') { m_srcPM3FilePath = this.m_EnvironmentString.substring(1); String extTypex = this.sharedData.getExtention(m_srcPM3FilePath); if (extTypex != null && (extTypex.compareToIgnoreCase("pm3") == 0 || extTypex.compareToIgnoreCase("pen") == 0)) { this.envFile = new File(m_srcPM3FilePath); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
retVal = this.ipeLibrary.viewEnvironment(m_srcPM3FilePath); } else { int start = this.m_EnvironmentString.substring(1).replace("\\", "/").lastIndexOf(47); String fileName = this.m_EnvironmentString.substring(1).substring(start + 1); this.envFile = new File(m_srcPM3FilePath + "/" + fileName + ".pm3"); if (this.envFile.exists()) { retVal = this.ipeLibrary.viewEnvironment(m_srcPM3FilePath + "/" + fileName + ".pm3"); } else if (!this.exe_flag) { this.envFile = new File(m_srcPM3FilePath + "/" + fileName + ".pen"); if (!this.envFile.exists()) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
retVal = this.ipeLibrary.viewEnvironment(m_srcPM3FilePath + "/" + fileName + ".pen"); } } } else if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { m_srcPM3FilePath = "MPLAB PM3 Card/" + this.m_EnvironmentString.substring(1); String extTypex = this.sharedData.getExtention(m_srcPM3FilePath); if (extTypex != null && extTypex.compareToIgnoreCase("pm3") == 0) { retVal = this.ipeLibrary.viewEnvironment(m_srcPM3FilePath); } else { if (extTypex != null && extTypex.compareToIgnoreCase("pen") == 0) { this.sharedData.quitAndSendErrorCode("Environment file does not exists", CommandCodes.OPFAILURE); return false; }
this.envFile = new File(m_srcPM3FilePath); retVal = this.ipeLibrary.viewEnvironment(m_srcPM3FilePath + "/" + this.envFile.getName() + ".pm3"); } } } }
return retVal; }
private void setSafeMode() { if (this.isOperationFlagSet(CommandCodes.SAFE_MODE)) { this.ipeLibrary.setSafeMode(this.m_SafeMode); } }
private void setPTGMode() { if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT)) { this.setPowerCycleForTarget(); if (!this.IsPTGImageFlagSet(CommandCodes.LIST_PTGIMAGES) && !this.IsPTGImageFlagSet(CommandCodes.SETACTIVE_PTGIMG) && !this.IsPTGImageFlagSet(CommandCodes.DELETE_PTGIMAGE) && !this.IsPTGImageFlagSet(CommandCodes.RESET_PTGIMG) && !this.IsPTGImageFlagSet(CommandCodes.GETACTIVE_PTGIMG) && !this.IsPTGImageFlagSet(CommandCodes.PRESS_PTG_GO) && this.ipeLibrary.connectAsPTG()) { this.sharedData.IPEPrint("Successfully saved the image to " + this.activeToolSelection + "."); } } }
private boolean checkPM3PresenceForEnvironment() { char subcmdIdentifier = '-'; char subcmdIdentifier1 = '-'; String m_srcPM3FilePath = null; String m_destPM3FilePath = null; boolean retVal = false; if (this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET)) { if (!this.isEnvironmentFlagSet(CommandCodes.M_ENV_COPY)) { if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) { return true; }
if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE)) { subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { return true; } } else if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_DELETE)) { subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { return true; } } else if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_VIEW)) { subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p') { return true; } } } else { int splitCharLoc = 0; int i = 0;
while (true) { if (i < this.m_EnvironmentString.length()) { if (this.m_EnvironmentString.charAt(i) != '*') { i++; continue; }
splitCharLoc = i; }
m_srcPM3FilePath = this.m_EnvironmentString.substring(0, splitCharLoc); m_destPM3FilePath = this.m_EnvironmentString.substring(splitCharLoc + 1); subcmdIdentifier = m_srcPM3FilePath.charAt(0); subcmdIdentifier1 = m_destPM3FilePath.charAt(0); if (subcmdIdentifier == 'P' || subcmdIdentifier == 'p' || subcmdIdentifier1 == 'P' || subcmdIdentifier1 == 'p') { return true; } break; } } }
return retVal; }
public String getDeviceNameUsingPM3file(String path) { String strDeviceName = null;
try { File pm3File = null; if (path.contains(";")) { pm3File = new File(path.split(";")[0]); } else { pm3File = new File(path); }
RandomAccessFile pm3 = new RandomAccessFile(pm3File, "rw"); pm3.seek(560L); byte[] deviceName = new byte[100]; pm3.read(deviceName); strDeviceName = new String(deviceName, "UTF-16LE"); return strDeviceName.trim(); } catch (Exception var6) { return strDeviceName; } }
public boolean runApplication(String[] args) throws IOException { boolean retValue = true; if (!this.compatabilityCheck(args)) { return false; } else { this.setLogFileInfo(); if (this.activeToolSelection.equalsIgnoreCase("PM3")) { for (int iLoop = 0; iLoop < args.length; iLoop++) { if (args[iLoop].length() == 2 && CmdSupport.getCharercterSeq(args[iLoop], 1, 2).matches("[0-9]+")) { this.serialport = CmdSupport.getCharercterSeq(args[iLoop], 1, 2); this.isSerialcom = true; }
if (args[iLoop].length() == 3) { if (CmdSupport.getCharercterSeq(args[iLoop], 1, 3).matches("[0-9]+")) { this.serialport = CmdSupport.getCharercterSeq(args[iLoop], 1, 3); this.isSerialcom = true; } } else if (args[iLoop].length() > 3 && CmdSupport.getCharercterSeq(args[iLoop], 1, 4).matches("[0-9]+")) { this.serialport = CmdSupport.getCharercterSeq(args[iLoop], 1, 4); this.isSerialcom = true; } }
if (!this.serialport.equals("")) { int serialnum = Integer.parseInt(this.serialport); if (serialnum == 5) { this.isSerialcom = false; } }
if (this.exe_flag) { if (!this.serialport.equals("")) { int serialNo = Integer.parseInt(this.serialport); if (serialNo > 5) { this.sharedData .quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + serialNo, CommandCodes.INVALID_CMDLINE_ARG); return false; } } } else if (this.jar_flag && !this.serialport.equals("")) { int serialNo = Integer.parseInt(this.serialport); if (serialNo > 255 || serialNo == 0) { this.sharedData .quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + serialNo, CommandCodes.INVALID_CMDLINE_ARG); return false; } } }
if (!this.activeToolSelection.equalsIgnoreCase("ICE4")) { this.sharedData.disableNetworkToolsProperty(); }
if (this.exe_flag && this.activeToolSelection.equalsIgnoreCase("PM3") && !this.isSerialcom) { this.ipeLibrary = new IPELibrary(true); } else if (!this.m_SerialNoExist) { this.ipeLibrary = new IPELibrary(); this.memoryView = new MemoryView(this.ipeLibrary.getDeviceInfo()); } else if (this.ipeLibrary != null) { this.memoryView = new MemoryView(this.ipeLibrary.getDeviceInfo()); }
if (!this.initializeTargetSystem()) { return false; } else { this.checkIfDeviceIsPartitioned(); if (this.ipeLibrary != null && !this.ipeLibrary.isATDeviceInAssembly() && !this.CheckVoltages()) { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; } else { if (this.Checkifdeviceisbig()) { this.BigA = true; }
if (!this.Validatefor1MBdevices()) { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; } else if (!this.CheckForConflicts()) { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; } else if (!this.CheckForCalibrationdata()) { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; } else { this.setDebugBitFlag(); if (!this.generateGoldenFiles()) { return false; } else if (!this.showToolList()) { return false; } else if (!this.displaySize()) { return false; } else { this.setVDDFirst(); this.setDefaultVerifyDeviceIDB4Program(); if (!this.setVoltageSpecificProperties()) { return false; } else { this.setVPPVoltage(); this.setVDDMin(); this.setVDDMax(); this.setVDDNominal(); this.setVDDApp(); this.setVoltageValue(); this.setTargetPower(); this.setPTGImage(); this.setUserSelectedMemoryRegions(); this.setICD4_or_PK4_Setting(); if (!this.setAVRSpecificSettings()) { return false; } else { this.setOTPProgrammingForCECSupport(); this.manualFirmwareUpdate(); if (!this.setOTPProgramMode()) { return false; } else { this.setMemoryRegionToProgram(); this.setEraseAllb4Pgm(); this.preserveEPROMWhileProgramming(); this.preserveUserIDWhileProgramming(); if (!this.preserveProgrammemory()) { return false; } else { this.disableBluetoothforPk5(); this.setSerialPort(this.serialport); this.sharedData.setCoreParameters("programoptions.commandlineutils", "true"); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); if (( !this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET) || this.isOperationFlagSet(CommandCodes.ENVIRONMENT_SET) && this.checkPM3PresenceForEnvironment() ) && !this.processToolAndCreateDebuggerSession()) { return false; } else if (!this.updatePluginBoard()) { return false; } else if (!this.loadHexFileToMemory(false)) { return false; } else if (!this.getCPOffChecksum()) { return false; } else if (!this.switchToDualPartitionMode()) { return false; } else { if (this.checkBasicOperationForConnect()) { if (!this.activeToolSelection.equalsIgnoreCase("ICE4")) { this.sharedData.disableNetworkToolsProperty(); }
if (!this.ipeLibrary.isATDeviceInAssembly()) { this.ipeLibrary.ConnectTarget(); if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.loadHexFileToMemory(true); } } }
if (!this.getDeviceNameFromPM3File()) { return false; } else { this.setCalibrationData(); this.setMemoryregionsforEnvironment(); if (!this.performEnvironmentProcess()) { this.sharedData.quitAndSendErrorCode("Environment operation failed", CommandCodes.INVALID_CMDLINE_ARG); return false; } else { this.setPTGMode(); if (!this.browsePTGImage()) { return false; } else { this.setOTPConfigFuseProgramMode(); if ("auto".equals(this.sharedData.getCoreParameters().getProperty("AutoSelectMemRanges")) && this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) { this.sharedData.setCoreParameters("AutoSelectMemRanges", "manual"); }
if (!this.isToolRequiredSwitchPresent() && this.isOperationFlagSet(CommandCodes.DISPLAY_CHECKSUM)) { if (this.getMemoryChecksum()) { this.sharedData.quitAndSendErrorCode("", CommandCodes.OPSUCCESS); return false; } else { this.sharedData.quitAndSendErrorCode("", CommandCodes.OPFAILURE); return false; } } else if (!this.getDeviceID()) { return false; } else { if (this.isChecksumSet(CommandCodes.LEGACY_CHECKSUM)) { if (!this.hasChecksum()) { this.sharedData.quitAndSendErrorCode("", CommandCodes.OP_MISC); return false; }
this.sharedData.quitAndSendErrorCode("", CommandCodes.OPSUCCESS); }
if (this.isChecksumSet(CommandCodes.BUFFER_CHECKSUM)) { if (!this.getBufferChecksumOperation()) { this.sharedData.quitAndSendErrorCode("", CommandCodes.OPFAILURE); return false; }
this.sharedData.quitAndSendErrorCode("", CommandCodes.OPSUCCESS); }
if (!this.getPM3DeviceIDRevision()) { return false; } else if (!this.performUpdateFirmware()) { return false; } else { do { if (this.bRedoFlag && this.isVerifyDeviceIDB4Program()) { String retIDVal = this.ipeLibrary.getDeviceID(); if (retIDVal.compareToIgnoreCase("") == 0) { this.sharedData.setLastErrorCode(3); return false; } }
if (this.bRedoFlag && !this.getDeviceID()) { return false; }
if (!this.ProcessSQTP()) { return false; }
if (!this.m_DeviceActions.isEmpty()) { this.SubmitDeviceAction(); }
this.reprogramTarget(); if (!this.readTarget()) { return false; }
if (!this.eraseTarget()) { return false; }
if (!this.loadReprogramHexFile()) { return false; }
if (!this.blankCheck()) { return false; }
this.setMemoryRegionToVerify(); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); if (!this.programTarget()) { return false; }
if (!this.verifyTarget()) { return false; }
if (!this.getMemoryChecksum()) { return false; }
if (!this.getPM3DeviceChecksum()) { return false; }
if (!this.listAdapters(this.paramsPm5MainSerialList)) { return false; }
if (!this.listEnvironments(this.paramsPm5MainSerialList, this.paramsAdaptersList)) { return false; }
if (!this.getActiveEnvironments(this.paramsPm5MainSerialList, this.paramsAdaptersList)) { return false; }
if (!this.getFirmwareInfo(this.paramsPm5MainSerialList, this.paramsAdaptersList)) { return false; }
if (!this.setActiveEnvironments( this.paramsPm5MainSerialList, this.paramsAdaptersList, this.pm5orPaEnvironment )) { return false; }
if (!this.deleteEnvironments( this.paramsPm5MainSerialList, this.paramsAdaptersList, this.pm5orPaEnvironment )) { return false; }
if (!this.transferEnvironment( this.paramsPm5MainSerialList, this.paramsAdaptersList, this.pm5orPaEnvironment )) { return false; }
if (!this.listPM5PgmStats(this.paramsPm5MainSerialList, this.paramsAdaptersList, this.pm5orPaEnvironment) ) { return false; }
if (!this.listPM5Units()) { return false; }
if (!this.getPM5Logs(this.paramsPm5MainSerialList)) { return false; }
if (this.ipeLibrary.isATDeviceInAssembly() && this.isOperationFlagSet(CommandCodes.JUST_CONNECT)) { this.setPowerCycleForTarget(); } else if (!this.ipeLibrary.isATDeviceInAssembly() && !this.isOperationFlagSet(CommandCodes.PTG_SUPPORT)) { this.setPowerCycleForTarget(); }
this.setSafeMode(); this.batchModeOperation(); } while (this.bRedoFlag);
if (!this.ipeLibrary.isATDeviceInAssembly()) { this.ipeLibrary.disconnectTarget(); }
return retValue; } } } } } } } } } } } } } } } }
private boolean compatabilityCheck(String[] args) { boolean retVal = true; int pCommandsCount = 0;
for (String str : args) { String arg = str.toLowerCase(); if (this.pCommands.contains(arg)) { pCommandsCount++; } }
if (pCommandsCount == 1) { this.isPM5orPACommand = true; } else if (pCommandsCount > 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.MULTIPLE_PM5_CMD"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; }
for (int iLoop = 0; iLoop < args.length; iLoop++) { String argType = CmdSupport.getCharercterSeq(args[iLoop], 0, 1); if (argType.equalsIgnoreCase("-") || argType.equalsIgnoreCase("/")) { String argActionString = CmdSupport.getCharercterSeq(args[iLoop], 1, 2); String Param = CmdSupport.getCharercterSeq(args[iLoop], 2, -1); char argAction = argActionString.charAt(0); switch (argAction) { case '?': if (Param.length() > 0) { char cmdIdentifier_3 = Param.charAt(0); switch (cmdIdentifier_3) { case 'O': case 'o': this.m_OTPPgmmingSupport = this.m_OTPPgmmingSupport | CommandCodes.OTP_CECDEVICE; break; case 'P': case 'p': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.CHECK_PARTITION; break; case 'T': case 't': String Paramn = CmdSupport.getCharercterSeq(args[iLoop], 2, -1); if (Paramn.length() > 0) { String givenToolName = Paramn.substring(1); if (!this.validateToolName(givenToolName.trim())) { this.activeToolSelected = false; this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_PROG_NAME"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; }
this.activeToolSelection = givenToolName.trim(); this.activeToolSelected = true; this.exe_flag = true; iLoop = args.length + 1; } } } break; case 'T': case 't': if (Param.length() == 0) { this.displayToolList = true; } else if (Param.length() > 0) { char cmdIdentifier_4 = Param.charAt(0); this.m_isToolMustFlag = true; switch (cmdIdentifier_4) { case 'P': case 'p': String givenToolName = Param.substring(1); if (!this.validateToolName(givenToolName)) { this.activeToolSelected = false; this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_PROG_NAME"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; }
this.activeToolSelection = givenToolName; this.activeToolSelected = true; break; case 'S': case 's': this.m_SnoSelected = true; String givenToolSno = Param.substring(1); if (givenToolSno.length() <= 0) { this.activeToolSerialNo = ""; this.activeToolSelected = false; this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_SNO_EXIST"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; }
this.activeToolSerialNo = givenToolSno; this.m_SerialNoExist = true; this.activeToolSelected = true; } } } } }
if (this.m_SerialNoExist) { this.ipeLibrary = new IPELibrary(); String retToolValue = this.getFullToolIdentifierBySno(this.activeToolSerialNo); this.activeToolSelection = this.sharedData.getShortName(retToolValue); if (this.isPM5orPACommand) { this.paramsPm5MainSerialList = Arrays.asList(this.activeToolSerialNo); } }
if (this.isPM5orPACommand && !this.activeToolSelection.equalsIgnoreCase("PM5PA") && !this.activeToolSelection.equalsIgnoreCase("PM5")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.PM5PA_OR_PM5_NOT_FOUND"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_PROGRAMMER); return false; } else { if (this.exe_flag) { if (!this.parseCommandLine_individualutilities(args)) { if (this.isMiscelleneousCommand()) { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.OP_MISC); } else { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); }
return false; } } else { this.jar_flag = true; if (!this.parseCommandLine_ipecmdjar(args)) { if (this.isMiscelleneousCommand()) { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.OP_MISC); } else { this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); }
return false; } }
return retVal; } }
private boolean parseCommandLine_individualutilities(String[] args) { boolean retValue = true; String tempRange = "";
for (int iLoop = 0; iLoop < args.length; iLoop++) { String argType = CmdSupport.getCharercterSeq(args[iLoop], 0, 1); if (argType.equalsIgnoreCase("-") || argType.equalsIgnoreCase("/")) { String argActionString = CmdSupport.getCharercterSeq(args[iLoop], 1, 2); String Param = CmdSupport.getCharercterSeq(args[iLoop], 2, -1); char argAction = argActionString.charAt(0); this.m_OperationFlags = this.m_OperationFlags | CommandCodes.HOLD_IN_RESET; switch (argAction) { case '?': if (Param.length() == 0) { if (this.exe_flag) { if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_PM3_HELP; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("PKBASIC") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("J32")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_TOOLS_HELP; } }
if (!this.displayHelp()) { return false; } } else if (Param.length() == 1) { char cmdIdentifier_5 = Param.charAt(0); switch (cmdIdentifier_5) { case 'D': case 'd': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.EXPORT_INTO_HEX; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'M': case 'm': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_DEVICE_SIZE; break; case 'X': case 'x': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.NOCLEAR_DEBUG_BIT; } } case '@': case '[': case '\\': case ']': case '^': case '_': case '`': default: break; case 'A': case 'a': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_APP; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vddAppVoltage = Param; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND " + argAction); return false; } break; case 'B': case 'b': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ENTER_ENV_PATH"); return false; }
char cmdIdentifier_6 = Param.charAt(0); this.m_EnvironmentString = Param.substring(1); switch (cmdIdentifier_6) { case 'C': case 'c': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_COPY; continue; case 'D': case 'd': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_DELETE; continue; case 'L': case 'l': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_LOAD; continue; case 'S': case 's': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_SAVE; continue; case 'V': case 'v': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_VIEW; continue; default: this.parseErrorMsg = "Unrecognized environment command"; return false; } } else { if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { if (Param.length() > 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction + Param.charAt(0) + Param.charAt(1); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.BATCH_PROCESSING; } break; } case 'C': case 'c': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.BLANK_CHECK_DEVICE; break; case 'D': case 'd': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DOWNLOAD_FIRMWARE; this.manualFirmwarePath = Param; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'E': case 'e': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ERASE_FLASH; break; case 'F': case 'f': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.TRANSFER_HEX_FILE; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_HEXFILE"); return false; }
String extType = this.sharedData.getExtention(Param); if (extType == null || extType.compareToIgnoreCase("hex") != 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_HEXFILE"); return false; }
this.m_HexFilePath = Param; break; case 'G': case 'g': this.m_isToolMustFlag = true; if (Param.length() == 0) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.READ_TARGET; } else { if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
char cmdIdentifier_7 = Param.charAt(0); switch (cmdIdentifier_7) { case 'A': case 'a': tempRange = Param.substring(1); String[] aRange = tempRange.split("-"); if (aRange.length == 2) { this.m_AuxMemRangeStartAddress = this.sharedData.hexToDecimal(aRange[0]); this.m_AuxMemRangeEndAddress = this.sharedData.hexToDecimal(aRange[1]); if (this.m_AuxMemRangeStartAddress == -1L || this.m_AuxMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; } break; case 'B': case 'b': tempRange = Param.substring(1); String[] bRange = tempRange.split("-"); if (bRange.length == 2) { this.m_bootMemRangeStartAddress = this.sharedData.hexToDecimal(bRange[0]); this.m_bootMemRangeEndAddress = this.sharedData.hexToDecimal(bRange[1]); if (this.m_bootMemRangeStartAddress == -1L || this.m_bootMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; } break; case 'C': case 'c': this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_CFG_REGION; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.READ_PARTITION_CONFIG; case 'D': case 'G': case 'H': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'd': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': default: break; case 'E': case 'e': tempRange = Param.substring(1); String[] eRange = tempRange.split("-"); if (eRange.length == 2) { this.m_EEMemRangeStartAddress = this.sharedData.hexToDecimal(eRange[0]); this.m_EEMemRangeEndAddress = this.sharedData.hexToDecimal(eRange[1]); if (this.m_EEMemRangeStartAddress == -1L || this.m_EEMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_EEDATA_REGION; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_EEDATA_REGION; } break; case 'F': case 'f': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.READ_INTO_HEX; this.m_ReadHexFilePath = Param.substring(1); break; case 'I': case 'i': this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_ID_REGION; break; case 'P': case 'p': if (this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.parseErrorMsg = "-N<range> and -GP are redundant, instead use -GP<range>."; return false; }
if (Param.charAt(0) != 'f' && Param.charAt(0) != 'F') { tempRange = Param.substring(1); String[] pRangex = tempRange.split("-"); if (pRangex.length == 2) { this.m_PgmMemRangeStartAddress = this.sharedData.hexToDecimal(pRangex[0]); this.m_PgmMemRangeEndAddress = this.sharedData.hexToDecimal(pRangex[1]); if (this.m_PgmMemRangeStartAddress == -1L || this.m_PgmMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; } continue; }
this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND"); } } break; case 'H': case 'h': this.m_isToolMustFlag = true; if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_PM3_CHECKSUM; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.HOLD_IN_RESET; } break; case 'I': case 'i': this.m_isToolMustFlag = true; if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DEVICE_ID_READ; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.HIGH_VOLTAGE_MCLR; } break; case 'J': case 'j': if (this.activeToolSelection.equalsIgnoreCase("PM3") || this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'K': case 'k': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_CHECKSUM; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'L': case 'l': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.LOW_VOLTAGE_PROGRAM; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("PKBASIC") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKOB") || this.activeToolSelection.equalsIgnoreCase("PKOB4") || this.activeToolSerialNo.contains("BUR") || this.activeToolSerialNo.contains("JIT")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.RELEASE_FROM_RESET; } break; case 'M': case 'm': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_DEVICE; if (Param.length() != 0) { if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; }
char cmdIdentifier_8 = Param.charAt(0); switch (cmdIdentifier_8) { case 'A': case 'a': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; break; case 'B': case 'b': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; break; case 'C': case 'c': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_CFG_REGION; case 'D': case 'F': case 'G': case 'H': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'd': case 'f': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': default: break; case 'E': case 'e': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_EEDATA_REGION; break; case 'I': case 'i': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_ID_REGION; break; case 'P': case 'p': if (this.isMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.parseErrorMsg = "-N<range> and -MP are redundant, instead use -MP<range>."; return false; }
this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; tempRange = Param.substring(1); String[] pRange = tempRange.split("-"); if (pRange.length == 2) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_MEMORY_RANGE; this.m_PgmMemSpecificRangeStartAddress = pRange[0]; this.m_PgmMemSpecificRangeEndAddress = pRange[1]; } } } break; case 'N': case 'n': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_MIN; if (Param.length() < 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vddMinVoltage = Param; break; } else { if (!this.activeToolSelection.equalsIgnoreCase("RICE") && !this.activeToolSelection.equalsIgnoreCase("PK3") && !this.activeToolSelection.equalsIgnoreCase("ICD3") && !this.activeToolSelection.equalsIgnoreCase("ICD4") && !this.activeToolSelection.equalsIgnoreCase("ICD5") && !this.activeToolSelection.equalsIgnoreCase("ICE4") && !this.activeToolSelection.equalsIgnoreCase("PK4") && !this.activeToolSelection.equalsIgnoreCase("PK5") && !this.activeToolSelection.equalsIgnoreCase("SNAP") && !this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { break; }
if (!this.isMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION) && !this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_MEMORY_RANGE; if (this.isOperationFlagSet(CommandCodes.READ_INTO_HEX)) { this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; }
if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ENTER_PGM_RANGE"); return false; }
tempRange = Param.substring(0); String[] pRange = tempRange.split(","); if (pRange.length <= 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_ADDRESS"); return false; }
if (pRange.length != 2) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_PgmMemSpecificRangeStartAddress = pRange[0]; this.m_PgmMemSpecificRangeEndAddress = pRange[1]; break; }
if (this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { this.parseErrorMsg = "-N<range> and -MP are redundant, instead use -MP<range>."; } else { this.parseErrorMsg = "-N<range> and -GP are redundant, instead use -GP<range>."; }
return false; } case 'O': case 'o': if (Param.length() > 0) { char cmdIdentifier_9 = Param.charAt(0); switch (cmdIdentifier_9) { case 'T': case 't': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SWITCH_TO_DUAL_PARTITION; } } break; case 'P': case 'p': Param = Param.toUpperCase(); if (Param.length() <= 0) { this.parseErrorMsg = "\n\nEnter Part name"; return false; }
this.m_DeviceString = Param; break; case 'Q': case 'q': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.sharedData.setQuitMode(true); } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'R': case 'r': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SAFE_MODE; if (Param.equalsIgnoreCase("ON")) { this.m_SafeMode = true; } else { if (!Param.equalsIgnoreCase("OFF")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.VALID_SAFEMODE"); return false; }
this.m_SafeMode = false; } } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.REPORGRAM_MEMORY; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.REPROGRAM_HEXFILENAME"); return false; }
this.m_ReprogramFilePath = Param; } break; case 'S': case 's': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SQTP_SELECTED; this.m_SQTPNumFilePath = Param; break; case 'T': case 't': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_NOMINAL; this.m_vddNominalVoltage = Param; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'U': case 'u': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { if (Param.length() <= 0) { this.parseErrorMsg = "\n\nPlease enter calibration data"; return false; }
this.calibration_data = this.sharedData.hexToDecimal(Param); if (this.calibration_data == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_CALIB"); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.CALIBRATION_MEMORY; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'V': case 'v': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VPP; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vppVoltage = Param; } else if (!this.activeToolSelection.equalsIgnoreCase("PK3") && !this.activeToolSelection.equalsIgnoreCase("ICD3") && !this.activeToolSelection.equalsIgnoreCase("ICD4") && !this.activeToolSelection.equalsIgnoreCase("ICD5") && !this.activeToolSelection.equalsIgnoreCase("ICE4") && !this.activeToolSelection.equalsIgnoreCase("PK4") && !this.activeToolSelection.equalsIgnoreCase("PK5") && !this.activeToolSelection.equalsIgnoreCase("SNAP")) { if (this.activeToolSelection.equalsIgnoreCase("RICE")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.POWER_NOTSUPPORTED_RI"); return false; } } else { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.POWERUP_TARGET; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ENTER_TARGET_POWER"); return false; }
this.m_voltageValue = Param; } break; case 'W': case 'w': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.POWERUP_TARGET; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'X': case 'x': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_MAX; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vddMaxVoltage = Param; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'Y': case 'y': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VERIFY_DEVICE; if (Param.length() != 0) { if (Param.length() != 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; }
char cmdIdentifier_10 = Param.charAt(0); switch (cmdIdentifier_10) { case 'A': case 'a': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; break; case 'B': case 'b': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; break; case 'C': case 'c': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_CFG_REGION; case 'D': case 'F': case 'G': case 'H': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'd': case 'f': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': default: break; case 'E': case 'e': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_EEDATA_REGION; break; case 'I': case 'i': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_ID_REGION; break; case 'P': case 'p': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; tempRange = Param.substring(1); String[] pRange = tempRange.split("-"); if (pRange.length == 2) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_MEMORY_RANGE; this.m_PgmMemSpecificRangeStartAddress = pRange[0]; this.m_PgmMemSpecificRangeEndAddress = pRange[1]; } } } break; case 'Z': case 'z': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PRESERVE_EPROM_PROG; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } } } }
return retValue; }
private boolean validateChipEraseSettings(String chipEraseType) { boolean retVal = false; List<String> chipErasetype = Arrays.asList("ChipEraseAll", "ChipEraseS", "ChipEraseNS"); if (chipErasetype.stream().anyMatch(i -> i.equals(chipEraseType))) { this.m_ChipEraseType = chipEraseType; retVal = true; }
return retVal; }
private boolean validateAndAssignInterfaceSettings(int type, String value) { boolean retVal = false;
try { if (type == CommandCodes.AT_INTERFACE) { List<String> jtagInterfaces = Arrays.asList("isp", "jtag", "swd", "pdi", "updi", "tpi", "hvsp", "hvpp"); if (jtagInterfaces.stream().anyMatch(i -> i.equals(value.toLowerCase()))) { this.m_Commn_interface = value.toLowerCase(); retVal = true; } }
if (type == CommandCodes.AT_SPEED) { if (this.activeToolSelection.equalsIgnoreCase("J32") && value.isEmpty()) { return true; }
if (!this.sharedData.isDouble(value)) { this.sharedData.IPEPrint("Invalid input, value must be numeric"); return false; }
this.m_CommSpeedValue = value; retVal = true; }
if (type == CommandCodes.JTAG_INTERFACE) { List<String> jtagInterfaces = Arrays.asList("2wire", "4wire"); if (jtagInterfaces.stream().anyMatch(i -> i.equals(value.toLowerCase()))) { this.m_JTAG_interface = value.toLowerCase(); retVal = true; } }
return retVal; } catch (Exception var5) { return false; } }
private boolean validateLogLevel(char level) { boolean retVal = false; int intVal = 0; intVal = Character.getNumericValue(level); if (intVal >= 0 && intVal <= 7) { retVal = true; }
return retVal; }
private boolean validateLogPath(String fPath) { return true; }
private boolean validateAndAssignICD4Settings(int type, String value) { boolean retVal = false; double tempValue = 0.0;
try { if (!this.sharedData.isDouble(value)) { this.sharedData.IPEPrint("Invalid input, value must be numeric"); return false; } else { tempValue = Double.parseDouble(value); if (type != CommandCodes.ICD4_PK4_PGC && type != CommandCodes.ICD4_PK4_PGD && type != CommandCodes.ICD4_PK4_SPEED || !(tempValue < 0.0) && !(tempValue > 2.0)) { if (type != CommandCodes.ICD4_PK4_LED || !(tempValue < 1.0) && !(tempValue > 10.0)) { if (type == CommandCodes.ICD4_PK4_PGCV) { this.m_ICD4_or_PK4_PGCValue = Double.toString(tempValue); retVal = true; } else if (type == CommandCodes.ICD4_PK4_PGDV) { this.m_ICD4_or_PK4_PGDValue = Double.toString(tempValue); retVal = true; } else if (type == CommandCodes.ICD4_PK4_PGC) { if (tempValue == 0.0) { this.m_ICD4_or_PK4_PGC = "None"; } else if (tempValue == 1.0) { this.m_ICD4_or_PK4_PGC = "Pull up"; } else if (tempValue == 2.0) { this.m_ICD4_or_PK4_PGC = "Pull down"; }
retVal = true; } else if (type == CommandCodes.ICD4_PK4_PGD) { if (tempValue == 0.0) { this.m_ICD4_or_PK4_PGD = "None"; } else if (tempValue == 1.0) { this.m_ICD4_or_PK4_PGD = "Pull up"; } else if (tempValue == 2.0) { this.m_ICD4_or_PK4_PGD = "Pull down"; }
retVal = true; } else if (type == CommandCodes.ICD4_PK4_SPEED) { if (tempValue == 0.0) { this.m_ICD4_or_PK4_Speed = "Min"; } else if (tempValue == 1.0) { this.m_ICD4_or_PK4_Speed = "Med"; } else if (tempValue == 2.0) { this.m_ICD4_or_PK4_Speed = "Max"; }
retVal = true; } else if (type == CommandCodes.ICD4_PK4_LED) { int tmpBVal = Integer.parseInt(value); this.m_ICD4_or_PK4_LEDBrightnessValue = Integer.toString(tmpBVal); retVal = true; }
return retVal; } else { this.sharedData.IPEPrint("Invalid input, LED Brightness must between 1 to 10"); return false; } } else { this.sharedData.IPEPrint("Invalid input, For PGC & PGD [0=None, 1=PullUp, 2=PullDown ] / Programming Speed [0=Minimum, 1=Medium, 2=Maximum]"); return false; } } } catch (Exception var7) { return false; } }
private boolean parseCommandLine_ipecmdjar(String[] args) { boolean tempI4Flag = false; boolean retValue = true; String tempRange = "";
for (int iLoop = 0; iLoop < args.length; iLoop++) { String argType = CmdSupport.getCharercterSeq(args[iLoop], 0, 1); if (argType.equalsIgnoreCase("-") || argType.equalsIgnoreCase("/")) { String argActionString = CmdSupport.getCharercterSeq(args[iLoop], 1, 2); String Param = CmdSupport.getCharercterSeq(args[iLoop], 2, -1); char argAction = argActionString.charAt(0); this.m_OperationFlags = this.m_OperationFlags | CommandCodes.HOLD_IN_RESET; switch (argAction) { case '?': if (Param.length() == 0) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_IPECMD_HELP; if (!this.displayHelp()) { return false; } } else if (Param.length() > 0) { char cmdIdentifier_11 = Param.charAt(0); switch (cmdIdentifier_11) { case 'D': case 'd': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.EXPORT_INTO_HEX; break; case 'L': case 'l': this.sCustomDFPDirPath = Param.substring(1); this.m_DFPSettingSupport = this.m_DFPSettingSupport | CommandCodes.CUSTOM_DFPPACK_PATH; if (this.sCustomDFPDirPath.isEmpty() || this.sharedData.isDouble(this.sCustomDFPDirPath)) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.INV_INPUT")); return false; }
System.getProperties().setProperty("packslib.packsfolder", this.sCustomDFPDirPath); break; case 'M': case 'm': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_DEVICE_SIZE; break; case 'X': case 'x': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.NOCLEAR_DEBUG_BIT; } } case '@': case '[': case '\\': case ']': case '^': case '_': case '`': default: break; case 'A': case 'a': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_APP; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vddAppVoltage = Param; } else if (!this.activeToolSelection.equalsIgnoreCase("PM5PA") && !this.activeToolSelection.equalsIgnoreCase("PM5")) { if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } } else { String var37 = Param.trim(); if (var37.isEmpty()) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_ADAPTER_SERIAL"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; }
this.paramsAdaptersList = Arrays.asList(var37.trim().split(",")); if (this.paramsAdaptersList.size() > 1 && this.activeToolSelection.equalsIgnoreCase("PM5PA")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.MULTIPLE_ADAPTER"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; } } break; case 'B': case 'b': if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ENTER_ENV_PATH"); return false; }
char subcmdIdentifier = '-'; char cmdIdentifier_12 = Param.charAt(0); this.m_EnvironmentString = Param.substring(1); subcmdIdentifier = this.m_EnvironmentString.charAt(0); if (( this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC") ) && (subcmdIdentifier == 'P' || subcmdIdentifier == 'p')) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction + cmdIdentifier_12 + subcmdIdentifier; return false; }
switch (cmdIdentifier_12) { case 'C': case 'c': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_COPY; continue; case 'D': case 'd': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_DELETE; continue; case 'L': case 'l': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_LOAD; continue; case 'S': case 's': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_SAVE; continue; case 'V': case 'v': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ENVIRONMENT_SET; this.m_EnvironmentSelectionFlags = this.m_EnvironmentSelectionFlags | CommandCodes.M_ENV_VIEW; continue; default: this.parseErrorMsg = "Unrecognized environment command"; return false; } case 'C': case 'c': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.BLANK_CHECK_DEVICE; break; case 'D': case 'd': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DOWNLOAD_FIRMWARE; this.manualFirmwarePath = Param; break; case 'E': case 'e': if (this.isPM5orPACommand && (this.activeToolSelection.equalsIgnoreCase("PM5PA") || this.activeToolSelection.equalsIgnoreCase("PM5"))) { if (Param.isEmpty()) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ENV_MISSING"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); return false; }
this.pm5orPaEnvironment = Param.trim(); } else { this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ERASE_FLASH; } break; case 'F': case 'f': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.TRANSFER_HEX_FILE; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_HEXFILE"); return false; }
String extType = this.sharedData.getExtention(Param); if (extType == null || extType.compareToIgnoreCase("hex") != 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_HEXFILE"); return false; }
this.m_HexFilePath = Param; break; case 'G': case 'g': this.m_isToolMustFlag = true; if (Param.length() == 0) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.READ_TARGET; } else { if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
char cmdIdentifier_13 = Param.charAt(0); switch (cmdIdentifier_13) { case 'A': case 'a': tempRange = Param.substring(1); String[] aRange = tempRange.split("-"); if (aRange.length == 2) { this.m_AuxMemRangeStartAddress = this.sharedData.hexToDecimal(aRange[0]); this.m_AuxMemRangeEndAddress = this.sharedData.hexToDecimal(aRange[1]); if (this.m_AuxMemRangeStartAddress == -1L || this.m_AuxMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; } break; case 'B': case 'b': tempRange = Param.substring(1); String[] bRange = tempRange.split("-"); if (bRange.length == 2) { this.m_bootMemRangeStartAddress = this.sharedData.hexToDecimal(bRange[0]); this.m_bootMemRangeEndAddress = this.sharedData.hexToDecimal(bRange[1]); if (this.m_bootMemRangeStartAddress == -1L || this.m_bootMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; } break; case 'C': case 'c': this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_CFG_REGION; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.READ_PARTITION_CONFIG; break; case 'D': case 'd': this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_DIA; break; case 'E': case 'e': tempRange = Param.substring(1); String[] eRange = tempRange.split("-"); if (eRange.length == 2) { this.m_EEMemRangeStartAddress = this.sharedData.hexToDecimal(eRange[0]); this.m_EEMemRangeEndAddress = this.sharedData.hexToDecimal(eRange[1]); if (this.m_EEMemRangeStartAddress == -1L || this.m_EEMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_EEDATA_REGION; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_EEDATA_REGION; } break; case 'F': case 'f': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.READ_INTO_HEX; this.m_ReadHexFilePath = Param.substring(1); case 'G': case 'H': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': default: break; case 'I': case 'i': this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_ID_REGION; break; case 'P': case 'p': if (this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.parseErrorMsg = "-ON<range> and -GP are redundant, instead use -GP<range>."; return false; }
if (Param.charAt(0) != 'f' && Param.charAt(0) != 'F') { tempRange = Param.substring(1); String[] pRange = tempRange.split("-"); if (pRange.length == 2) { this.m_PgmMemRangeStartAddress = this.sharedData.hexToDecimal(pRange[0]); this.m_PgmMemRangeEndAddress = this.sharedData.hexToDecimal(pRange[1]); if (this.m_PgmMemRangeStartAddress == -1L || this.m_PgmMemRangeEndAddress == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; this.displayProgMemRange = true; } else { this.setDefaultValue = true; this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; this.displayProgMemRange = true; } continue; }
this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND"); } } break; case 'H': case 'h': this.m_isToolMustFlag = true; if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_PM3_CHECKSUM; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'I': case 'i': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DEVICE_ID_READ; break; case 'J': case 'j': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.HIGH_VOLTAGE_MCLR; break; case 'K': case 'k': if (Param.length() == 0) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DISPLAY_CHECKSUM; } else { if (Param.length() < 2) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; }
String subOption = Param.substring(0, 2).toUpperCase(); if (!subOption.equals("BC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; }
this.m_ChecksumSupport = this.m_ChecksumSupport | CommandCodes.BUFFER_CHECKSUM; this.m_isToolMustFlag = true; } break; case 'L': case 'l': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.LOW_VOLTAGE_PROGRAM; break; case 'M': case 'm': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_DEVICE; if (Param.length() != 0) { if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; }
char cmdIdentifier_14 = Param.charAt(0); switch (cmdIdentifier_14) { case 'A': case 'a': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; break; case 'B': case 'b': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; break; case 'C': case 'c': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_CFG_REGION; case 'D': case 'F': case 'G': case 'H': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'd': case 'f': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': default: break; case 'E': case 'e': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_EEDATA_REGION; break; case 'I': case 'i': this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_ID_REGION; break; case 'P': case 'p': if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.parseErrorMsg = "-ON<range> and -MP are redundant, instead use -MP<range>."; return false; }
this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; tempRange = Param.substring(1); String[] range = tempRange.split("-"); if (range.length == 2) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_MEMORY_RANGE; this.m_PgmMemSpecificRangeStartAddress = range[0]; this.m_PgmMemSpecificRangeEndAddress = range[1]; } } } break; case 'N': case 'n': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_MIN; if (Param.length() < 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vddMinVoltage = Param; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'O': case 'o': if (Param.length() <= 0) { break; }
char cmdIdentifier_15 = Param.charAt(0); char hiddenIdentifier = ' '; if (Param.length() > 2) { hiddenIdentifier = Param.charAt(1); }
this.m_isToolMustFlag = true; switch (cmdIdentifier_15) { case 'A': case 'a': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ICD4_PK4_SETTIING; if (Param.length() == 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NOTVALID"); return false; }
if (Param.length() > 2) { char identifier = Param.charAt(1); String tempSettingVal = Param.substring(2); switch (identifier) { case 'A': case 'a': this.m_ICD4_or_PK4_Setting = this.m_ICD4_or_PK4_Setting | CommandCodes.ICD4_PK4_PGCV; tempI4Flag = this.validateAndAssignICD4Settings(CommandCodes.ICD4_PK4_PGCV, tempSettingVal); if (!tempI4Flag) { return false; } continue; case 'B': case 'b': this.m_ICD4_or_PK4_Setting = this.m_ICD4_or_PK4_Setting | CommandCodes.ICD4_PK4_PGDV; tempI4Flag = this.validateAndAssignICD4Settings(CommandCodes.ICD4_PK4_PGDV, tempSettingVal); if (!tempI4Flag) { return false; } continue; case 'C': case 'c': this.m_ICD4_or_PK4_Setting = this.m_ICD4_or_PK4_Setting | CommandCodes.ICD4_PK4_PGC; tempI4Flag = this.validateAndAssignICD4Settings(CommandCodes.ICD4_PK4_PGC, tempSettingVal); if (!tempI4Flag) { return false; } continue; case 'D': case 'd': this.m_ICD4_or_PK4_Setting = this.m_ICD4_or_PK4_Setting | CommandCodes.ICD4_PK4_PGD; tempI4Flag = this.validateAndAssignICD4Settings(CommandCodes.ICD4_PK4_PGD, tempSettingVal); if (!tempI4Flag) { return false; } continue; case 'L': case 'l': this.m_ICD4_or_PK4_Setting = this.m_ICD4_or_PK4_Setting | CommandCodes.ICD4_PK4_LED; tempI4Flag = this.validateAndAssignICD4Settings(CommandCodes.ICD4_PK4_LED, tempSettingVal); if (!tempI4Flag) { return false; } continue; case 'S': case 's': this.m_ICD4_or_PK4_Setting = this.m_ICD4_or_PK4_Setting | CommandCodes.ICD4_PK4_SPEED; tempI4Flag = this.validateAndAssignICD4Settings(CommandCodes.ICD4_PK4_SPEED, tempSettingVal); if (!tempI4Flag) { return false; } continue; default: this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; } } continue; case 'B': case 'b': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.BATCH_PROCESSING; continue; case 'C': case 'c': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.MEMORY_REGIONS; if (Param.length() == 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NOTVALID"); return false; }
if (Param.length() != 2) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; }
char identifier_2 = Param.charAt(1); switch (identifier_2) { case 'C': case 'c': this.m_MemorySelection = this.m_MemorySelection | CommandCodes.M_CFG_REGION; continue; case 'E': case 'e': this.m_MemorySelection = this.m_MemorySelection | CommandCodes.M_EEDATA_REGION; continue; case 'I': case 'i': this.m_MemorySelection = this.m_MemorySelection | CommandCodes.M_ID_REGION; continue; case 'P': case 'p': this.m_MemorySelection = this.m_MemorySelection | CommandCodes.M_PROGRAM_REGION; continue; default: this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; } case 'D': case 'd': if (!this.activeToolSelection.equalsIgnoreCase("PK3") && !this.activeToolSelection.equalsIgnoreCase("ICD3") && !this.activeToolSelection.equalsIgnoreCase("ICD4") && !this.activeToolSelection.equalsIgnoreCase("ICD5") && !this.activeToolSelection.equalsIgnoreCase("PK4") && !this.activeToolSelection.equalsIgnoreCase("PK5") && !this.activeToolSelection.equalsIgnoreCase("SNAP") && !this.activeToolSelection.equalsIgnoreCase("ICE4") && !this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PM3") || this.activeToolSelection.equalsIgnoreCase("AICE")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction + cmdIdentifier_15; return false; } continue; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_FIRST; continue; case 'E': case 'e': if (Param.length() == 1) { this.parseErrorMsg = "\n\nEnter Description File Name"; return false; }
this.saveEnv_Desc = Param.substring(1); case 'F': case 'O': case 'Y': case '[': case '\\': case ']': case '^': case '_': case '`': case 'f': case 'o': case 'y': default: continue; case 'G': case 'g': if (this.activeToolSelection.equalsIgnoreCase("PK3")) { if (Param.length() == 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.PROVIDE_PTGIMAGE"); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PTG_SUPPORT; this.ptgImage = Param.substring(1); } else { if (!this.activeToolSelection.equalsIgnoreCase("PK4") && !this.activeToolSelection.equalsIgnoreCase("PK5") && !this.activeToolSelection.equalsIgnoreCase("PM5PA")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction + cmdIdentifier_15; return false; }
if (Param.length() <= 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.PROVIDE_PTGIMAGE"); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PTG_SUPPORT; char identifier_3 = Param.charAt(1); if (identifier_3 != 's' && identifier_3 != 'm' && identifier_3 != 'l' && identifier_3 != 'a' && identifier_3 != 'd' && identifier_3 != 'r' && identifier_3 != 'g' && identifier_3 != 'S' && identifier_3 != 'M' && identifier_3 != 'L' && identifier_3 != 'A' && identifier_3 != 'D' && identifier_3 != 'R' && identifier_3 != 'G') { this.ptgImage = Param.substring(1); }
switch (identifier_3) { case 'A': case 'a': this.m_PTGImageName = Param.substring(2); this.m_PTGImage = this.m_PTGImage | CommandCodes.SETACTIVE_PTGIMG; case 'B': case 'C': case 'E': case 'F': case 'H': case 'I': case 'J': case 'K': case 'N': case 'O': case 'Q': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'b': case 'c': case 'e': case 'f': case 'h': case 'i': case 'j': case 'k': case 'n': case 'o': case 'q': default: continue; case 'D': case 'd': this.m_PTGImageName = Param.substring(2); this.m_PTGImage = this.m_PTGImage | CommandCodes.DELETE_PTGIMAGE; continue; case 'G': case 'g': this.m_PTGImage = this.m_PTGImage | CommandCodes.GETACTIVE_PTGIMG; continue; case 'L': case 'l': this.m_PTGImage = this.m_PTGImage | CommandCodes.LIST_PTGIMAGES; continue; case 'M': case 'm': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAMDEVICEPTG; this.ptgImage = Param.substring(2); continue; case 'P': case 'p': this.m_PTGImage = this.m_PTGImage | CommandCodes.PRESS_PTG_GO; continue; case 'R': case 'r': this.m_PTGImageName = Param.substring(2); this.m_PTGImage = this.m_PTGImage | CommandCodes.RESET_PTGIMG; continue; case 'S': case 's': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SENDIMAGEPTG; this.ptgImage = Param.substring(2); } } continue; case 'H': case 'h': if (this.activeToolSelection.isEmpty()) { this.sharedData.printScreen("IPECMD.NOTOOLS_CONNECTED"); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.ERASE_BEFORE_PROGRAM; continue; case 'I': case 'i': this.m_isToolMustFlag = true; if (Param.length() == 1) { if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DEVICE_IDREVISION_READ; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } } else if (Param.length() >= 2) { char identifier_4 = Param.charAt(1); switch (identifier_4) { case 'D': case 'd': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PRESERVE_USER_ID_PROG; } } continue; case 'J': case 'j': if (!this.activeToolSelection.equalsIgnoreCase("RICE")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.TOOL_NO_SUPPORT_FOR_JTAG") + " -" + argAction + cmdIdentifier_15; return false; }
if (!this.m_DeviceString.startsWith("32MZ") && !this.m_DeviceString.startsWith("32MX") && !this.m_DeviceString.startsWith("32WK")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NOJTAG_SUPPORT_FOR_DEVICE") + " -" + argAction + cmdIdentifier_15; return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.JTAG_SUPPORT; continue; case 'K': case 'k': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.JUST_CONNECT; continue; case 'L': case 'l': if (this.activeToolSelection.equalsIgnoreCase("PM3") || this.activeToolSelection.equalsIgnoreCase("AICE")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction + cmdIdentifier_15; return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.RELEASE_FROM_RESET; continue; case 'M': case 'm': if (Param.length() == 1) { this.parseErrorMsg = "\n\nEnter Miscellaneous File Name"; return false; }
this.saveEnv_MiscFile = Param.substring(1); continue; case 'N': case 'n': if (!this.isMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION) && !this.isReadMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION)) { this.m_MemorySelectionFlags = this.m_MemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_MEMORY_RANGE; if (this.isOperationFlagSet(CommandCodes.READ_INTO_HEX)) { this.m_ReadMemorySelectionFlags = this.m_ReadMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; }
if (Param.length() <= 0) { this.parseErrorMsg = "Enter Program Memory Range in HEX"; return false; }
tempRange = Param.substring(1); String[] range = tempRange.split(","); if (range.length <= 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_ADDRESS"); return false; }
if (range.length != 2) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_PgmMemSpecificRangeStartAddress = range[0]; this.m_PgmMemSpecificRangeEndAddress = range[1]; continue; }
if (this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { this.parseErrorMsg = "-ON<range> and -MP are redundant, instead use -MP<range>."; } else { this.parseErrorMsg = "-ON<range> and -GP are redundant, instead use -GP<range>."; }
return false; case 'P': case 'p': tempRange = Param.substring(1); String[] pRange = tempRange.split("-"); if (pRange.length != 2) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"); return false; }
this.m_PreservePgmStartAddress = pRange[0]; this.m_PreservePgmEndAddress = pRange[1]; this.m_PreservePgmAddrRange = tempRange; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PRESERVE_PROG_MEMORY; continue; case 'Q': case 'q': if (this.serverSocket == null) { this.sharedData.quitAndSendErrorCode("This switch is meant only for IPECMDBoost.", CommandCodes.INVALID_CMDLINE_ARG); return false; }
try { this.sharedData.getNotifyLock(this.sharedData.getPortNumber()); this.sharedData.deleteProcessID(this.serverSocket.getLocalPort()); this.sharedData.IPEPrint("IPEBoost instance closed at port number:" + this.sharedData.getPortNumber()); this.serverSocket.getOutputStream().close(); this.serverSocket.close(); System.exit(CommandCodes.ALL_SUCCESS); } catch (IOException var16) { this.sharedData.quitAndSendErrorCode("IOException: Something went wrong.", CommandCodes.OPFAILURE); } case 'W': case 'w': if (Param.length() >= 2) { char identifier_5 = Param.charAt(1); this.formatDeviceName(); switch (identifier_5) { case 'D': case 'd': this.packInfo = Param.substring(2); this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DFP_VERSION_SWITCH; if (this.packInfo.isEmpty()) { this.listDFPVersion(); this.sharedData.setLastErrorCode(CommandCodes.OP_MISC); return false; }
if (!this.checkForValidDFP(this.packInfo)) { this.sharedData .quitAndSendErrorCode( "Invalid DFP. Provide Pack Name,Version and Vendor separated by commas and use -OWD to list DFP version e.g. -OWD\"PIC12-16F1xxx_DFP,1.2.63,Microchip\".", CommandCodes.INVALID_CMDLINE_ARG ); return false; } continue; case 'T': case 't': if (this.activeToolSelected) { if (!this.activeToolSelection.equalsIgnoreCase("ICD4") && !this.activeToolSelection.equalsIgnoreCase("PM5PA") && !this.activeToolSelection.equalsIgnoreCase("ICD5") && !this.activeToolSelection.equalsIgnoreCase("ICE4") && !this.activeToolSelection.equalsIgnoreCase("PK4") && !this.activeToolSelection.equalsIgnoreCase("PK5") && !this.activeToolSelection.equalsIgnoreCase("PKOB4") && !this.activeToolSelection.equalsIgnoreCase("SNAP") && !this.activeToolSelection.equalsIgnoreCase("AICE") && !this.activeToolSelection.equalsIgnoreCase("EDBG") && !this.activeToolSelection.equalsIgnoreCase("MEDBG") && !this.activeToolSelection.equalsIgnoreCase("NEDBG") && !this.activeToolSelection.equalsIgnoreCase("PKBASIC") && !this.activeToolSelection.equalsIgnoreCase("J32")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.TOOLPACK_SUPPORT"); return false; }
this.toolPackVersion = Param.substring(2); this.m_OperationFlags = this.m_OperationFlags | CommandCodes.TOOL_PACK_VERSION_SWITCH; if (this.toolPackVersion.isEmpty()) { this.listToolPackVersion(); this.sharedData.setLastErrorCode(CommandCodes.OP_MISC); return false; }
if (!this.checkForValidToolPack(this.toolPackVersion)) { this.sharedData .quitAndSendErrorCode( "Invalid Tool Pack Version, use -OWT to list tool pack version e.g. -OWT1.x.xxx.", CommandCodes.INVALID_CMDLINE_ARG ); return false; } } continue; default: this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; } } continue; case 'R': case 'r': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.COMMUNICATION_SUPPORT; if (Param.length() == 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NOTVALID"); return false; }
if (Param.length() >= 2) { char identifier_6 = Param.charAt(1); String tempSettingVal = Param.substring(2); switch (identifier_6) { case 'A': case 'a': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DEVICE_ACTIONS; this.m_DeviceActions = Param.substring(2); continue; case 'B': case 'C': case 'D': case 'F': case 'G': case 'L': case 'M': case 'O': case 'P': case 'Q': case 'T': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'b': case 'c': case 'd': case 'f': case 'g': case 'l': case 'm': case 'o': case 'p': case 'q': case 't': default: this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; case 'E': case 'e': this.m_ChipEraseSupport = this.m_ChipEraseSupport | CommandCodes.CHIPERASE_TYPE; if (tempSettingVal.isEmpty()) { tempSettingVal = this.m_ChipEraseType; this.sharedData.IPEPrint("Default Chip Erase Type is selected"); }
tempI4Flag = this.validateChipEraseSettings(tempSettingVal); if (!tempI4Flag) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_CHIPERASETYPE"); return false; } continue; case 'H': case 'h': this.m_AVR_HighVoltageActivation = this.m_AVR_HighVoltageActivation | CommandCodes.AT_SimpleHV; this.m_AVRHighVoltageActivationValue = "simplepulse"; continue; case 'I': case 'i': this.m_AVRSAMSupport = this.m_AVRSAMSupport | CommandCodes.AT_INTERFACE; tempI4Flag = this.validateAndAssignInterfaceSettings(CommandCodes.AT_INTERFACE, tempSettingVal); if (!tempI4Flag) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_INTERFACE"); return false; } continue; case 'J': case 'j': this.m_JTAGComnSupport = this.m_JTAGComnSupport | CommandCodes.JTAG_INTERFACE; tempI4Flag = this.validateAndAssignInterfaceSettings(CommandCodes.JTAG_INTERFACE, tempSettingVal); if (!tempI4Flag) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_INTERFACE"); return false; } continue; case 'K': case 'k': this.m_ChipEraseSupport = this.m_ChipEraseSupport | CommandCodes.CHIPERASE_KEY; if (tempSettingVal.isEmpty()) { this.sharedData.IPEPrint("Default Chip Erase Key is being set"); } else { this.m_ChipEraseDefaultKey = tempSettingVal; } continue; case 'N': case 'n': this.m_AVR_HighVoltageActivation = this.m_AVR_HighVoltageActivation | CommandCodes.AT_NOHV; this.m_AVRHighVoltageActivationValue = "nohv"; continue; case 'R': case 'r': if (!this.activeToolSelection.equalsIgnoreCase("J32")) { this.sharedData.quitAndSendErrorCode("Tool not supported", CommandCodes.OPFAILURE); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.RESET_BEFORE_AFTER_PROGRAM; continue; case 'S': case 's': this.m_CommSpeedValue = Param.substring(2); this.m_AVRSAMSupport = this.m_AVRSAMSupport | CommandCodes.AT_SPEED; tempI4Flag = this.validateAndAssignInterfaceSettings(CommandCodes.AT_SPEED, this.m_CommSpeedValue); if (!tempI4Flag) { return false; } continue; case 'U': case 'u': this.m_AVR_HighVoltageActivation = this.m_AVR_HighVoltageActivation | CommandCodes.AT_UserPowerToggle; this.m_AVRHighVoltageActivationValue = "userpowertoggle"; } } continue; case 'S': case 's': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SPECIAL_SETTING; if (Param.length() == 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NOTVALID"); return false; }
if (Param.length() >= 2) { char identifier_7 = Param.charAt(1); switch (identifier_7) { case 'B': case 'b': if (!this.activeToolSelection.equalsIgnoreCase("pk5")) { this.sharedData.printScreen("IPECMD.TOOL_PK5_BLE_DISABLE"); return false; }
this.m_SPLSettingSupport = this.m_SPLSettingSupport | CommandCodes.PK5_DISBLE_BT; continue; case 'C': case 'c': this.m_SPLSettingSupport = this.m_SPLSettingSupport | CommandCodes.SPL_CP_OFF_CSM; continue; case 'F': case 'f': this.m_SPLSettingSupport = this.m_SPLSettingSupport | CommandCodes.SPL_OTP_FUSE_CONFIG; continue; case 'L': case 'l': this.m_SPLSettingSupport = this.m_SPLSettingSupport | CommandCodes.SPL_LOGFILE; int paramLen = Param.length(); if (paramLen <= 3) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_LOGFILE"); return false; }
if (paramLen > 3) { this.m_LogLevel = Param.charAt(2); if (!this.validateLogLevel(this.m_LogLevel)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_LOGLEVEL"); return false; }
this.m_LogFilePath = Param.substring(3); if (!this.validateLogPath(this.m_LogFilePath)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_LOGPATH"); return false; } } continue; case 'O': case 'o': this.m_SPLSettingSupport = this.m_SPLSettingSupport | CommandCodes.SPL_MEM_USER_OTP; continue; default: this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; } } continue; case 'T': case 't': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SWITCH_TO_DUAL_PARTITION; continue; case 'U': case 'u': if (Param.length() <= 0) { this.parseErrorMsg = "\n\nPlease enter calibration data"; return false; }
this.calibration_data = this.sharedData.hexToDecimal(Param.substring(1)); if (this.calibration_data == -1L) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INVALID_CALIB"); return false; }
this.m_OperationFlags = this.m_OperationFlags | CommandCodes.CALIBRATION_MEMORY; continue; case 'V': case 'v': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VERIFY_DEVICEID_B4_PROGRAM; continue; case 'X': case 'x': this.m_ChecksumSupport = this.m_ChecksumSupport | CommandCodes.LEGACY_CHECKSUM; continue; case 'Z': case 'z': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.CRC32_CHECKSUM; continue; } case 'P': case 'p': if (Param.substring(0, 2).compareToIgnoreCase("AT") != 0) { Param = Param.toUpperCase(); }
if (Param.length() <= 0) { this.parseErrorMsg = "\n\nEnter Part name"; return false; }
this.m_DeviceString = Param; break; case 'Q': case 'q': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.sharedData.setQuitMode(true); } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'R': case 'r': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SAFE_MODE; if (Param.equalsIgnoreCase("ON")) { this.m_SafeMode = true; } else { if (!Param.equalsIgnoreCase("OFF")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.VALID_SAFEMODE"); return false; }
this.m_SafeMode = false; } } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; } break; case 'S': case 's': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.SQTP_SELECTED; this.m_SQTPNumFilePath = Param; break; case 'T': case 't': if (Param.length() == 0) { this.displayToolList = true; } else if (Param.length() > 0) { char cmdIdentifier_16 = Param.charAt(0); this.m_isToolMustFlag = true; switch (cmdIdentifier_16) { case 'P': case 'p': String givenToolName = Param.substring(1); if (!this.validateToolName(givenToolName)) { this.activeToolSelected = false; this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_PROG_NAME"); return false; }
this.activeToolSelection = givenToolName; this.activeToolSelected = true; break; case 'S': case 's': this.m_SnoSelected = true; String givenToolSno = Param.substring(1); if (givenToolSno.length() <= 0) { this.activeToolSerialNo = ""; this.activeToolSelected = false; this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_SNO_EXIST"); return false; }
this.activeToolSerialNo = givenToolSno; this.activeToolSelected = true; } } break; case 'U': case 'u': switch (Param) { case "lp": case "Lp": this.isLpm5CmdActive = true; continue; case "la": case "LA": this.isLaCmdActive = true; continue; case "le": case "LE": this.isLeCmdActive = true; continue; case "gae": case "GAE": this.isGaeCmdActive = true; continue; case "gl": case "GL": this.isGetLogCmdActive = true; continue; case "sae": case "SAE": this.isSaeCmdActive = true; continue; case "de": case "DE": this.isDeCmdActive = true; continue; case "gfi": case "GFI": this.isGfiCmdActive = true; continue; case "te": case "TE": this.isTeCmdActive = true; continue; case "ps": case "PS": this.isPrgStatsCmdActive = true; default: continue; } case 'V': case 'v': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VPP; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vppVoltage = Param; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'W': case 'w': if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("AICE")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.POWER_NOTSUPPORTED_RI"); return false; }
if (this.activeToolSelection.equalsIgnoreCase("PM3") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.isEmpty() && !this.activeToolSerialNo.isEmpty()) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.POWERUP_TARGET; if (Param.length() > 0) { this.m_voltageValue = Param; } } break; case 'X': case 'x': if (this.activeToolSelection.equalsIgnoreCase("PM3")) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VDD_MAX; if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
if (!this.sharedData.isDouble(Param)) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_VOLTAGE"); return false; }
this.m_vddMaxVoltage = Param; } else if (this.activeToolSelection.equalsIgnoreCase("RICE") || this.activeToolSelection.equalsIgnoreCase("PK3") || this.activeToolSelection.equalsIgnoreCase("ICD3") || this.activeToolSelection.equalsIgnoreCase("ICD4") || this.activeToolSelection.equalsIgnoreCase("ICD5") || this.activeToolSelection.equalsIgnoreCase("ICE4") || this.activeToolSelection.equalsIgnoreCase("PK4") || this.activeToolSelection.equalsIgnoreCase("PK5") || this.activeToolSelection.equalsIgnoreCase("AICE") || this.activeToolSelection.equalsIgnoreCase("SNAP") || this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.ILLEGAL_COMMAND") + " " + argAction; return false; } break; case 'Y': case 'y': this.m_isToolMustFlag = true; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.VERIFY_DEVICE; if (Param.length() != 0) { if (Param.length() <= 0) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INV_INPUT"); return false; }
char cmdIdentifier_17 = Param.charAt(0); switch (cmdIdentifier_17) { case 'A': case 'a': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_AUXILIARY_REGION; break; case 'B': case 'b': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_BOOTFLASH_REGION; break; case 'C': case 'c': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_CFG_REGION; case 'D': case 'F': case 'G': case 'H': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case '`': case 'd': case 'f': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': default: break; case 'E': case 'e': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_EEDATA_REGION; break; case 'I': case 'i': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_ID_REGION; break; case 'P': case 'p': this.m_VerifyMemorySelectionFlags = this.m_VerifyMemorySelectionFlags | CommandCodes.M_PROGRAM_REGION; tempRange = Param.substring(1); String[] pRange = tempRange.split("-"); if (pRange.length == 2) { this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PROGRAM_MEMORY_RANGE; this.m_PgmMemSpecificRangeStartAddress = pRange[0]; this.m_PgmMemSpecificRangeEndAddress = pRange[1]; } } } break; case 'Z': case 'z': this.m_OperationFlags = this.m_OperationFlags | CommandCodes.PRESERVE_EPROM_PROG; this.m_PreserveEEPROMAddrRange = Param; } } }
return retValue; }
private void checkForDeviceDeprecationAndShowWarning(String formattedDeviceName) { if (PackUtils.getPackUtils().isDeviceDeprecated(formattedDeviceName)) { this.sharedData.IPEPrint("Warning : The selected/loaded device is deprecated but user can still continue to use it."); } }
private void checkForPackDeprecationAndShowWarning(String deviceSelected) { if (PackUtils.getPackUtils().isPackDeprecated(deviceSelected)) { String repPackName = PackUtils.getPackUtils().getReplacementForDeprecatedPack(deviceSelected); String feedBackMsg; if (repPackName.compareToIgnoreCase("NA") != 0) { feedBackMsg = "Warning: Device Pack is deprecated for " + deviceSelected + " and replacement pack is available. Please install replacement pack from MPLABX IDE Pack Manager.\nReplacement Pack Name: " + repPackName; } else { feedBackMsg = "Warning: Device Pack is deprecated for " + deviceSelected + " and no replacement pack available."; }
this.sharedData.IPEPrint(feedBackMsg); } }
/** * External hook: force a specific DFP for assembly creation. The modern * Zig front end validates the pack itself and passes * -Dprogcli.dfp=NAME,VERSION,VENDOR; CreateAssembly applies it through the * same DFP_VERSION_SWITCH path as the stock -OWD<version> switch. */ private static final String PROG_DFP_PROPERTY = "progcli.dfp";
private boolean CreateAssembly(String formatedDeviceName) { boolean retValue = false; String packName = ""; String packVersion = ""; String packVendor = ""; Properties properties = null; ToolPackRelease toolPackRelease = null;
String dfpOverride = System.getProperty(PROG_DFP_PROPERTY, "").trim(); if (!dfpOverride.isEmpty()) { this.packInfo = dfpOverride; this.m_OperationFlags = this.m_OperationFlags | CommandCodes.DFP_VERSION_SWITCH; }
try { if (!formatedDeviceName.isEmpty()) { MPLABPackContext latestPack = PackUtils.getPackUtils().getInstalledLatestCompatibleDFP(formatedDeviceName); if (latestPack == null) { this.sharedData .quitAndSendErrorCode( "Unable to locate DFP, Please install required pack by using the Pack Manager in MPLAB X IDE/IPE", CommandCodes.OPFAILURE ); return false; }
packName = latestPack.getName(); packVersion = latestPack.getVersion(); packVendor = latestPack.getVendor(); this.checkForPackDeprecationAndShowWarning(formatedDeviceName); this.checkForDeviceDeprecationAndShowWarning(formatedDeviceName); this.setPlatformToolID(); if (this.isOperationFlagSet(CommandCodes.DFP_VERSION_SWITCH)) { String[] packProperties = this.packInfo.split(","); if (packProperties != null && packProperties.length > 2) { packName = packProperties[0]; packVersion = packProperties[1]; packVendor = packProperties[2]; } }
if (this.isCustomDFPPathSet(CommandCodes.CUSTOM_DFPPACK_PATH)) { this.sharedData.IPEPrint("Custom DFP path : " + this.sCustomDFPDirPath); }
if (!this.isFakeAssemblyRequired) { this.sharedData.IPEPrint("DFP Version Used : " + packName + "," + packVersion + "," + packVendor); }
if (this.isOperationFlagSet(CommandCodes.TOOL_PACK_VERSION_SWITCH)) { this.sharedData.setCoreParameters("toolpack.updateoptions.packversion", this.toolPackVersion); this.sharedData.setCoreParameters("toolpack.updateoptions", "toolpack.updateoptions.specifictoolpack"); this.ipeLibrary.setCorePropertiesInSession(this.sharedData.getCoreParameters()); properties = this.sharedData.getCoreParameters(); toolPackRelease = this.ipeLibrary.getToolPackRelease(properties, formatedDeviceName).toolPackRelease; if (toolPackRelease == null) { this.sharedData.IPEPrint("Tool Pack set with latest version"); } }
retValue = this.ipeLibrary.createAssemblySession(formatedDeviceName, packName, packVersion, packVendor, toolPackRelease); } } catch (Exception var10) { MPLABLogger.mplog.log(Level.INFO, var10.toString()); }
return retValue; }
private boolean CheckVoltages() { boolean ErrorCode = true; float tempvolt = 0.0F; xPIC deviceInfo = null; float minVDD = 0.0F; float maxVDD = 0.0F; float vppVolt = 0.0F; float nomVDD = 0.0F; float vddApp = 0.0F; float vdd = 0.0F; deviceInfo = this.ipeLibrary.getXPICDeviceInfo(); if (deviceInfo == null) { this.parseErrorMsg = "Couldn't get device information"; ErrorCode = false; } else { minVDD = Float.valueOf(this.m_vddMinVoltage); maxVDD = Float.valueOf(this.m_vddMaxVoltage); vppVolt = Float.valueOf(this.m_vppVoltage); nomVDD = Float.valueOf(this.m_vddNominalVoltage); vddApp = Float.valueOf(this.m_vddAppVoltage); vdd = Float.valueOf(this.m_voltageValue); }
if (minVDD <= 0.0F) { minVDD = this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage(); this.m_vddMinVoltage = Float.toString(minVDD); }
if (maxVDD <= 0.0F) { maxVDD = this.ipeLibrary.getXPICDeviceInfo().getVddMaxDefaultVoltage(); this.m_vddMaxVoltage = Float.toString(maxVDD); }
if (vppVolt <= 0.0F) { vppVolt = this.ipeLibrary.getXPICDeviceInfo().getVppDefaultVoltage(); this.m_vppVoltage = Float.toString(vppVolt); }
if (nomVDD <= 0.0F) { nomVDD = this.ipeLibrary.getXPICDeviceInfo().getVddDefaultVoltage(); this.m_vddNominalVoltage = Float.toString(nomVDD); }
if (vddApp <= 0.0F) { vddApp = this.ipeLibrary.getXPICDeviceInfo().getVddDefaultVoltage(); this.m_vddAppVoltage = Float.toString(vddApp); }
if (vdd <= 0.0F) { vdd = this.ipeLibrary.getXPICDeviceInfo().getVddDefaultVoltage(); this.m_voltageValue = Float.toString(vdd); }
if (minVDD > maxVDD) { this.parseErrorMsg = "Vdd Min cannot be more than Vdd Max\n"; ErrorCode = false; }
if (minVDD < this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage()) { this.parseErrorMsg = "Vdd Min Must not be less than " + this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage() + " volts.\n"; ErrorCode = false; }
if (maxVDD > this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage()) { this.parseErrorMsg = "Vdd Max Must not be greater than " + this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage() + " volts.\n"; ErrorCode = false; }
if (vppVolt < this.ipeLibrary.getXPICDeviceInfo().getVppMinVoltage()) { this.parseErrorMsg = "Vpp must not be less than " + this.ipeLibrary.getXPICDeviceInfo().getVppMinVoltage() + " volts.\n"; ErrorCode = false; }
if (vppVolt > this.ipeLibrary.getXPICDeviceInfo().getVppMaxVoltage()) { this.parseErrorMsg = "Vpp must not be greater than " + this.ipeLibrary.getXPICDeviceInfo().getVppMaxVoltage() + " volts.\n"; ErrorCode = false; }
if (nomVDD < this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage() || nomVDD > this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage()) { this.parseErrorMsg = "VddNom must not be greater than " + this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage() + " volts, or\nless than " + this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage() + " volts\n"; ErrorCode = false; }
if (vdd < this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage() || vdd > this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage()) { this.parseErrorMsg = "Selected voltage must not be greater than " + this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage() + " volts, or\nless than " + this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage() + " volts\n"; ErrorCode = false; }
if (vddApp < this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage() || vddApp > this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage()) { this.parseErrorMsg = "VddApp must not be greater than " + this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage() + " volts, or\nless than " + this.ipeLibrary.getXPICDeviceInfo().getVddMinVoltage() + " volts\n"; ErrorCode = false; }
if (( this.isOperationFlagSet(CommandCodes.VDD_MIN) || this.isOperationFlagSet(CommandCodes.VDD_MAX) || this.isOperationFlagSet(CommandCodes.VDD_APP) || this.isOperationFlagSet(CommandCodes.VDD_NOMINAL) || this.isOperationFlagSet(CommandCodes.VPP) || this.isOperationFlagSet(CommandCodes.POWERUP_TARGET) ) && ErrorCode) { while (tempvolt < minVDD - 0.1) { tempvolt = (float)(tempvolt + 0.125); }
tempvolt = 0.0F;
while (tempvolt < maxVDD - 0.1) { tempvolt = (float)(tempvolt + 0.125); }
if (tempvolt > this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage()) { tempvolt = this.ipeLibrary.getXPICDeviceInfo().getVddMaxVoltage(); }
tempvolt = 0.0F;
while (tempvolt < vppVolt - 0.1) { tempvolt = (float)(tempvolt + 0.125); }
if (tempvolt > this.ipeLibrary.getXPICDeviceInfo().getVppMaxVoltage()) { tempvolt = this.ipeLibrary.getXPICDeviceInfo().getVppMaxVoltage(); }
tempvolt = 0.0F;
while (tempvolt < nomVDD - 0.1) { tempvolt = (float)(tempvolt + 0.125); }
if (tempvolt > tempvolt) { tempvolt = tempvolt; }
tempvolt = 0.0F;
while (tempvolt < vdd - 0.1) { tempvolt = (float)(tempvolt + 0.125); }
if (tempvolt > tempvolt) { tempvolt = tempvolt; }
tempvolt = 0.0F;
while (tempvolt < vddApp - 0.1) { tempvolt = (float)(tempvolt + 0.125); }
if (tempvolt > tempvolt) { tempvolt = tempvolt; }
this.m_vddMinVoltage = Float.toString(tempvolt); this.m_vddMaxVoltage = Float.toString(tempvolt); this.m_vddAppVoltage = Float.toString(tempvolt); this.m_vddNominalVoltage = Float.toString(tempvolt); this.m_vppVoltage = Float.toString(tempvolt); this.m_voltageValue = Float.toString(tempvolt); }
return ErrorCode; }
private boolean isCalibrationInPgmMemory() { boolean retval = false; if ((Long)this.ipeLibrary.getXPICDeviceInfo().getMainPartition().getCalibrationRange().first < (Long)this.ipeLibrary.getXPICDeviceInfo().getMainPartition().getCodeRange().second) { retval = true; } else { retval = false; }
return retval; }
private boolean CheckForCalibrationdata() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.CALIBRATION_MEMORY)) { if (this.ipeLibrary.getXPICDeviceInfo().getMainPartition().hasCalibrationMemory() && this.isCalibrationInPgmMemory()) { retVal = true; } else { this.parseErrorMsg = "Selected device does not have calibration memory in program region"; retVal = false; } }
return retVal; }
private boolean Checkifdeviceisbig() { boolean retVal = false; MemoryModel mem = (MemoryModel)this.ipeLibrary.getAssemblySession().getLookup().lookup(ProgramMemory.class); boolean isDualPartition = this.ipeLibrary.getXPICDeviceInfo().getIDOntoPartition().isEmpty(); Pair<Long, Long> memRange; WordTraits WordTraits; if (mem != null) { if (!isDualPartition) { xMemoryPartition[] XMPs = new xMemoryPartition[]{(xMemoryPartition)this.ipeLibrary.getXPICDeviceInfo().getIDOntoPartition().get("only")}; memRange = XMPs[0].getInstRange(); } else { memRange = this.ipeLibrary.getXPICDeviceInfo().getMainPartition().getCodeRange(); }
WordTraits = this.ipeLibrary.getXPICDeviceInfo().getMemTraits().getCodeWordTraits(); } else { memRange = this.ipeLibrary.getMemoryRange("eeprom"); WordTraits = this.ipeLibrary.getXPICDeviceInfo().getMemTraits().getEEDataWordTraits(); }
if (memRange == null) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.INV_MEMRANGE_ENTER"), CommandCodes.OPFAILURE); return false; } else { this.m_BigpgmMemRangeStartAddress = (Long)memRange.first; this.m_BigpgmMemRangeEndAddress = (Long)memRange.second; byte bytesPerAddr = (byte)(WordTraits.getWordSize() / WordTraits.getAddrInc()); int Size = (int)((this.m_BigpgmMemRangeEndAddress - this.m_BigpgmMemRangeStartAddress) * bytesPerAddr); if (Size >= 1048576) { Family family = this.ipeLibrary.getXPICDeviceInfo().getFamily(); if (Size == 1048576 && family == Family.SEE) { retVal = false; } else { retVal = true; } }
return retVal; } }
private boolean Validatefor1MBdevices() { boolean Code = true; if (this.BigA && this.activeToolSelection.compareToIgnoreCase("PM3") == 0 && this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE) && !this.isOperationFlagSet(CommandCodes.READ_TARGET) && !this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) && !this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE) && !this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE) && !this.isOperationFlagSet(CommandCodes.SQTP_SELECTED) && !this.isOperationFlagSet(CommandCodes.DISPLAY_CHECKSUM)) { this.parseErrorMsg = "Cannot transfer image for devices with memory size 1 MB and more.\n"; Code = false; }
if (this.BigA && this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) && !this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE) && !this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD)) { this.parseErrorMsg = "programming must be used in conjunction with transfer of a hex file for devices with memory size more than 1 MB\n"; Code = false; }
return Code; }
private boolean CheckForConflicts() { boolean ErrorCode = true; if (!this.activeToolSelected) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.NO_PRM_EXIST"), CommandCodes.INVALID_PROGRAMMER); ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.REPORGRAM_MEMORY) && !this.isOperationFlagSet(CommandCodes.READ_INTO_HEX)) { this.parseErrorMsg = "Reprogram should be used in conjunction with Read Function, use -GF<path>"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.CRC32_CHECKSUM) && !this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { this.parseErrorMsg = "Please specify a hex file for CRC32"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.CALIBRATION_MEMORY) && !this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { this.parseErrorMsg = "Please specify a hex file along with overwrite calibration data flag"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.CALIBRATION_MEMORY) && !this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { this.parseErrorMsg = "Overwrite calibration data flag should be used in conjunction with the program command"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.REPORGRAM_MEMORY)) { File reprogramFile = new File(this.m_ReprogramFilePath); if (!reprogramFile.exists()) { this.parseErrorMsg = "Reprogram Hex File not found"; ErrorCode = false; } }
if (this.isOperationFlagSet(CommandCodes.SQTP_SELECTED) && this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { File sqtpFile = new File(this.m_SQTPNumFilePath); if (!sqtpFile.exists()) { this.parseErrorMsg = "SQTP File not found"; ErrorCode = false; } }
if (this.isOperationFlagSet(CommandCodes.SQTP_SELECTED) && this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE)) { this.parseErrorMsg = "SQTP should not be used in conjunction with Verify operation"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { String[] hexFiles = this.m_HexFilePath.split(";"); if (hexFiles.length > 0) { for (String hexFile : hexFiles) { File file = new File(hexFile); if (!file.exists()) { this.parseErrorMsg = "Hex File not found"; break; } } } else { File hexFilex = new File(this.m_HexFilePath); if (!hexFilex.exists()) { this.parseErrorMsg = "Hex File not found"; ErrorCode = false; } } }
if (this.isOperationFlagSet(CommandCodes.SQTP_SELECTED)) { File sqtpFile = new File(this.m_SQTPNumFilePath); if (!sqtpFile.exists()) { this.parseErrorMsg = "SQTP File not found"; ErrorCode = false; } }
if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT) && (this.isOperationFlagSet(CommandCodes.SENDIMAGEPTG) || this.isOperationFlagSet(CommandCodes.PROGRAMDEVICEPTG)) && !this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { this.parseErrorMsg = "No Hex file specified to transfer"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT) && this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { this.parseErrorMsg = "Cannot perform program in conjunction with PTG mode"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.MEMORY_REGIONS) && (!this.isOperationFlagSet(CommandCodes.PTG_SUPPORT) || this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE))) { this.parseErrorMsg = "Selection of memory regions(/OC) should be used only in conjunction with PTG(/OG)"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT) && this.activeToolSelection.equalsIgnoreCase("PK3") && this.ipeLibrary.getXPICDeviceInfo().getSubFamily().equals(SubFamily.PIC32MZ)) { this.parseErrorMsg = "PTG is not supported for PIC32MZ devices"; ErrorCode = false; }
if (!this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD) && this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) && !this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE) && this.activeToolSelection.compareToIgnoreCase("PM3") != 0) { this.parseErrorMsg = "No Hex file specified to Program"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE) && !this.isOperationFlagSet(CommandCodes.TRANSFER_HEX_FILE)) { this.parseErrorMsg = "No Hex file specified to Verify"; ErrorCode = false; }
if (this.isOperationFlagSet(CommandCodes.LOW_VOLTAGE_PROGRAM) && !this.ipeLibrary.hasLVP()) { this.parseErrorMsg = "Command line argument 'L' is not supported for this device.\n"; ErrorCode = false; }
if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD) && this.m_DeviceString.length() != 0) { this.parseErrorMsg = "A device cannot be selected when loading an environment.\n"; ErrorCode = false; }
if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD) && ( this.isOperationFlagSet(CommandCodes.VDD_APP) || this.isOperationFlagSet(CommandCodes.VDD_NOMINAL) || this.isOperationFlagSet(CommandCodes.VDD_MIN) || this.isOperationFlagSet(CommandCodes.VPP) || this.isOperationFlagSet(CommandCodes.VDD_MAX) )) { this.parseErrorMsg = "Voltages cannot be selected when an environment is loaded.\n"; ErrorCode = false; }
if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_LOAD) && this.isOperationFlagSet(CommandCodes.SQTP_SELECTED)) { this.parseErrorMsg = "An SQTP file cannot be selected when an environment is loaded.\n"; ErrorCode = false; }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_PROGRAM_REGION) && !this.ipeLibrary.isProgramMemory()) { this.parseErrorMsg = "Selected device does not contain Program memory.\n"; ErrorCode = false; }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION) && !this.ipeLibrary.isEEMemory()) { this.parseErrorMsg = "Selected device does not contain EEPROM memory.\n"; ErrorCode = false; }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_ID_REGION) && !this.ipeLibrary.isUserID()) { this.parseErrorMsg = "Selected device does not contain UserID memory.\n"; ErrorCode = false; }
if (this.isUserSelectedMemoryRegionFlagSet(CommandCodes.M_CFG_REGION) && !this.ipeLibrary.isConfigMemory()) { this.parseErrorMsg = "Selected device does not contain Configurationmemory memory.\n"; ErrorCode = false; } else if (this.isReadMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION) && !this.ipeLibrary.isBootMem()) { this.parseErrorMsg = "Cannot Read Boot memory for this device\n"; ErrorCode = false; } else if (this.isMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION) && !this.ipeLibrary.isBootMem()) { this.parseErrorMsg = "Cannot program Boot memory for this device.\n"; ErrorCode = false; } else if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_BOOTFLASH_REGION) && !this.ipeLibrary.isBootMem()) { this.parseErrorMsg = "Cannot Verify Boot memory for this device.\n"; ErrorCode = false; } else if (this.isReadMemoryRegionFlagSet(CommandCodes.M_AUXILIARY_REGION) && !this.ipeLibrary.isAuxMem()) { this.parseErrorMsg = "Cannot Read Auxillary memory for this device\n"; ErrorCode = false; } else if (this.isMemoryRegionFlagSet(CommandCodes.M_AUXILIARY_REGION) && !this.ipeLibrary.isAuxMem()) { this.parseErrorMsg = "Cannot program Auxillary memory for this device\n"; ErrorCode = false; } else if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_AUXILIARY_REGION) && !this.ipeLibrary.isAuxMem()) { this.parseErrorMsg = "Cannot Verify Auxillary memory for this device\n"; ErrorCode = false; } else if (!this.isOperationFlagSet(CommandCodes.SQTP_SELECTED) || this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { if (this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE) && this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE)) { this.parseErrorMsg = "Cannot program the target while saving environment.\n"; ErrorCode = false; } else if (this.isReadMemoryRegionFlagSet(CommandCodes.M_ID_REGION) && !this.ipeLibrary.isUserID()) { this.parseErrorMsg = "Cannot Read User ID memory for this device\n"; ErrorCode = false; } else if (this.isMemoryRegionFlagSet(CommandCodes.M_ID_REGION) && !this.ipeLibrary.isUserID()) { this.parseErrorMsg = "Cannot program ID memory for this device.\n"; ErrorCode = false; } else if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_ID_REGION) && !this.ipeLibrary.isUserID()) { this.parseErrorMsg = "Cannot Verify ID memory for this device.\n"; ErrorCode = false; } } else if (!this.isEnvironmentFlagSet(CommandCodes.M_ENV_SAVE)) { this.parseErrorMsg = "SQTP is Supported for Programming Operation Only use -M.\n"; ErrorCode = false; }
if (this.isReadMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION) && !this.ipeLibrary.isEEMemory()) { this.parseErrorMsg = "Cannot read User EEData memory for this device."; ErrorCode = false; } else if (this.isMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION) && !this.ipeLibrary.isEEMemory()) { this.parseErrorMsg = "Cannot program EEPROM memory for this device."; ErrorCode = false; } else if (this.isVerifyMemoryRegionFlagSet(CommandCodes.M_EEDATA_REGION) && !this.ipeLibrary.isEEMemory()) { this.parseErrorMsg = "Cannot verify EEPROM memory for this device."; ErrorCode = false; }
return ErrorCode; }
private void displayPM3Help() { this.sharedData.IPEPrint("PM3 COMMAND LINE HELP"); this.sharedData.IPEPrint("Options Description Default\n"); this.sharedData.IPEPrint("----------------------------------------------------------------------------\n"); this.sharedData.IPEPrint("# Communication Ports 1 thru 5 supported. 1\n"); this.sharedData.IPEPrint(" Com ports 1-4 indicates RS232.Com Port\n"); this.sharedData.IPEPrint(" 5 indicates USB.\n"); this.sharedData.IPEPrint("A VDDAPP Device Specific\n"); this.sharedData .IPEPrint( "B<Operation><path> Environment Operation None\n Operation L: = Load Environment,\n All paths = full file\n path. All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData .IPEPrint( " Operation S: = Save Environment,\n All paths = full environment\n path. All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData .IPEPrint( " Operation D: = Delete Environment,\n All paths = full file\n path. All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData .IPEPrint( " Operation C: = Copy Environment,\n path = full file path to\n the environment file of\n the environemnt to be copied,\n followed by the path to\n the destination directory.\n The two paths must be\n separated by an asterisk\n (*), and each path must\n be preceded by either 'C'\n if the path is on the\n computer or 'P' if the\n path is on the PM3.\n " ); this.sharedData .IPEPrint( " Operation V: = View Environment,\n path = full file path to\n the environment file of\n the environemnt to be viewed.\n All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData.IPEPrint("C Blank Check Device Do Not Blank Check\n"); this.sharedData.IPEPrint("D<file> OSSuite File Selection None\n"); this.sharedData.IPEPrint("E Erase Flash Device Do Not Erase\n"); this.sharedData.IPEPrint("F<file> Hex File Selection None\n"); this.sharedData .IPEPrint( "G<Type><range/path> Read functions None\n Type F: = read into hex file, \n path = full file path,\n range is not used\n Types P,E,I,C,B,A: = ouput read of Program,\n EEPROM, ID ,Configuration\n Boot and Auxiliary\n Memory to the screen. P and E \n must be followed by an address \n range in the form of x-y where\n x is the start address and y is\n the end address both in hex,\n path is not used\n " ); this.sharedData.IPEPrint("H Read Checksum from PM3 Do Not Read\n"); this.sharedData.IPEPrint("I Display Device ID Do Not Display\n"); this.sharedData.IPEPrint("K Display Hex File Checksum Do Not Display\n"); this.sharedData.IPEPrint("L Low voltage programming(For devices that support PGM pin) Not Selected\n"); this.sharedData.IPEPrint("M<memory region> Program Device Do Not Program\n"); this.sharedData.IPEPrint(" memory regions:\n"); this.sharedData .IPEPrint( " P = Program memory\n E = EEPROM\n I = ID memory\n C = Configuration memory\n B = Boot memory\n A = Auxiliary memory\n If no region is entered, the entire\n device will be programmed.\n " ); this.sharedData.IPEPrint("N VDD Nominal Device Specific\n"); this.sharedData.IPEPrint("P<part> Part Selection. Example: 16f877 None\n"); this.sharedData.IPEPrint("Q Quiet Mode, no screen output Quiet mode off\n"); this.sharedData.IPEPrint("R<on> <off> Safe/Restricted Mode None\n"); this.sharedData.IPEPrint("S<file> SQTP File Selection None\n"); this.sharedData.IPEPrint("U Overwrite Calibration memory Do Not Overwrite\n"); this.sharedData.IPEPrint("V VPP Device Specific\n"); this.sharedData.IPEPrint("W Externally power target Power from PM3\n"); this.sharedData.IPEPrint("X VDD Max Device Specific\n"); this.sharedData.IPEPrint("Y<memory region> Verify Device Do Not Verify\n"); this.sharedData .IPEPrint( " P = Program memory\n E = EEPROM\n I = ID memory\n C = Configuration memory\n B = Boot memory\n A = Auxiliary memory\n If no region is entered, the entire\n device will be verified.\n " ); this.sharedData.IPEPrint("Z Preserve EEData on Program Do Not Preserve\n"); this.sharedData.IPEPrint("? Help Screen Not Shown\n\n"); this.sharedData.IPEPrint("\n\nEach option must be immediately preceeded by a switch, Which can\n"); this.sharedData.IPEPrint("be either a dash <-> or a slash </> and options must be separated\n"); this.sharedData.IPEPrint("by a single space.\n\n"); this.sharedData.IPEPrint("Example: PM3CMD /5 /P16F877 /Fc:\\mycode /M\n"); this.sharedData.IPEPrint(" or\n"); this.sharedData.IPEPrint(" PM3CMD -5 -P16F877 -Fc:\\mycode -M\n\n"); this.sharedData .IPEPrint( "\n\nCommands and their parameters are not case sensitive. Commands will\nbe processed according to command order of precedence, not the order\nin which they appear on the command line.\n\nThe program will return an exit code upon completion which will\nindicate either successful completion, or describe the reason for \nfailure." ); this.sharedData.IPEPrint("\n\nVersion " + this.sharedData.getVersion() + "\n"); this.sharedData.IPEPrint("\nCopyright (C) Microchip Technology Inc. 2013 "); }
private void displayOtherToolsHelp() { if (this.activeToolSelection.equalsIgnoreCase("RICE")) { this.sharedData.IPEPrint("REALICE COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("PK3")) { this.sharedData.IPEPrint("PICKIT3 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("ICD3")) { this.sharedData.IPEPrint("ICD3 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("ICD4")) { this.sharedData.IPEPrint("ICD4 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("ICD5")) { this.sharedData.IPEPrint("ICD5 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("ICE4")) { this.sharedData.IPEPrint("ICE4 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("PK4")) { this.sharedData.IPEPrint("PK4 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("PK5")) { this.sharedData.IPEPrint("PK5 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("AICE")) { this.sharedData.IPEPrint("ATMEL ICE COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("SNAP")) { this.sharedData.IPEPrint("SNAP COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("J32")) { this.sharedData.IPEPrint("J32 COMMAND LINE HELP"); } else if (this.activeToolSelection.equalsIgnoreCase("PKBASIC")) { this.sharedData.IPEPrint("PKBASIC COMMAND LINE HELP"); }
this.sharedData.IPEPrint("Options Description Default\n"); this.sharedData.IPEPrint("----------------------------------------------------------------------------\n"); this.sharedData.IPEPrint("B Batch Mode Operation None\n"); this.sharedData.IPEPrint("C Blank Check Device Do not Blank Check\n"); this.sharedData.IPEPrint("E Erase Flash Device Do Not Erase\n"); this.sharedData.IPEPrint("F<file> Hex File Selection None\n"); this.sharedData .IPEPrint( "G<Type><range/path> Read functions None\n Type F: = read into hex file, \n path = full file path,\n range is not used\n Types P,E,I,C,B: = ouput read of Program,\n EEPROM, ID ,Boot and/or Configuration\n Memory to the screen. P and E \n must be followed by an address \n range in the form of x-y where\n x is the start address and y is\n the end address both in hex,\n path is not used\n " ); this.sharedData.IPEPrint("H Hold in reset Hold in reset\n"); this.sharedData.IPEPrint("I High Voltage MCLR Not Selected \n"); this.sharedData.IPEPrint("L Release from reset Do Not Release\n"); this.sharedData.IPEPrint("M<memory region> Program Device Do Not Program\n"); this.sharedData.IPEPrint(" memory regions:\n"); this.sharedData .IPEPrint( " P = Program memory\n E = EEPROM\n I = ID memory\n C = Configuration memory\n B = Boot memory\n If no region is entered, the entire\n device will be programmed.\n " ); this.sharedData.IPEPrint("N####,#### Program memory range None\n"); this.sharedData.IPEPrint(" #### is a hexdecimal number "); this.sharedData.IPEPrint(" representing Start and End Address "); this.sharedData.IPEPrint(" in sequence "); this.sharedData.IPEPrint("P<part> Part Selection. Example: 16f877 None\n"); this.sharedData.IPEPrint("R<file> Reprogram Do Not Reprogram\n"); this.sharedData.IPEPrint("S<file> SQTP File Selection None\n"); if (!this.activeToolSelection.equalsIgnoreCase("RICE")) { this.sharedData.IPEPrint("V Power from tool Externally power target\n"); }
this.sharedData.IPEPrint("Y<memory region> Verify Device Do Not Verify\n"); this.sharedData .IPEPrint( " P = Program memory\n E = EEPROM\n I = ID memory\n C = Configuration memory\n B = Boot memory\n If no region is entered, the entire\n device will be verified.\n " ); this.sharedData.IPEPrint("? Help Screen Not Shown\n\n"); this.sharedData.IPEPrint("\n\nEach option must be immediately preceeded by a switch, Which can\n"); this.sharedData.IPEPrint("be either a dash <-> or a slash </> and options must be separated\n"); this.sharedData.IPEPrint("by a single space.\n\n"); this.sharedData .IPEPrint( "\n\nCommands and their parameters are not case sensitive. Commands will\nbe processed according to command order of precedence, not the order\nin which they appear on the command line.\n\nThe program will return an exit code upon completion which will\nindicate either successful completion, or describe the reason for \nfailure." ); this.sharedData.IPEPrint("\n\nVersion " + this.sharedData.getVersion() + "\n"); this.sharedData.IPEPrint("\nCopyright (C) Microchip Technology Inc. 2013 "); }
private void displayIpecmdHelp() { this.sharedData.IPEPrint("------------------------------------------------------------------------------------------------------\n"); this.sharedData.IPEPrint(" IPECMD COMMAND LINE HELP \n"); this.sharedData.IPEPrint("------------------------------------------------------------------------------------------------------\n"); this.sharedData.IPEPrint("Usage: ipecmd <deviceName> <toolName> [Options] \n"); this.sharedData.IPEPrint("Note: More examples available in [Readme for IPECMD.html] under installation docs folder\n"); this.sharedData.IPEPrint("------------------------------------------------------------------------------------------------------\n"); this.sharedData.IPEPrint("Options Description Default\n"); this.sharedData.IPEPrint("------------------------------------------------------------------------------------------------------\n"); this.sharedData.IPEPrint("# Communication Ports 1 thru 255 supported. \n"); this.sharedData.IPEPrint(" Com Port 5 indicates USB.\n"); this.sharedData.IPEPrint(" Other Com ports indicates RS232\n"); this.sharedData.IPEPrint("A VDDAPP(Applicable only for PM3) Device Specific\n"); this.sharedData .IPEPrint( "B<Operation><path> Environment Operation None\n Operation L: = Load Environment,\n All paths = full file\n path. All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData .IPEPrint( " Operation S: = Save Environment,\n All paths = full environment\n path. All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData .IPEPrint( " Operation D: = Delete Environment,\n All paths = full file\n path. All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData .IPEPrint( " Operation C: = Copy Environment,\n path = full file path to\n the environment file of\n the environemnt to be copied,\n followed by the path to\n the destination directory.\n The two paths must be\n separated by an asterisk\n (*), and each path must\n be preceded by either 'C'\n if the path is on the\n computer or 'P' if the\n path is on the PM3.\n " ); this.sharedData .IPEPrint( " Operation V: = View Environment,\n path = full file path to\n the environment file of\n the environemnt to be viewed.\n All paths located\n on the PM3Card must be\n preceeded by a 'P' All\n Paths on the computer\n must be preceeded by a\n 'C'\n " ); this.sharedData.IPEPrint("C Blank Check Device Do not Blank Check\n"); this.sharedData.IPEPrint("D<file> OSSuite File Selection None\n"); this.sharedData.IPEPrint("E Erase Flash Device Do Not Erase\n"); this.sharedData.IPEPrint("F<file> Hex File Selection None\n"); this.sharedData .IPEPrint( "G<Type><range/path> Read functions None\n Type F: = read into hex file, \n path = full file path,\n range is not used\n Types P,E,I,C,B,A,D: = ouput read of Program,\n EEPROM, ID ,Configuration\n Boot and Auxiliary,\n Device Information Area\n Memory to the screen. P and E \n must be followed by an address \n range in the form of x-y where\n x is the start address and y is\n the end address both in hex,\n path is not used\n " ); this.sharedData.IPEPrint("I Display Device ID Do Not Display\n"); this.sharedData.IPEPrint("J High voltage MCLR(Not Selected) Selected\n"); this.sharedData.IPEPrint("K Display Hex File Checksum Do Not Display\n"); this.sharedData.IPEPrint("L Low voltage programming(For devices that support PGM pin) Not Selected\n"); this.sharedData.IPEPrint("M<memory region> Program Device Do Not Program\n"); this.sharedData.IPEPrint(" memory regions:\n"); this.sharedData .IPEPrint( " P = Program memory\n E = EEPROM\n I = ID memory\n C = Configuration memory\n B = Boot memory\n A = Auxiliary memory\n If no region is entered, the entire\n device will be programmed.\n " ); this.sharedData.IPEPrint("N VDD Nominal(Applicable only for PM3) Device Specific\n"); this.sharedData.IPEPrint("OA<Type><Value> ICD4, ICD5 and ICE4 Setting None\n"); this.sharedData.IPEPrint(" Types:\n"); this.sharedData .IPEPrint( " A = PGC resistor value in Kohms\n B = PGC resistor value in Kohms\n C =PGC Config 0-None, 1-Pull up, 2-Pull down\n D =PGD Config 0-None, 1-Pull up, 2-Pull down\n S =Programming Speed 0-Minimum, 1-Medium, 2-Maximum\n L =LED Brightness 1-10\n " ); this.sharedData.IPEPrint("OB Batch Mode Operation None \n"); this.sharedData.IPEPrint("OD VDD First(Applicable only for PICKIT3, ICD3, ICD4, ICD5 and ICE4) VPP First \n"); this.sharedData.IPEPrint("OE Description file for saving environment None \n"); this.sharedData.IPEPrint("OK Just Connect None \n"); this.sharedData.IPEPrint("OL Release from Reset(Not Applicable for PM3) Hold in reset \n"); this.sharedData.IPEPrint("OM Miscellaneous file for saving environment None \n"); this.sharedData.IPEPrint("OP<range> Preserve Program memory Do Not Preserve \n"); this.sharedData.IPEPrint(" E.g - OP0-1FF"); this.sharedData.IPEPrint("OG<imagename> PICKIT3/PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT3/PICKIT4/PICKIT5) None"); this.sharedData.IPEPrint("OGS<imagename> PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT4/PICKIT5 Send Image alone) None"); this.sharedData.IPEPrint("OGM<imagename> PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT4/PICKIT5 Program Device alone) None"); this.sharedData .IPEPrint("OGL PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT4/PICKIT5 Lists the PTG images from SDCard) None"); this.sharedData .IPEPrint("OGA<imagename> PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT4/PICKIT5 Sets given image as active image) None"); this.sharedData.IPEPrint("OGD<imagename> PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT4/PICKIT5 Delete the given image) None"); this.sharedData .IPEPrint( "OGR<imagename> PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT4/PICKIT5 Reset the statistics for the given image) None" ); this.sharedData .IPEPrint("OGG PICKIT4/PICKIT5 Programmer-to-go(Applicable only for PICKIT4/PICKIT5 Gets the current active image) None"); this.sharedData.IPEPrint("OH Erase All Before Programming (Not Selected) Selected"); this.sharedData.IPEPrint("OC<memory region> Select memory regions(Applicable with Programmer-to-go) All regions selected\n"); this.sharedData.IPEPrint(" memory regions:\n"); this.sharedData .IPEPrint( " P = Program memory\n E = EEPROM\n I = ID memory\n C = Configuration memory\n " ); this.sharedData.IPEPrint("OI Display Device ID Revision(Applicable only for PM3) Do Not Display\n"); this.sharedData.IPEPrint("OID Preserve User ID memory on Program Do Not Preserve\n"); this.sharedData.IPEPrint("OJ<Value> JTAG interface selection 2wire or 4wire None\n"); this.sharedData.IPEPrint("ORI<Value> Interface setting for AVR/ SAM devices Interfaces: [JTAG, SWD, UPDI, ISP, TPI, PDI, HVPP, HVSP] \n"); this.sharedData.IPEPrint("ORS<Value> Speed setting for AVR/ SAM devices Speed in MHz\n"); this.sharedData.IPEPrint("ORN No high voltage activation mode"); this.sharedData.IPEPrint("ORH Simple pulse activation mode"); this.sharedData.IPEPrint("ORU User Power Toggle"); this.sharedData.IPEPrint("OSC CP=OFF Checksum.\n"); this.sharedData.IPEPrint("OSB Disable bluetooth from PICkit5.\n"); this.sharedData .IPEPrint("OSL<Level0..7><Path> Enable diagnostics log Levels: [0=OFF, 1=SEVERE, 2=WARNING, 3=INFO, 4=CONFIG, 5=FINE, 6=FINER, 7=FINEST] \n"); this.sharedData.IPEPrint("OGP PTG-Go-To.\n"); this.sharedData.IPEPrint("OSO Enable OTP Program\n"); this.sharedData.IPEPrint("OSF Enable OTP Fuse Config bit programming\n"); this.sharedData.IPEPrint("OT Switches the memory from single partition to dual partition mode. Do Not Overwrite\n"); this.sharedData.IPEPrint("OU Overwrite Calibration memory Do Not Overwrite\n"); this.sharedData.IPEPrint("OV Verify Device ID before program None\n"); this.sharedData.IPEPrint("OWD Lists installed device packs None\n"); this.sharedData.IPEPrint("OWD<DFP VERSION> Set specific device pack None\n"); this.sharedData.IPEPrint("OWT Lists installed tool packs None\n"); this.sharedData.IPEPrint("OWT<TOOLPACK VER> Set specific tool pack None\n"); this.sharedData.IPEPrint("OZ CRC32 Checksum None\n"); this.sharedData.IPEPrint("ORR Reset Before and After Programming for J32Debug Probe Selected\n"); this.sharedData.IPEPrint("P<part> Part Selection. Example: 16f877 None\n"); this.sharedData.IPEPrint("Q Quiet Mode, no screen output(Applicable only for PM3) Quiet mode off\n"); this.sharedData.IPEPrint("R<on> <off> Safe/Restricted Mode(Applicable only for PM3) None\n"); this.sharedData.IPEPrint("S<file> SQTP File Selection None\n"); this.sharedData.IPEPrint("T P = Tool Selection.\n E.g -TPRICE for RealICE -TPPK3 for PICKIT3 \n"); this.sharedData.IPEPrint(" S = Specific Tool Selection using Serial No.\n E.g -TSBUR1234566 \n"); this.sharedData.IPEPrint(" Short Name for Tools\n"); this.sharedData.IPEPrint(" REALICE - RICE \n"); this.sharedData.IPEPrint(" ICD3 - ICD3 \n"); this.sharedData.IPEPrint(" PICKIT3 - PK3 \n"); this.sharedData.IPEPrint(" PM3 - PM3 \n"); this.sharedData.IPEPrint(" ICD4 - ICD4 \n"); this.sharedData.IPEPrint(" ICD5 - ICD5 \n"); this.sharedData.IPEPrint(" ICE4 - ICE4 \n"); this.sharedData.IPEPrint(" PICKIT4 - PK4 \n"); this.sharedData.IPEPrint(" PICKIT5 - PK5 \n"); this.sharedData.IPEPrint(" SNAP - SNAP \n"); this.sharedData.IPEPrint(" PKOB3 - PKOB \n"); this.sharedData.IPEPrint(" PKOB4 - PKOB4 \n"); this.sharedData.IPEPrint(" PICKITBASIC - PKBASIC \n"); this.sharedData.IPEPrint(" J-32 - J32 \n"); this.sharedData.IPEPrint("V VPP(Applicable only for PM3) Device Specific\n"); this.sharedData.IPEPrint("W Power target from tool Externally power target\n "); this.sharedData.IPEPrint("X VDD Max(Applicable only for PM3) Device Specific\n"); this.sharedData.IPEPrint("Y<memory region> Verify Device Do Not Verify\n"); this.sharedData .IPEPrint( " P = Program memory\n E = EEPROM\n I = ID memory\n C = Configuration memory\n B = Boot memory\n A = Auxiliary memory\n If no region is entered, the entire\n device will be verified.\n " ); this.sharedData.IPEPrint("Z Preserve EEData on Program Do Not Preserve\n"); this.sharedData.IPEPrint("? Help Screen Not Shown\n\n"); this.sharedData.IPEPrint("\n\nEach option must be immediately preceeded by a switch, Which can\n"); this.sharedData.IPEPrint("be either a dash <-> or a slash </> and options must be separated\n"); this.sharedData.IPEPrint("by a single space.\n\n"); this.sharedData .IPEPrint( "\n\nCommands and their parameters are not case sensitive. Commands will\nbe processed according to command order of precedence, not the order\nin which they appear on the command line.\n\nThe program will return an exit code upon completion which will\nindicate either successful completion, or describe the reason for \nfailure." ); this.sharedData.IPEPrint("\n\nVersion " + this.sharedData.getVersion() + "\n"); this.sharedData.IPEPrint("\nCopyright (C) Microchip Technology Inc. 2013 "); }
private boolean switchToDualPartitionMode() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.SWITCH_TO_DUAL_PARTITION)) { if (!this.isOperationFlagSet(CommandCodes.READ_TARGET) && !this.isOperationFlagSet(CommandCodes.VERIFY_DEVICE) && !this.isOperationFlagSet(CommandCodes.READ_PARTITION_CONFIG)) { this.sharedData .quitAndSendErrorCode( "-OT argument can be used only for read and verification operations in dual partition mode -" + this.m_FormatedDeviceString, CommandCodes.INVALID_CMDLINE_ARG ); retVal = false; } else if (!this.ipeLibrary.getXPICDeviceInfo().getIDOntoPartition().isEmpty()) { Assembly current_Session = this.ipeLibrary.getAssemblySession(); Result<MemoryModel> mems = current_Session.getLookup().lookupResult(MemoryModel.class);
for (Class<? extends MemoryModel> cls : mems.allClasses()) { MemoryModel mem = (MemoryModel)current_Session.getLookup().lookup(cls); if (mem instanceof MultiPartition) { ((MultiPartition)mem).SetMode(MODE.MULTIPLE); } } } else { this.sharedData .quitAndSendErrorCode( this.sharedData.getStringFromBundle("IPECMD.DEVICE_MULTIPARTITIONED") + " -" + this.m_FormatedDeviceString, CommandCodes.INVALID_DEVICE ); retVal = false; } } else if (this.isOperationFlagSet(CommandCodes.PROGRAM_DEVICE) && !this.ipeLibrary.getXPICDeviceInfo().getIDOntoPartition().isEmpty() && this.ipeLibrary.isPartitioned()) { Assembly current_Session = this.ipeLibrary.getAssemblySession(); Result<MemoryModel> mems = current_Session.getLookup().lookupResult(MemoryModel.class);
for (Class<? extends MemoryModel> clsx : mems.allClasses()) { MemoryModel mem = (MemoryModel)current_Session.getLookup().lookup(clsx); if (mem instanceof MultiPartition) { ((MultiPartition)mem).SetMode(MODE.MULTIPLE); ((MultiPartition)mem).SetActivePartition(1); } } }
return retVal; }
private boolean updatePluginBoard() { boolean retVal = true; if (this.isOperationFlagSet(CommandCodes.JTAG_SUPPORT)) { if (this.ipeLibrary.getAssemblySession().GetDeviceName().startsWith("PIC32MX")) { this.ipeLibrary.getAssemblySession().SetPluginBoard("PIC32JTAG"); } else if (this.ipeLibrary.getAssemblySession().GetDeviceName().startsWith("PIC32MZ")) { this.ipeLibrary.getAssemblySession().SetPluginBoard("PIC32MZJTAG"); } else if (this.ipeLibrary.getAssemblySession().GetDeviceName().startsWith("PIC32WK")) { this.ipeLibrary.getAssemblySession().SetPluginBoard("PIC32WKJTAG"); } else { retVal = false; } }
return retVal; }
private boolean ValidateEERangeAddresses(String addrRange) { String input = addrRange.toLowerCase(); String[] range = input.split("-"); String startAddr = range[0]; String endAddr = range[1]; return this.ipeLibrary.isValidRange(Long.parseLong(startAddr, 16), Long.parseLong(endAddr, 16), "eeprom"); }
private void checkIfDeviceIsPartitioned() { if (this.isOperationFlagSet(CommandCodes.CHECK_PARTITION)) { if (this.m_FormatedDeviceString != null) { if (this.ipeLibrary.CheckAssemblySessionActive()) { if (!this.ipeLibrary.getXPICDeviceInfo().getIDOntoPartition().isEmpty()) { this.sharedData.IPEPrint(this.m_FormatedDeviceString + " is a partitioned device"); } else { this.sharedData.IPEPrint(this.m_FormatedDeviceString + " is not a partitioned device"); } } else { this.sharedData.quitAndSendErrorCode("Error in fetching assembly session for the device", CommandCodes.DEVICE_ERROR); } } else { this.sharedData.quitAndSendErrorCode("Device seems to be null", CommandCodes.DEVICE_ERROR); } } }
private void listDeviceActions() { Map<String, String> devActionsList = this.ipeLibrary.getDeviceActionsMap(); if (!devActionsList.isEmpty()) { for (Entry<String, String> entry : devActionsList.entrySet()) { this.sharedData.IPEPrint("Device Actions : " + entry.getKey().replaceAll("\\s+", "")); } } else { this.sharedData.IPEPrint("Device Actions Not found"); } }
private boolean validateDeviceActions(String enteredDeviceAction) { boolean bRet = false; Map<String, String> devActionsList = this.ipeLibrary.getDeviceActionsMap();
for (Entry<String, String> entry : devActionsList.entrySet()) { if (entry.getKey().replaceAll("\\s+", "").equalsIgnoreCase(enteredDeviceAction.replaceAll("\\s+", ""))) { this.m_DevActionFuncName = entry.getValue(); bRet = true; break; } }
return bRet; }
private boolean browsePTGImage() { boolean bRet = true; if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT)) { if (this.IsPTGImageFlagSet(CommandCodes.LIST_PTGIMAGES)) { this.getPK5PTGImageList(); }
if (this.IsPTGImageFlagSet(CommandCodes.SETACTIVE_PTGIMG)) { if (this.m_PTGImageName.isEmpty() && this.m_PTGImageName == null) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND")); bRet = false; } else { PtgImageInfo ptgImageInfo = new PtgImageInfo(this.m_PTGImageName); if (this.validatePTGImages(this.m_PTGImageName)) { this.ipeLibrary.setPK5PTGActiveImage(ptgImageInfo);
try { if (this.ipeLibrary.getPK5PTGActiveImage().getImageName() == null) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.ACTIVEIMAGE_NOTFOUND")); } else { this.sharedData .IPEPrint(this.sharedData.getStringFromBundle("IPECMD.ACTIVEIMAGE") + this.ipeLibrary.getPK5PTGActiveImage().getImageName()); } } catch (Exception var5) { MPLABLogger.mplog.log(Level.WARNING, "Exception ", (Throwable)var5); } } else { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND"), CommandCodes.OPFAILURE); } } }
if (this.IsPTGImageFlagSet(CommandCodes.DELETE_PTGIMAGE)) { if (this.m_PTGImageName.isEmpty() && this.m_PTGImageName == null) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND")); bRet = false; } else { PtgImageInfo ptgImageInfo = new PtgImageInfo(this.m_PTGImageName); if (this.validatePTGImages(this.m_PTGImageName) && this.ipeLibrary.getPK5PTGActiveImage().getImageName() != null) { if (this.m_PTGImageName.equals(this.ipeLibrary.getPK5PTGActiveImage().getImageName())) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.PTG_DEL_WARNING")); } else { this.ipeLibrary.deletePK5PTGImage(ptgImageInfo); this.sharedData.IPEPrint(this.m_PTGImageName + " " + this.sharedData.getStringFromBundle("IPECMD.DELETEIMAGE")); } } else { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.CANNOT_DELETEIMAGE")); } } }
if (this.IsPTGImageFlagSet(CommandCodes.RESET_PTGIMG)) { PtgImageInfo ptgImageInfo = new PtgImageInfo(this.m_PTGImageName); if (this.m_PTGImageName.isEmpty() && this.m_PTGImageName == null) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND")); bRet = false; } else if (this.validatePTGImages(this.m_PTGImageName)) { this.ipeLibrary.resetPK5PTGStats(ptgImageInfo); this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.RESETSTATS") + this.m_PTGImageName); } else { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND")); bRet = false; } }
if (this.IsPTGImageFlagSet(CommandCodes.GETACTIVE_PTGIMG)) { try { if (this.ipeLibrary.getPK5PTGImageList() != null && this.ipeLibrary.getPK5PTGActiveImage().getImageName() != null) { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.ACTIVEIMAGE") + this.ipeLibrary.getPK5PTGActiveImage().getImageName()); } else { this.sharedData.IPEPrint(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND")); bRet = false; } } catch (NullPointerException | RIExceptions var6) { MPLABLogger.mplog.log(Level.INFO, "Exception ", (Throwable)var6); } }
if (this.IsPTGImageFlagSet(CommandCodes.PRESS_PTG_GO)) { try { if (this.ipeLibrary.connectAsPTG()) { this.ipeLibrary.runPtgGoButton(); this.sharedData.IPEPrint("Programmed Succesfully in PTG mode"); } } catch (Exception var4) { MPLABLogger.mplog.log(Level.INFO, "Exception ", (Throwable)var4); } } }
return bRet; }
private boolean validatePTGImages(String enteredPTGImage) { boolean bRet = false;
try { List<PtgImageInfo> PTGImgList = this.ipeLibrary.getPK5PTGImageList(); if (PTGImgList == null) { this.sharedData.quitAndSendErrorCode(this.sharedData.getStringFromBundle("IPECMD.PTGIMAGE_NOTFOUND"), CommandCodes.OPFAILURE); } else { for (int iPTGCount = 0; iPTGCount < PTGImgList.size(); iPTGCount++) { if (PTGImgList.get(iPTGCount).getImageName().equals(enteredPTGImage)) { bRet = true; break; } } } } catch (RIExceptions var5) { MPLABLogger.mplog.log(Level.WARNING, "Exception", (Throwable)var5); }
return bRet; }
private void SubmitDeviceAction() { this.ipeLibrary.runner.submitFunctionCall(this.m_DevActionFuncName, new Object[0]); }
private boolean adapterSanity(List<String> adapters) throws ServiceQueryException { boolean retVal = true; List<String> adp = this.ipeLibrary.listAdapters(); if (adapters.isEmpty()) { if (adp.isEmpty()) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.PM5PA_NOT_FOUND"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } else if (adp.size() == 1) { this.adaptersList = adp; } else if (adp.size() > 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.MULTIPLE_ADAPTER_AVL"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } } else if (adapters.size() == 1) { boolean isAdapterSerialCorrect = false;
for (String str : adapters) { if (adp.contains(str)) { isAdapterSerialCorrect = true; } }
if (!isAdapterSerialCorrect) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INCORRECT_ADAPTER_SERIAL"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } else { this.adaptersList = adp; } } else if (adapters.size() > 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.MULTIPLE_ADAPTER"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; }
return retVal; }
private boolean pm5MainSerialSanity(List<String> pm5Serial) throws ServiceQueryException { boolean retVal = true;
try { List<String> pm5Units = this.ipeLibrary.listPM5Units(); if (pm5Serial.isEmpty()) { if (pm5Units.isEmpty()) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.PM5_NOT_FOUND"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } else if (pm5Units.size() == 1) { this.pm5MainSerial = pm5Units.get(0); } else if (pm5Units.size() > 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.MULTIPLE_PM5_AVL"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } } else if (pm5Serial.size() == 1) { boolean isPM5MainSerialCorrect = false;
for (String str : pm5Serial) { if (pm5Units.contains(str)) { isPM5MainSerialCorrect = true; } }
if (!isPM5MainSerialCorrect) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INCORRECT_PM5_SERIAL"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } else { this.pm5MainSerial = pm5Serial.get(0); } } else if (pm5Serial.size() > 1) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.MULTIPLE_PM5"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } } catch (ServiceQueryException var7) { this.sharedData.quitAndSendErrorCode(var7.getErrorMessage(), CommandCodes.LIST_PM5_ERROR); retVal = false; }
return retVal; }
private boolean pm5MainAdapterSanity(String pm5Serial, List<String> adapters) { boolean retVal = true;
try { List<String> adp = this.ipeLibrary.listPM5MainSubUnits(pm5Serial); if (adapters.isEmpty()) { if (adp.isEmpty()) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.PM5PA_NOT_FOUND"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } else { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.NO_ADAPTER_SERIAL"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } } else { boolean isAdapterSerialCorrect = true;
for (String str : adapters) { if (!adp.contains(str)) { isAdapterSerialCorrect = false; break; } }
if (!isAdapterSerialCorrect) { this.parseErrorMsg = this.sharedData.getStringFromBundle("IPECMD.INCORRECT_ADAPTER_SERIAL"); this.sharedData.quitAndSendErrorCode(this.parseErrorMsg, CommandCodes.INVALID_CMDLINE_ARG); retVal = false; } else { this.adaptersList = adapters; } } } catch (ServiceQueryException var8) { this.sharedData.quitAndSendErrorCode(var8.getErrorMessage(), CommandCodes.LIST_ADAPTER_ERROR); retVal = false; }
return retVal; }
private boolean listAdapters(List<String> paramsPm5MainSerialList) { boolean retVal = true;
try { if (this.isLaCmdActive) { if (this.activeToolSelection.equalsIgnoreCase("PM5PA")) { List<String> adp = this.ipeLibrary.listAdapters(); this.sharedData.IPEPrint("\nAdapters:");
for (int i = 0; i < adp.size(); i++) { this.sharedData.IPEPrint(i + 1 + ") " + adp.get(i)); } }
if (this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList)) { List<String> adp = this.ipeLibrary.listPM5MainSubUnits(this.pm5MainSerial); this.sharedData.IPEPrint("\nAdapters:");
for (int i = 0; i < adp.size(); i++) { this.sharedData.IPEPrint(i + 1 + ") " + adp.get(i)); } } } } catch (ServiceQueryException var5) { this.sharedData.quitAndSendErrorCode(var5.getErrorMessage(), CommandCodes.LIST_ADAPTER_ERROR); retVal = false; }
return retVal; }
private boolean listEnvironments(List<String> paramsPm5MainSerialList, List<String> adapters) { boolean retVal = true;
try { if (this.isLeCmdActive) { if (this.activeToolSelection.equalsIgnoreCase("PM5PA") && this.adapterSanity(adapters)) { Map<String, List<String>> envs = this.ipeLibrary.listEnvironments(this.adaptersList);
for (String key : envs.keySet()) { this.sharedData.IPEPrint("\nAdapter: " + key);
for (int i = 0; i < envs.get(key).size(); i++) { String env = envs.get(key).get(i); this.sharedData.IPEPrint(i + 1 + ") " + env); } } } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && adapters.isEmpty() && this.pm5MainSerialSanity(paramsPm5MainSerialList)) { List<String> envs = this.ipeLibrary.listPM5MainEnvironments(this.pm5MainSerial); this.sharedData.IPEPrint("PM5 Environments:");
for (int i = 0; i < envs.size(); i++) { this.sharedData.IPEPrint(i + 1 + ") " + envs.get(i)); } } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList) && this.pm5MainAdapterSanity(this.pm5MainSerial, adapters)) { Map<String, List<String>> envs = this.ipeLibrary.listPM5MainSubEnvironments(this.pm5MainSerial, this.adaptersList); this.sharedData.IPEPrint("PM5 Environments:");
for (String key : envs.keySet()) { this.sharedData.IPEPrint("\nAdapter: " + key);
for (int i = 0; i < envs.get(key).size(); i++) { String env = envs.get(key).get(i); this.sharedData.IPEPrint(i + 1 + ") " + env); } } } } } catch (ServiceQueryException var9) { this.sharedData.quitAndSendErrorCode(var9.getErrorMessage(), CommandCodes.LIST_ENVIRONMENT_ERROR); retVal = false; }
return retVal; }
private boolean getActiveEnvironments(List<String> paramsPm5MainSerialList, List<String> adapters) { boolean retVal = true;
try { if (this.isGaeCmdActive) { if (this.activeToolSelection.equalsIgnoreCase("PM5PA") && this.adapterSanity(adapters)) { Map<String, String> envs = this.ipeLibrary.getActiveEnvironments(this.adaptersList);
for (String key : envs.keySet()) { this.sharedData.IPEPrint("\nAdapter: " + key); this.sharedData.IPEPrint(envs.get(key)); } } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList) && this.pm5MainAdapterSanity(this.pm5MainSerial, adapters)) { Map<String, String> envs = this.ipeLibrary.getPM5MainSubActiveEnvironments(this.pm5MainSerial, this.adaptersList);
for (String key : envs.keySet()) { this.sharedData.IPEPrint("\nAdapter: " + key); this.sharedData.IPEPrint(envs.get(key)); } } } } catch (ServiceQueryException var7) { this.sharedData.quitAndSendErrorCode(var7.getErrorMessage(), CommandCodes.GET_ACTIVE_ENVIRONMENT_ERROR); retVal = false; }
return retVal; }
private boolean getFirmwareInfo(List<String> paramsPm5MainSerialList, List<String> adapters) { boolean retVal = true;
try { if (this.isGfiCmdActive) { if (this.activeToolSelection.equalsIgnoreCase("PM5PA") && this.adapterSanity(adapters)) { Map<String, FirmwareInfo> info = this.ipeLibrary.getFirmwareInfo(this.adaptersList); ObjectMapper mapper = new ObjectMapper();
for (String key : info.keySet()) { this.sharedData.IPEPrint("\nAdapter: " + key); String str = mapper.writeValueAsString(info.get(key)); JsonNode jsonNode = mapper.readTree(str); jsonNode.fields() .forEachRemaining(entry -> this.sharedData.IPEPrint(((String)entry.getKey()).toUpperCase() + ": " + ((JsonNode)entry.getValue()).asText())); } } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && adapters.isEmpty() && this.pm5MainSerialSanity(paramsPm5MainSerialList)) { Pm5Versions info = this.ipeLibrary.getPM5MainFirmwareInfo(this.pm5MainSerial); this.sharedData.IPEPrint("PM5 Firmware Info:"); ObjectMapper mapper = new ObjectMapper(); String str = mapper.writeValueAsString(info); JsonNode jsonNode = mapper.readTree(str); this.sharedData.IPEPrint("---"); this.traverseJsonNode(jsonNode); } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList) && this.pm5MainAdapterSanity(this.pm5MainSerial, adapters)) { Map<String, FirmwareInfo> info = this.ipeLibrary.getPM5MainSubFirmwareInfo(this.pm5MainSerial, this.adaptersList); this.sharedData.IPEPrint("PA Firmware Info:"); ObjectMapper mapper = new ObjectMapper();
for (String key : info.keySet()) { this.sharedData.IPEPrint("\nAdapter: " + key); String str = mapper.writeValueAsString(info.get(key)); JsonNode jsonNode = mapper.readTree(str); jsonNode.fields().forEachRemaining(entry -> this.sharedData.IPEPrint((String)entry.getKey() + ": " + ((JsonNode)entry.getValue()).asText())); } } } } catch (ServiceQueryException var10) { this.sharedData.quitAndSendErrorCode(var10.getErrorMessage(), CommandCodes.GET_FIRMWARE_INFORMATION_ERROR); retVal = false; } catch (JsonProcessingException var11) { this.sharedData.quitAndSendErrorCode(var11.getMessage(), CommandCodes.GET_FIRMWARE_INFORMATION_ERROR); retVal = false; }
return retVal; }
private boolean setActiveEnvironments(List<String> paramsPm5MainSerialList, List<String> adapters, String environment) { boolean retVal = true;
try { if (this.isSaeCmdActive) { if (this.activeToolSelection.equalsIgnoreCase("PM5PA") && this.adapterSanity(adapters)) { this.ipeLibrary.setActiveEnvironments(this.adaptersList, environment); } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList) && this.pm5MainAdapterSanity(this.pm5MainSerial, adapters)) { this.ipeLibrary.setPM5MainSubActiveEnvironments(this.pm5MainSerial, this.adaptersList, environment); } } } catch (ServiceQueryException var6) { this.sharedData.quitAndSendErrorCode(var6.getErrorMessage(), CommandCodes.SET_ACTIVE_ENVIRONMENT_ERROR); retVal = false; }
return retVal; }
private boolean deleteEnvironments(List<String> paramsPm5MainSerialList, List<String> adapters, String environment) { boolean retVal = true;
try { if (this.isDeCmdActive) { if (this.activeToolSelection.equalsIgnoreCase("PM5PA") && this.adapterSanity(adapters)) { this.ipeLibrary.deleteEnvironments(environment, this.adaptersList); } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && adapters.isEmpty() && this.pm5MainSerialSanity(paramsPm5MainSerialList)) { this.ipeLibrary.deletePM5MainEnvironments(environment, this.pm5MainSerial); } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList) && this.pm5MainAdapterSanity(this.pm5MainSerial, adapters)) { this.ipeLibrary.deletePM5MainSubEnvironments(environment, this.pm5MainSerial, this.adaptersList); } } } catch (ServiceQueryException var6) { this.sharedData.quitAndSendErrorCode(var6.getErrorMessage(), CommandCodes.DELETE_ENVIRONEMNT_ERROR); retVal = false; }
return retVal; }
private boolean transferEnvironment(List<String> paramsPm5MainSerialList, List<String> adapters, String environment) { boolean retVal = true;
try { if (this.isTeCmdActive) { if (this.isValidDirectoryPath(environment)) { if (this.activeToolSelection.equalsIgnoreCase("PM5PA") && this.adapterSanity(adapters)) { this.ipeLibrary.transferEnvironment(environment, this.adaptersList); } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && adapters.isEmpty() && this.pm5MainSerialSanity(paramsPm5MainSerialList)) { this.ipeLibrary.transferPM5MainEnvironment(environment, this.pm5MainSerial); } else if (this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList) && this.pm5MainAdapterSanity(this.pm5MainSerial, adapters)) { this.ipeLibrary.transferEnvironmentToPM5MainSub(environment, this.pm5MainSerial, this.adaptersList); } } else { this.sharedData.quitAndSendErrorCode("The provided environment path is incorrect for transfer.", CommandCodes.TRANSFER_ENVIRONMENT_ERROR); retVal = false; } } } catch (ServiceQueryException var6) { this.sharedData.quitAndSendErrorCode(var6.getErrorMessage(), CommandCodes.TRANSFER_ENVIRONMENT_ERROR); retVal = false; }
return retVal; }
private boolean listPM5PgmStats(List<String> paramsPm5MainSerialList, List<String> adapters, String environment) { boolean retVal = true;
try { if (this.isPrgStatsCmdActive && this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList) && this.pm5MainAdapterSanity(this.pm5MainSerial, adapters)) { Map<String, String> envs = this.ipeLibrary.listPM5MainSubPgmStats(environment, this.pm5MainSerial, this.adaptersList); this.sharedData.IPEPrint("PM5 Environments Stats:");
for (Entry<String, String> key : envs.entrySet()) { this.sharedData.IPEPrint("\nAdapter: " + key.getKey()); List<String> val = Arrays.asList(key.getValue().trim().split(","));
for (int i = 1; i < val.size() - 1; i += 2) { this.sharedData.IPEPrint(val.get(i) + " : " + val.get(i + 1)); } } } } catch (ServiceQueryException var10) { this.sharedData.quitAndSendErrorCode(var10.getErrorMessage(), CommandCodes.GET_PRG_STATS_ERROR); retVal = false; }
return retVal; }
private boolean listPM5Units() { boolean retVal = true;
try { if (this.isLpm5CmdActive) { List<String> adp = this.ipeLibrary.listPM5Units(); this.sharedData.IPEPrint("PM5 Main:");
for (int i = 0; i < adp.size(); i++) { this.sharedData.IPEPrint(i + 1 + ") " + adp.get(i)); } } } catch (ServiceQueryException var4) { this.sharedData.quitAndSendErrorCode(var4.getErrorMessage(), CommandCodes.LIST_PM5_ERROR); retVal = false; }
return retVal; }
private boolean getPM5Logs(List<String> paramsPm5MainSerialList) { boolean retVal = true;
try { if (this.isGetLogCmdActive && this.activeToolSelection.equalsIgnoreCase("PM5") && this.pm5MainSerialSanity(paramsPm5MainSerialList)) { String res = this.ipeLibrary.getPM5Logs(this.pm5MainSerial); this.sharedData.IPEPrint("\n" + res); } } catch (ServiceQueryException var4) { this.sharedData.quitAndSendErrorCode(var4.getErrorMessage(), CommandCodes.LIST_ADAPTER_ERROR); retVal = false; }
return retVal; }
private boolean checkFakeAssemblyRequirement() { if (this.isOperationFlagSet(CommandCodes.PTG_SUPPORT)) { if (this.IsPTGImageFlagSet(CommandCodes.LIST_PTGIMAGES) || this.IsPTGImageFlagSet(CommandCodes.SETACTIVE_PTGIMG) || this.IsPTGImageFlagSet(CommandCodes.DELETE_PTGIMAGE) || this.IsPTGImageFlagSet(CommandCodes.RESET_PTGIMG) || this.IsPTGImageFlagSet(CommandCodes.GETACTIVE_PTGIMG) || this.IsPTGImageFlagSet(CommandCodes.PRESS_PTG_GO)) { this.isFakeAssemblyRequired = true; } } else if (this.isPM5orPACommand && (this.activeToolSelection.equalsIgnoreCase("PM5PA") || this.activeToolSelection.equalsIgnoreCase("PM5"))) { this.isFakeAssemblyRequired = true; }
return this.isFakeAssemblyRequired; }
public void traverseJsonNode(JsonNode jsonNode) { if (jsonNode.isObject()) { jsonNode.fields().forEachRemaining(entry -> { if (!((JsonNode)entry.getValue()).isObject() && !((JsonNode)entry.getValue()).isArray()) { this.sharedData.IPEPrint((String)entry.getKey() + ": " + entry.getValue()); } else { this.sharedData.IPEPrint((String)entry.getKey()); this.traverseJsonNode((JsonNode)entry.getValue()); this.sharedData.IPEPrint("---"); } }); } else if (jsonNode.isArray()) { jsonNode.elements().forEachRemaining(element -> { this.sharedData.IPEPrint("Array value: " + element); if (element.isObject() || element.isArray()) { this.traverseJsonNode(element); } }); } }
public boolean isValidDirectoryPath(String path) { try { Path filePath = Paths.get(path); return Files.exists(filePath) && Files.isDirectory(filePath); } catch (Exception var3) { return false; } }}