【正文】
于由ARM指令的代碼生成一個(gè)ELF格式的可執(zhí)行映像文件。在Project name框中輸入工程文件名,單擊Location文本框Set按紐,瀏覽選擇工程保存的路徑,設(shè)置好后即可建立一個(gè)新的工程。圖52 新建對(duì)話框添加源程序到工程中如圖53所示,在建立好一個(gè)工程時(shí),默認(rèn)的target是DebugRel。DebugRel:使用該目標(biāo),在生成目標(biāo)的時(shí)候,會(huì)為每一個(gè)源文件生成調(diào)試信息。圖53 新建工程編譯和鏈接工程 單擊Edit菜單,選擇DebugRel Settings菜單項(xiàng),出現(xiàn)如圖54所示的對(duì)話框。 圖54 設(shè)置對(duì)話框(1)、Target Setting選項(xiàng) 如上圖所示,Target Name文本框顯示了當(dāng)前的目標(biāo)設(shè)置。 Linker下拉列表框供用戶選擇要使用的鏈接器。在這里默認(rèn)選擇的是ARM Linker,使用該鏈接器,將使用armlink鏈接編譯器和匯編器生成的工程中的文件相應(yīng)的目標(biāo)文件。 Prelinker:目前Code Warrior IDE不支持該選項(xiàng)。 PostLinker:選擇在鏈接完成后,還要對(duì)輸出文件進(jìn)行的操作。在這里選擇ARM formELF表示在鏈接生成映像文件后,再調(diào)用FormELF命令將含有調(diào)試信息的ELF格式的映像文件轉(zhuǎn)換成其他格式的文件。(2)、Language Setting選項(xiàng)ARM匯編器就是armasm,默認(rèn)的ARM體系結(jié)構(gòu)是ARMTDMI,字節(jié)順序默認(rèn)是小端模式。其它設(shè)置就用默認(rèn)值即可。如圖55所示。圖55 ARM匯編器設(shè)置(3)、Linker設(shè)置選擇ARM Linker,出現(xiàn)如圖56所示對(duì)話框。 圖56 ARM Linker設(shè)置在Output中,Linktype選項(xiàng)區(qū)域中提供了3種鏈接方式。Simple方式是默認(rèn)的鏈接方式,也是最為頻繁使用的鏈接方式,它連接生成簡(jiǎn)單的ELF格式的目標(biāo)文件,使用的是鏈接器選項(xiàng)中指定的地址映射方式。RO Base這個(gè)文本框設(shè)置包含有RO段的加載域和運(yùn)行域?yàn)橥粋€(gè)地址0x0c008000。RW Base這個(gè)文本框設(shè)置了包含RW和ZI輸出段的運(yùn)行域地址0xc200000。在Linker下還有一個(gè)ARM formELF實(shí)現(xiàn)將鏈接器,編譯器或匯編器的輸出代碼進(jìn)行格式轉(zhuǎn)換的功能。如上圖所示。在Output format下拉框中選擇Plain binary,這是一個(gè)二進(jìn)制格式的可執(zhí)行文件,可以被燒寫到目標(biāo)板的Flash中。在Output file name文本域輸入期望生成的輸出文件存放的路徑。(4)、編譯和鏈接點(diǎn)擊Code Warrior IDE的菜單Project下的make菜單,就可以編譯和鏈接了。整個(gè)編譯鏈接過(guò)程如圖57所示: 圖57 編譯顯示超級(jí)終端調(diào)試使用超級(jí)終端通過(guò)串口進(jìn)行硬件調(diào)試,首先打開(kāi)超級(jí)終端界面通過(guò)設(shè)置選擇串口1,并輸入波特率進(jìn)行通訊,然后接好主機(jī)與開(kāi)發(fā)板的串口線,使步進(jìn)電機(jī)和開(kāi)發(fā)板上電。在調(diào)試程序前先燒好開(kāi)發(fā)板啟動(dòng)程序,上電后按復(fù)位鍵,在超級(jí)終端上顯示界面如圖58所示。圖58 超級(jí)終端界面顯示如圖59所示,下載生成的映像文件bj_dj到RAM中開(kāi)始地址為:0x0c008000,然后進(jìn)行調(diào)試。圖59 下載文件顯示調(diào)試程序運(yùn)行產(chǎn)生界面如圖510所示; 圖 510 運(yùn)行界面顯示程序燒寫過(guò)串口進(jìn)行燒寫,先下載要燒寫的文件,用protect off 指令對(duì)要拷貝的空間進(jìn)行解除保護(hù),接著用erase命令擦除此空間的內(nèi)容,再用cp命令進(jìn)行拷貝文件,用setenv進(jìn)行批處理,最后保存。如圖511為復(fù)位后直接到保存地址運(yùn)行程序。圖511 運(yùn)行程序界面5.4 故障分析及調(diào)試結(jié)果(一)故障分析 電機(jī)的噪音特別大;而且沒(méi)有力,電機(jī)本身在振動(dòng)?如遇到這種情況時(shí),是因?yàn)椴竭M(jìn)電機(jī)工作在振蕩區(qū),一般改變輸入信號(hào)頻率CP就可以解決此問(wèn)題。電機(jī)在低速運(yùn)行時(shí)正常,當(dāng)是頻率略高一點(diǎn)就出現(xiàn)堵轉(zhuǎn)現(xiàn)象?遇到這種情況多是因?yàn)榧釉隍?qū)動(dòng)器的電源電壓不夠高引起的;把輸入電壓加高一些,就可以解決此問(wèn)題,注意不能高于驅(qū)動(dòng)器電源端標(biāo)注的最高電壓;否則會(huì)引起驅(qū)動(dòng)器燒毀. 驅(qū)動(dòng)器通電以后,電機(jī)在抖動(dòng),不能運(yùn)轉(zhuǎn)?遇到這種情況時(shí),首先檢查電機(jī)的繞組與驅(qū)動(dòng)器連接有沒(méi)有接錯(cuò);如沒(méi)有接錯(cuò)再檢查輸入頻率CP是否太高;是否升降頻設(shè)計(jì)不合理,參考升降頻設(shè)計(jì);以上原因都不是,可能是驅(qū)動(dòng)器燒毀.(二)調(diào)試結(jié)果通過(guò)不斷的調(diào)試步進(jìn)電機(jī)能夠正常工作,步進(jìn)電機(jī)的速度在一定范圍內(nèi)是可調(diào)的,控制值輸入越大其速度越慢。參考文獻(xiàn)[1] 田澤 編著 嵌入式系統(tǒng)開(kāi)發(fā)與應(yīng)用 北京航空航天大學(xué)出版社發(fā)行 2005年1月第一版[2] 于海生等 編著 微型計(jì)算機(jī)控制技術(shù) 清華大學(xué)出版社1993年3月第一版 [3] 杜春雷 編著 ARM體系結(jié)構(gòu)與編程 清華大學(xué)出版社2003年2月第一版[4] 馬忠梅、馬廣云、徐英慧、田澤 編寫 ARM嵌入式處理器結(jié)構(gòu)與應(yīng)用基礎(chǔ) 北京航空航天大學(xué)出版社發(fā)行 2002年1月第一版[5] [英] Steve Furber 著 ARM System_on_chip Architecture second edition 北京航空航天大學(xué)出版社發(fā)行 2002年10月第一版[6] 李駒光 著 ARM 應(yīng)用系統(tǒng)開(kāi)發(fā)詳解基于S3C44B0X的系統(tǒng)設(shè)計(jì)[M].清華大學(xué)出版社 2004年版[7] 32位嵌入式系統(tǒng)實(shí)驗(yàn)儀實(shí)驗(yàn)指導(dǎo)書[M].啟東計(jì)算機(jī)總廠 2004年[8] 周立功 編著 ARM嵌入式系統(tǒng)基礎(chǔ)教程 北京航天航空大學(xué)出版社 2005/1[9] 譚浩強(qiáng) 著 C程序設(shè)計(jì) 清華大學(xué)出版社 2001年版致謝在我畢業(yè)論文完成之際,我向畢業(yè)設(shè)計(jì)指導(dǎo)老師張紅琴老師,電信學(xué)院的老師以及我的同學(xué)致以最真誠(chéng)的謝意!為期數(shù)周的畢業(yè)設(shè)計(jì)結(jié)束了,留給我感觸很深,體會(huì)也很多。我們面對(duì)一個(gè)陌生的項(xiàng)目、陌生的知識(shí)中,總是會(huì)遇到很多的困難。這期間流給我的經(jīng)驗(yàn)教訓(xùn)是彌足珍貴的。在畢業(yè)設(shè)計(jì)以及論文寫作中,由于本人水平有限,在做畢業(yè)設(shè)計(jì)的過(guò)程,張老師給予我很大的幫助、鼓勵(lì)和關(guān)懷。每次指導(dǎo)時(shí),張老師總是認(rèn)真而又耐心地幫我分析問(wèn)題,,每次講解之后,讓我受益匪淺,開(kāi)拓了專業(yè)理論知識(shí),同時(shí)在論文寫作上也取得了很大的進(jìn)步。老師的學(xué)識(shí)以及對(duì)工作治學(xué)嚴(yán)謹(jǐn)?shù)膽B(tài)度讓我敬佩。在此,再向她表示最衷心的感謝。我還要感謝我的同學(xué)特別徐英同學(xué)和于春雨同學(xué),他們也幫我提出了寶貴的建議。在寫作過(guò)程中,我還參考和吸收了學(xué)術(shù)界、理論界專家學(xué)者們的有關(guān)研究成果。在此,謹(jǐn)向他們表示敬意。老師您們辛苦了!謝謝!附錄附錄一 中英文文獻(xiàn)OPERATING SYSTEMSThe operating system is a program that manages the puter’s resources, provides services for programmers, and schedules the execution of other programs. A limited understanding of operating systems is essential in understanding the mechanisms by which the CPU controls the puter system . In particular , explanation of the effect of interrupts and of the management of the memory hierarchy are best explained in this context. An operating system is a program which acts as an interface between a user of a puter and the puter hardware . The purpose of an operating system is to provide an environment in which a user may execute programs . An operating system is an important part of almost every puter system . A puter system can be roughly divided into 4 ponents:@ The hardware ( CPU , memory ,I/O devices ).@ The operating system .@ The applications programs( pilers , database systems , video games , business programs ). @ The users (people, machines or other puters ).The chapter looks at the two operatingsystem functions that are most relevant to the study of puter organization and architecture: scheduling and memory management. Operating System Objectives and Functions : An operating system is a program that controls the execution of application programs and acts as an interface between the user of a puter and the puter hardware . An operating system can be thought of as having two objectives or performing two functions:Convenience: An operating system makes a puter system more convenience to use .Efficiency: An operating system allows the puter system resources to be used in an efficient manner.The Operating System as a User / Computer Interface,we discussed the hierarchical nature of a puter system , referring to hardware . That view can be extended to the software that is executed on the puter . In most cases , the ultimate use of the puter is to provide one or a set of applications . The user of those applications is called the end user and generally is not concerned with the puter’s architecture. Thus the end user views a puter system in terms of an application . That application can be expressed in a programming language and is developed by an application programmer . Now , it should soon bee clear that if one were to develop an application program as a set of machine instructions that is pletely responsible for controlling the puter hardware , one would be faced with an overwhelmingly plex task . To ease this task , a set of system programs is provided . Some of these programs are referred to as utilities . These implement frequently use functions that assist in program creation , the management of files , and the control of I/O devices . A programmer will make use of these facilities in developing an application , and the application , while it is run