欢迎来到天天文库
浏览记录
ID:58313919
大小:53.29 KB
页数:7页
时间:2020-09-06
《如何在ST7的RAM中执行代码.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、APPLICATIONNOTEEXECUTINGCODEINST7RAMby8-BitMicroApplicationTeam1INTRODUCTIONThepurposeofthisdocumentistogivesomeguidelinesabouthowtowriteandexecuteas-semblycodeinRAMwiththeST78-bitMicrocontroller.2ST7MEMORYMAPPINGThememorymappingintheST72251isshowninthefollowingfigure.0000hH/WRegisters
2、0080hShortAddressing007FhRAM(zeropage)0080h00FFh0100hRAM16-bitAddressing(256Bytes)RAM013Fh017Fh0140h0180hStack64bytesReserved017FhDFFFhE000hROM(8KBytes)ST72251MemoryMappingFFDFhFFE0hInterrupt&ResetVectorsFFFFhTheST7RAMandROMlocationsareaddressedandreadinthesameway.FortheST7corefetching
3、anddecodinginstructionslocatedeitherinRAMorROM,takethesametime,thereisnolimitationexecutingcodeinRAM.ButthedifficultiescomefromthefactthattheRAMcontentisundeterminedafterpower-up.SotheRAMlocationshavetobefilledwiththecodeafterreset.Therearetwowaystodothat:–ThecodeislocatedintheST7ROMan
4、discopiedinRAMafterreset.AN985/10981/71–ThecodeisloadedintheRAMthroughexternalcommunication.TheapplicationdoesnotneedspecialinstructionstoexecutecodeinRAM.Butthemanage-mentofthelabelsinRAMhastobedonecarefully.Thecodehastofollowthe“BYTES”directiveifitislocatedintheshortaddressRAMnamed“z
5、eropage”(usuallyfrom80htoFFh).Alllabelsaretreatedintoaccountasbytes.IfthecodeislocatedinRAMlocationsabovetheaddress100h,ithastofollowthe“WORDS”di-rective.3CODECOPIEDFROMST7ROMTORAMAsdescribedinthesoftwareexampleattheendofthisdocument,weareusingST7directiveswhichallowyoutostore,inaROMse
6、gment,thecodetobeusedinRAM.Thedirectivesusedinourexampleare:segmentbyteat100-13F'ram1'segmentbyteatEF00-FFDF'romtocop'segment'ram1>romtocop'Thecodewritteninthe‘romtocop’segmentisacopyofthe‘ram1’segment.Thevolatilecodeisthenstoredinanonvolatilelocation(the‘romtocop’segment).Soaftereachr
7、eset,thefirstinstructionoftheapplicationmustbetranslatedfromthe‘romtocop’segmenttothe‘ram1’segment.Inthesoftwareexamplegiveninthisapplicationnote,thetworoutinesnamed“addition”and“subtraction”arelocatedinthesegment‘ram1>romtocop’.Afterbeingcopiedinthe‘ram1’segmenttheroutinescanbeexecu
此文档下载收益归作者所有