实例介绍
S32K144 的 hello_interrupt 移植到 MDK,使用S32K design studio中的hello_interrupt移植,其它类似。
Project 日 Project: Ipit 白 Target1 白src 国 clocks_ and modes, c a hello interrupts. c clocks and modes.h CMSIS 口 Device startup, c (Startup L S32K144 4 flashsct(Startup) L S32K144_64_ramsct(Startup) L startup_S32K144 s(Startup system_S32K144.(Startup system_S32K144h(Startup] 编译 点击编译,报如下错误 *** Using Compiler v5.06 update 5 (build 528) folder: 'C: Reil v5\ ARM\ARMCC \Bin' Bulid target Target l c2m1L1nahe11。王 ntErrupt,, src\hella_interrupta. c(8): error:#5: cannot open source input filf"$32K144h":No such file or directory #1nc1udem5彐2K144.r / include peripheral declarations 532K144* orc\hello interrupt.c: 0 warning 1 crror mp⊥ingc⊥ocks nde三.C,, include a C cdeg.c(10):error #5: cannot open source input file 532K142.h :No such file or directory s include peripheral declarations 532K144* Ic\cLocks anc mcdee. c: o warnings, 2 error assembling starti 32K144,g,, c口m1 ng startu,c,, compiling syste 532K144c ∴=cts\Lp1t.axf E〓¥二x(旦), WarnIng(g Target not created Build time elapsed: 0C: 0C: 02 Hello interrupts.c 中包含了S32K144h。 将 system S32K144c展开,它包含了S32K144h,打廾S32K14.h,在它的标签上右键, Copy ful|Path 圈画參画|r|aget1 Project hello_ interrupts.c 532K144h 日峰 Project: lpit 1曰 日認 Target1 来·he11a_ interrupts。C 米· Description: Minima1 terry src 4·*2016Har04S置iha1ik-Init clocks and modes,c 冰·2016·0ct·27·SM- Changed. LP工 6 hello interrupts. c clocks and modes h x 8 #include: ".S32K 144h 9 finc lude -clocks and modes, h ◆ CMSIS 10 11int·id1 e counter= ErCe 12 unsigned- int: pito cho flag cour tartup. c( Startup) L $32K144_64_flash sct(Startup) l4曰 void- kpI IR·(void) S32K144 64 ram sct(Startup 222 ICPR [1] IP[48]=0xA; startup_S32K144s(Startup) E-L system_$32K144cStartup) O Void PORT_init (void)i 当 cmsis armcc.h PCC->· PCCn LPCC PortI工WEX]= cmsis compiler. h 2FT->FDR|=170 PORTD->PCR [O]:=:0x 00000100 core cm4.h devassert h 26 void PORTB init (void) device reg isters. h 27甲{ C 532 core cm4, h PCC-> PCCn [PCC PORTE INDEx]= 29·PTB-PDR=1<<9 S32K144h PORTR->FCR[9]=:0g00000100 C 532K144 features h 31 32 PTB->PDDR:=.1<<10 stdboolh 3 P0RTE->FCR[10]=…0x00000100 4 stdint. h 口 system_s32k14.h 36 Fwoid. LPITO init (woid)i L system_S32K144 h(Startup) 7·PC- FCCn LPCC_LPIT- INDE!=P EXI LPITU-MCR=-0x00U00001 asas hello interrupts, c fied·b Close all but this 4□了* Close all 5「·#掉##### 斗丹丹 6|* PCe己 Copy Full Path 02/20 Version Open Containing Folder 9*米 Build 10 New Horizontal Tab Group Abst rac 2*米 Per INew Vertical Tab Group 14米*…… Copyright:(c)·1997-2016 Fresca1e· Second 15来……… Copyright2016-2017·wP 16*米……·A1· right s: reserved 17|*米 打开工程的 options,点到CC++,在 Include paths粘贴S32K144h的路径,注意去掉\S32K144h,如下: W Options for Target Target 1' Device Target Output Listing User C/C++Asm Linker Debug |Utilities Preprocessor Symbol Define Undefine Language /Code Generation □ Execute-only Code 厂 Strict ans|C Wamings: Optimization: Level 0(-00 厂 Enum Container always int All W rings 厂 Optimize for Time 厂 Plain Char is Signet 厂 Thumb Mode Split Load and Store Multiple 厂 Read-only Position Independent厂 No auto nudes v One ELF Section per Function Read-Write Position Independent v C99 Mode nclude C: Keil_v5VARM\PACK( Keil\ S 32_SDK_DFP(1.1. platfom \devices\S32K144 include 5 Compiler - c99c-cpu Cortex-M4fp g-00-apcs=interwork-split_sections I rtulc:/Kalws/ARMFACK/Ke/s32SDKDF110atm/deces/s32144/ncude/Ss32K144h string OE Cancel Defaults Hel P 再次编译,报如下错误 whiled(->SPLL求鼻SLCLⅥDsE〕/x·W-Ex·SL-1 to HoTham· EUN Td 米·IⅥU3-1,山。by2:uuLk-·40· Cl slow, flash clock=:26 2/3.MH=* hile I((S->CR高 :16=x工 E Proect Books ( Functions O, Templates. build oUtput CCR DIVCORE (0bo1) /* DIVCoRE=l, div. by 2: Ccre clock 160/2 MHz B0 Miz*/ LG RCCR DIVEU5(0b01) / DIVBUS=1, div. by 2: bus clock =40 MHz*/ GG RCCR DIVELOR (0b10)J / DIvSLoW=2, div, by 2: SCG glow flash clock 26 2/3 MHz* grc\clocks and modes.=: o warnings, 5 errors compiling tartu 这个编译错误应该是与编译器支持有关,我没有细究,直接换 ARM Compiler6,如下: W Options for Target Target 1 Device Target Output Listing User( C/C++ (ACB))Asm Linker Debug ]Utilities I NXP 532K144AoxLLx Code generation Xal(MHz) ARM Compiler Ise default compiler version 6 erating system:None System viewer File Use Cross-Module Optimization S 144svd 厂 Use Nicole 厂 Big Endian 厂 Use Custom file Read Only Memory Areas Read rite Memory Areas default off-chip Start Startup default off chip Start IEe NoInit 厂ROM1 厂RAM1 ROMZ 凡AM2 ROM1 RAM3 ch IROMZ 厂|RAM2pFk OE Cancel Defaults Hel P 日 Project: Ipit 日謫 Target1 sIt 由国 cocks and modes, c 由圖 hello interrupts. c clocks and modes, h ◆CMSS De EICE +-S startup c(Startup) L startup_$32K1445(Startup) +)-a system_S32K144c(Startup system. S32K144h(Startup L 532K144_64_flashLAC6, Fct(Startup 532K144_64_ram_Ac6.Ect(Startup 再次编译报如下错误: \Objects\pit axf: Error: L6218E: Undefined symbol Image SSRW_m_datasSBase(referred from startup. o) Objects\pit axf: Error: L6218E: Undefined symbol Image SSVECTOR RAMSSBase(referred from startup. o) oBjects \pit axf: Error: L6218E: Undefined symbol Image SsvECtoR ROMSSBase referred from startup. o) .\Objects\lpit axf: Error: L6218E: Undefined symbol ImageS SARM_LIB_STACKS SZIS Limit (referred from startup s32k1440 6 compiling cloc<s and modes.C. compiling star-up assembling startup 532K144s compiling hello interrupts compIling aystem 532K144C linking \Objects\Ipit axf: Error: L62-BE: Undefined symbol ImmagessRW m datassBage (referred fromm startup. o) \Objects\lpit axf: Error: L6218E: Undefined symbol ImageS SVECTOR RAMSSBase (referred from startup. o) \Objects\lpit axf: Error: L62I8E: Undefined symbol ImagesSVECTOR RON$SBase (referred from startup. o) e1t,a发:Ex:L2日E:UeEm1工 mageSSARM LIB STACKS工$工m( referred from ot enough inf。2na七i。nt1i3t1 gad addre3se3 in the image map Finished: iInformation,o warning and 4 error messages R\Objects\lpi=. axfh-4 ErrorIs)0 Warning (s) Target not created Bulid Time Elapsed: 00:00: 03 打开 startup. c,看到如下当使用 ARM Compiler时,变量的定义: · addre③已区·for:ECTO3 TABLE·and·环 TOR RA· come from·the1 inker. f1e·* extern uint 32 t. RAM VECTOR TABLE SIZE LI 110 extern uint 32 t:- ECTR R TABLE LI 111 ester·uint32t· ECTOR FU[] 112 Get· sect lor· information from·1 inker. fi1ea·x 114 F*if defined(_ICCARN__ 115 116 dat a raT eation begin(. data" ·data se=tion begin(". dat a init 118 section end(". data init") /· CODE RAM· CODE ROM pragma sect1011= ODE RAM code ral et1 on bea1(,_C0D上AW) ion bo CODE FM section end( DE RUM ion begin(. bss") tion 冰·ARM· Compiler4/5·or· RL Compiler6( armclang〕 132#elif:(defined(CC_AFM) RM FST0N〕8 CCME3ST0M>=6010050) extern uint 32_t ImaE$DVECTOR_ ROMSSBase extern uint 32 t ImaseSfVECTOR RAMS$Base l extern uint 32_t ImageS 捉Wm_data$归ase[] #define. VEC TOF TABLE ImageSSVECTOR ROMESBase tdefine TOF RM ImageS TECTOR RAM$SBase 140#deireRAvECTOETAFLESZE((urt32t)Inage8Tmdata事a6-:t:32t)1mage亦ECTRRA时ase 141 14 els exLeLrL ULILL 145 户xt=rn-nint3十DT↓R点L」 146 ert erl uint 32 t DaTA END[ 14 extern uint 32 t DE RAM LI enter1int32t· CODE RO重 在 linker时没有使用该分散加载文件。打开S32K14464 flash.st文件,如下定义: i helic interrupts.c startup. c. $ 64 flash AC6.sct T:睿c15 日园src 国 cocke ard moder; 田-□ helo_interrupts. c 帝cM rine且ea_3i 田 startup. r(Startup) a startup_$32K. 44. s(Startup) t-L system_S32KC44c(Startup) 739:58:ay图 p ions far larget1a:2 L sysle S32K L4. h GSlarlup) kW_a dat start Device Target]Outp z: Listing user C/++ C6) Asn . aker [ebu: I 's:ilities I 1 532K144 04 sh ACG. cl ( Slarlup) 532K144_64_am_AC6. sct (Startup y kea Menory Layout from Target )acg Mawe RW SectiJlls Pusiliurt Iu-utridel R/O BaaG: ncnonnnom ALIE_皿 Mase RO Sections Position Independent H/W Base 02000C003 游,D n.5 earc standard Lban图 N Rapar might farC-andrians as Fmr disable Waning Objects vpr, act 08 IR n flash Help 而默认 Use Memory layout from Target Dialog,则使用 options的 Target中配置的ram和rom生成的st文件: hello. interrupts. c G startup. c 532K144-64_flash_AC5. sct Ipit sct c·***求求冰*米米求*冰浓水*冰冰*家水宋冰水*水米水水米家水家常*家****求*冰**客*x * Scatter- Loading. Description·F1e· generated by uvi20来冰冰 5LR_IRO1·x00000·z00080…{………:10ad· egion's14eIeglor ER IEOM1·0x00000000·000u80000[…10ad· addre·=·日 recut ior· addre ,口·( RESET,十Fi8t) *( Inroot sEctions ANY:(+10 11 12RIRA10x2000000·x0T000·[·:R平data ATI(+RW +II) 1 15} W Options for Target 'Target 1' Device Target Output Listing User C/C++ (AC6) Asr LinkerDebug 11ti色E Use Memory Layout from Target Dialog X/ Base Make RW Sections Position Independent R/O Base: CxDDDDODDD Make RO Sections Position Independent R/ Base D20000000 Dont search standard libraries v Report might fail Condtions as Erors disable Wamings S式 er . \ Objects pit. ct Edit 修改使用S32K144_64fash.sct文件: w Options for Target Target 1' Device Target Output Listing User C/C++ (AC6) Asm Linker Debug I Utilities Use Memory Layout from Target Dialog X/O Base Make RW Sections Position Independent R/O Base: Ox00000000 Make RO Sections Position Independent R/ Base D20000000 Dont search standard Libraries v Report might fail Conditions as Erors disable Wamings Scatter RTE Device S32K LLx\S32K144 64 flash AC6 sct Edit File Linker「cpu= Cortex-Mv4jo control -strict - scatter".Objects\pit.ect stand OE Cancel Defaults Hel P 再次编译成功: Build Outpu ★*★U三 ing Compi1ex"6.7',f1dex:"C:Rei1v5\BM\ ARMCLANG\Bin B工1 d target" TarcEt1" linkIng.. Program1ze:C。d日=752R-data=1056RW-data=0Z工-aata=2056 \Obiects\lpit. axf-0 Error(s) 0 Warning (s) Build Time Elapsed: 00: 00: 00 四、运行 我配置 Debug使用JL|NK: w Options for Target Target 1' Device| Target Output Listing User C/C++ (AC6)|Asm Linker Debug Utilities C Use Simulator with restrictions Settings G Use: J-LINK/J-TRACE Cortex Settings 厂 Limit Speed to Real-Time v Load Application at Statup N Run to maino N Load Application at Startup Run to maino Initialization file Initialization file Edit Edit Restore Debug Session Settings Restore Debug Session Settings ⅴ Breakpoints Toolbox Breakpoints A Tool v Watch Windows& Peformance Analyzer v Watch Windows v Memory Display f System Viewer Memory Display v system Viewer CPU DLL. Parameter Driver dll Parameter SARMCM3. DLL-MPU SARMCM3. DLLMPU Dialog DLL Parameter. Dialog DLL: Parameter DCM. DLL CMa TCM.DLL CM4 Manage Component viewer Description Files DE Cancel Defaults Hel P Cortex JLink/ Trace Target Driver Setup Debug Trace Flash Download T-Link /J-Trace Adapter sl levice Move ep1 Device J-Link SITIC ⊙0x2BA ARM CoreSight sI-DP g.40 d1W616 Tk y compiled LoT M a tic let A证t。C1 Add Delete upd IR len pti ons Cache opti ons ct: Normal Reset orm v Cache Code Verify Code jowl Y Reset after Conn Cache mem ory Download to Fl C Usb C ICe/IP-Network Settings 工P- Addres Port Autodetect JLink Info PIn State:ready 匚确定职消」应用63 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论