"column lists do not match"为什么会出现这样的错误?

zyn01 2003-05-09 10:23:23
系统提示
datawindow error
select error:column lists do not match
由于现在没法调试,一时也搞不清怎么会出这个错误,大概是由于什么原因呢?
...全文
998 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ahuanghp 2003-05-09
  • 打赏
  • 举报
回复
应当是在数据库中存在的表字段与你SQL SELECT的语句中的字段不配
可以与数据库比较一下
zyn01 2003-05-09
  • 打赏
  • 举报
回复
数据源是SQL SELECT型的
xjunhua 2003-05-09
  • 打赏
  • 举报
回复
你的数据窗口是不是通过SQL 语句来动态创建的啊

如果是的, 那就是列有问题啊
Keyboard shortcuts A quick reference guide to UltraEdit's default keyboard shortcuts Keymapping and custom hotkeys How to customize 键映射s and menu hotkeys Column Markers The benefit of a column maker is that it can help you to format your text/code, or in some cases to make it easier to read in complex nested logic. Quick Open UltraEdit and UEStudio provide multiple methods to quickly open files without using the standard Open File dialog. A favorite method among power users is the Quick Open in the File menu. The benefit of the quick open dialog is that it loads up very... Vertical & Horizontal Split Window This is a convenient feature when you're manually comparing files, when you want to copy/paste between multiple files, or when you simply want to divide up your edit space. Tabbed Child Windows Declutter your edit space by using the tabbed child windows feature Auto-Hide Child Windows When you're deep in your code, the most important thing is editing space. The all new auto-hide child windows give you The all new auto-hide child windows allow you to maximize your editing space by hiding the child windows against the edge of the editor. Customizing toolbars Did you know that you can not only change what is on UltraEdit's toolbars, you can also change the icon used, as well as create your own custom toolbars and tools? File tabs Understand how file tabs can be displayed, controlled and configured through the window docking system in UltraEdit/UEStudio. Create user/project tools Execute DOS or Windows commands in UltraEdit or UEStudio Temporary Files UltraEdit and UEStudio use temporary files... but what are temporary files? This power tip provides an explanation as well as some tips to get the most out of temp files. Backup and Restore Settings One of the staples of UltraEdit (and UEStudio) is its highly configurable interface and features. However, what happens when you're moving to a new system and you want to port your settings and customizations over along with UltraEdit? Add a webpage to your toolbar Use UltraEdit's powerful user tools to launch your favorite website from the click of a button on your toolbar Integrate Yahoo!, Google, Wikipedia and more with UltraEdit This tutorial will show you how to access the information you need in your browser by simply highlighting your text in the edit window and clicking your toolbar button How to install UE3 UE3 is the portable version of UltraEdit developed specifically for the U3 smart drive. You will need a U3-compatible USB drive for this power tip Scripting tutorial An introduction to UltraEdit's integrated scripting feature The List Lines Containing String option in Find The lists lines option can be a handy tool when searching because it presents all occurrences of the find string in a floating dialog box. You can use the dialog to navigate to each instance by double-clicking on one of the result lines... Scripting Access to the Clipboard How to access the Clipboard using the integrated scripting engine Scripting access to output window How to access the output window using the integrated scripting engine Writing a macro Steps to record and edit powerful macros to quickly and efficiently edit files Using "copied" and "selected" variables for dynamic macros Use copied and selected text in macros to dramatically increase the power and flexibility of UltraEdit macros Run a macro or script from the command line We are often asked if it is possible to run an UltraEdit macro or script on a file from the command line. The answer is yes - and it's not only possible, it's extremely simple! Using find/replace UltraEdit and UEStudio give you the ability to perform a find or replace through one or more files. Learn how to use UltraEdit/UEStudio's powerful find and replace. Multiline find and replace Search and replace text spanning several lines Incremental search Incremental search is an inline, progressive search that allows you to find matched text as you type, much like Firefox's search feature Regular expressions Regular Expressions are essentially patterns (rather than specific strings) that are used with Find/Replace operations. This guide can dramatically improve your speed and efficiency for Find/Replace Tagged expressions "Tagging" the find data allows UltraEdit/UEStudio to re-use the data similar to variable during a replace. For example, If ^(h*o^) ^(f*s^) matches "hello folks", ^2 ^1 would replace it with "folks hello". Perl compatible regular expressions An introduction to using Perl-style regular expressions for search/replace Perl regex tutorial: non-greedy regular expressions Have you ever built a complex Perl-style regular expression, only to find that it matches much more data than you anticipated? If you've ever found yourself pulling your hair out trying to build the perfect regular expression to match the least amoun... Remove blank lines A question we often see is "I have a lot of blank lines in my file and I don't want to go through and manually delete them. Is there an easier way to do this?" The answer is: yes! Configure FTP Set up and configure multiple FTP accounts TaskMatch Environments How to use TaskMatch Environments in UltraEdit and UEStudio Configure FTP backup Save a local copy of your files when you transfer them to FTP directories Encrypt and Decrypt Text Files Use UltraEdit to encrypt and decrypt your text files Link to remote directories Sync local directories with remote (FTP/SFTP) directories Compare Modified File Against Source File How to compare the modified file against the source file on disk. Column Based Find and Replace Need to restrict your search/replace to a specific column range? The column based search does just that... Compare Highlighted Text If you need to quickly compare of portions of text, rather than an entire file, then you need UltraEdit/UEStudio's selected text compare! The selected text compare allows you to select portions of text between 2 files and execute a compare on ONLY the se Using the SSH/telnet console A tutorial for UltraEdit/UEStudio's SSH/telent feature Adding a wordfile Adding a wordfile in UltraEdit v15.00 and greater Adding a wordfile (in v14.20 and earlier) Add a language definition to your wordfile for use with UltraEdit and UEStudio's powerful syntax highlighting Syntax highlighting and code folding Explanation of highlighting and folding definitions in the UltraEdit/UEStudio wordfile Create Your Own TaskMatch Environment How to create your own TaskMatch Environments Filtering the Explorer View How to filter the Explorer view in UltraEdit and UEStudio Group Files and Folders with Projects How to group your files and folders using Projects Adding or removing file extensions for syntax highlighting How to configure syntax highlighting to highlight different file types automatically Project Settings Advanced Project Features - Using the UltraEdit/UEStudio project settings dialog Scripting Techniques Scripting techniques for UltraEdit/UEStudio. Perl-style regular expressions for function strings Using Perl-Style regexes to identify functions in your syntax-highlighted files and populate the function list Autocorrect keywords in UltraEdit/UEStudio How to enable and disable autocorrect keywords with syntax highlighting Insert Menu Commands UltraEdit includes several special insert functions under the Insert menu. You can use these functions to insert a file into the active file, insert a string into the file at every specified increment, sample colors from anywhere on your screen, and more. Using Bookmarks UltraEdit and UEStudio provide a way for you to mark, access, and preview your favorite lines via bookmarks. We'll look at how to create, edit, and configure bookmarks in the bookmark viewer. Creating Search Favorites UltraEdit includes a Search and Replace Favorites feature that allows you to manage frequently used Find and Replace strings. Create, name, and edit your Search and Replace Favorites... Customizing The HTML Toolbar Commands The purpose of this power tip is to teach you how to customize the existing HTML tags and create your own HTML tags. Combine All Open Files into a Single Destination File Have you ever needed to combine multiple files into a single destination (output) file? You can use a combination of a script and tool to create a single file from multiple files. Sum Column/Selection in Column Mode This power tip demonstrates how to calculate the sum from a column of numeric data. Column mode How to use the features of UltraEdit's powerful column mode Advanced and column-based sort How to sort file data using the advanced sort options and the column sort options Working with CSV files Use UltraEdit's built-in handling for character-separated value files Word wrap and tab settings for different file types UltraEdit and UEStudio allow you to customize the word wrap and tab settings for any type of file. This power tip walks you through the steps to configure these customizations Versioned backup Set UltraEdit/UEStudio to automatically save versioned backups of your files Configure spell checker How to set the highly-configurable options for UltraEdit's integrated spell checker Special functions UltraEdit includes several special functions under the File menu. You can use these functions to insert a file into the current file, delete the active file, send the file through email, or insert a string into the file at every specified increment HTML preview Edit and preview your rendered HTML code in the edit window Custom templates Create templates for frequently used text. You can also assign hotkeys to your templates. Compare files/folders Integrated differences tool - comparing files and folders with UltraCompare Professional File change polling Monitor log files and more using UltraEdit's file change polling feature Vertically split the edit window Splitting the edit window in UltraEdit/UEStudio Large file text editor UltraEdit can be used to edit large text files. Learn how to configure UltraEdit to optimize editing large text files Multiple configuration environments of Ultraedit/UEstudio How to set up your separate environments for UltraEdit/UEStudio Java compiler Create a custom user tool to compile Java code, using the command line, from within UltraEdit Configure UltraEdit with javascript lint How to check your JavaScript source code for common mistakes without actually running the script or opening the web page Character properties at your fingertips Access the properties of a character with the click of a button Ctags Set up and configure Ctags for use in UltraEdit Visual SourceSafe integration Create a customized user tool to check out files from Visual SourceSafe Running WebFOCUS from UltraEdit Configure UltraEdit for use with WebFOCUS CSE HTML Validator CSE HTML Validator for Windows is the most powerful, easy to use, user configurable, and all-in-one HTML, XHTML, CSS, link, spelling, and accessibility checker available. This quick tutorial shows you how to use it and set it up in UltraEdit/UEStudio Working with Unicode in UltraEdit/UEStudio In this tutorial, we'll cover some of the basics of Unicode-encoded text and Unicode files, and how to view and manipulate it in UltraEdit. Search and delete lines found UEStudio and UltraEdit provide a way for you to search and delete found lines from your files. This short tutorial provides the steps for searching for and deleting lines by writing a simple script. Parsing XML files and editing XML files Parsing XML can be a time-consuming task, especially when large amounts of data are involved. As of v15.10, UltraEdit provides you with a the XML Window for the purpose of parsing your XML files. The XML window allows you to navigate through the XML... Using Bookmarks UltraEdit and UEStudio provide a way for you to mark, access, and preview your favorite lines via bookmarks. We'll look at how to create, edit, and configure bookmarks in the bookmark viewer. Using the CSS style builder UltraEdit and UEStudio both include a CSS style builder for you to easily configure and insert CSS styles into the active document. This power tip will show you how to use the style builder. SSH/Telnet Session Logging Log the input and output to/from the server in your SSH/Telnet sessions Edit, develop, debug, and run SAS programs This user-submitted power tip describes how to use UltraEdit as a SAS editor, as well as how to run and debug SAS programs from the editor itself Tabs to Spaces - Ignore tabs and spaces in string and comments Ever had to convert the tab characters to spaces, but wanted to leave the tabs in strings and comments untouched? In previous versions, the convert tabs to spaces feature didn't distinguish between tabs as whitespace/formatting vs. tabs in... Setting File Associations in UltraEdit/UEStudio A file association is used by Windows Explorer to determine which application will open the file when it is double-clicked (or opened) in Explorer. In the interest of speed, many UltraEdit/UEStudio users want to associate specific file types with... Windows Explorer Integration We know that many UltraEdit/UEStudio users don't operate solely from within the editor; rather, they are frequently working in Windows Explorer before going to the editor. As such, they want (and need) a quick and easy way to open files from within... Line Change Indicator Ever wanted to see what changes you've made since your last save, or have you ever wanted to know what lines you've changed during an edit session? As of UltraEdit v16.00, you can do just that with the line change indicator... Comment and Uncomment Selected Text How many times per day do you comment out a block of code? Do you ever get tired of manually typing your open and close comments? As of v16.00, simply highlight your code, click a button, and move on. It's that easy... Hide, Show, and Delete Found Lines in UltraEdit/UEStudio Over time, many of our users have asked for the ability to hide/show lines based on a Find string... you got it! As of v16.00, you can now hide/show and even delete text based on your search criteria. The following power tip will guide you through... Read Only Status Indicator Have you ever opened a file, tried incessantly to modify it, then realized it was read only? As of v16.00, UltraEdit includes an enhanced read only status indicator. For read only files, the file tab will display a lock icon. Additionally, you can... Regular Expression Builder Regular Expressions are essentially patterns, rather than literal strings, that are used to compare/match text in Find/Replace operations. As an example, the * character in a Perl regular expression matches the preceding character or expression zero or.. XML Manager: In-line editing of XML files The XML Manager allows you to navigate through complex XML data. But, what happens when you want to make a quick edit to your XML tags/data.... UltraEdit v16.00 extends the XML Manager with inline editing, giving you a faster and more elegant method... UltraEdit v16.00 Scripting Enhancements One of UltraEdit's trademark features is the ability to automate tasks through scripting. V16.00 extends the power of scripting further with includes, active document index, and more! Parse Source Code with the Function List The function list displays all the functions in the active file/project. Double clicking on a function name in the list repositions the file to the desired function. Also, as you navigate through a file, the function selected in the list changes to indica Brace Matching Brace matching is an often-used feature; it is indispensable for navigating through your code. Brace matching simply allows you to position your cursor next to an open (or close) brace and highlight the corresponding brace. Code Folding Code folding is indispensable for managing complex/nested code structures. Code folding allows you to collapse (hide) a section of code. The collapsible sections are based on the structure of the file/language Shared FTP accounts Do you use multiple IDM products - UltraEdit, UEStudio, or UltraCompare? Ever get sick of managing your FTP account information in each application? Now you can stop worrying about porting your FTP account settings! Simply configure it once and share you Auto-load macro with project Many UltraEdit/UEStudio users rely heavily on projects - and why not, projects are extremely helpful in managing related files and folder. Projects not only allow you to group/manage your files and folders, but projects also contain other items that... UEStudio 使用技巧 Using the classviewer A tour of UEStudio's classviewer which provides a parsed graphical representation of your project CVS/SVN Auto-Detect UEStudio can automatically detect and import your CVS/SVN account settings when you import a folder already under version control. IntelliTips UEStudio offers language intelligence in an exciting feature we call IntelliTips (like Intellisense). Imagine a function parameter list tooltip coupled with an intelligent auto complete tooltip for code elements of the current file Quickstart guide: Using UEStudio to develop Java applications A guide for using UEStudio to edit and develop Java applications Create a local PHP MySQL development environment How to set up a development environment for PHP/MySQL on your local machine. A development environment allows you to test your code as you develop your web application before publishing it to the web. Quickstart Guide: Using UEStudio with Borland C/C++ Compiler C/C++ developers can use UEStudio to set up and configure projects with the Borland C/C++ compiler Creating your first application Create, build, and run an application from within UEStudio Configuring VCS with UEStudio A guide for configuring version control support (VCS) in UEStudio 11 and later Configuring VCS with UEStudio (in v10.30 and earlier) A guide for configuring version control support (VCS) in UEStudio CVS Diff How to use the built-in CVS Diff commands with UEStudio and UltraCompare Add a file to version control system A trademark feature of UEStudio is it's powerful Version Control System. As you continue in your development, it is likely you will need to add files to the version control repository Compare files/folders A guide for comparing files or folders from UEStudio using the integrated diff tool Quickstart guide: Using the integrated debugger A guide for setting up integrated WinDbg debugging in UEStudio Quickstart guide: Using the integrated PHP debugger A guide for setting up the integrated PHP debugger in UEStudio Using the SSH/telnet console A guide for setting up SSH/telnet in UEStudio Keymapping and custom hotkeys A guide for customizing 键映射, menus and menu hotkeys in UEStudio Configuring SVN and CVS Accounts A cornerstone feature of UEStudio is the version control support. UEStudio supports CVS and SVN as well as multiple connection protocols. Before you can use version control, you must create an account. UEStudio has an auto-detect CVS/SVN feature, but... Group Files and Folders with Projects How to group your files and folders using Projects UltraEdit for Linux 使用技巧 FTP through Nautilus Did you know that you can access remote FTP files in UltraEdit for Linux with a variety of server connection protocols? Using Nautilus, the default file manager for the popular GNOME desktop, you can access files via FTP, SFTP, Windows shares, or even... Primary Select Using Linux's primary select feature in UltraEdit for Linux Custom terminal Set up a user tool to interact with the command line and specify a custom terminal for output Custom file browser UltraEdit for Linux allows you to right-click any file or folder in your Project (from the File View) and browse it on the file system. But did you know that you can configure which file browser is launched from UltraEdit? Scripting tutorial An introduction to the integrated scripting feature in UltraEdit for Linux Writing a macro Steps to record and edit powerful macros to quickly and efficiently edit files Vertical and horizontal split window editing This is a convenient feature when you're manually comparing files, when you want to copy/paste between multiple files, or when you simply want to divide up your edit space. Find and Replace A guide to the powerful features and options available under the "Search" menu. Find in Selected Text Find and Replace is a cornerstone feature for UltraEdit, so it is of course integral to UltraEdit for Linux. The Linux version offers the same features as in the Windows version, as well as additional features. One specific feature that was improved... Using bookmarks Provides a way for you to mark and quickly access lines of interest in your files via bookmarks. To add a bookmark, make sure the cursor is positioned on the line you'd like to bookmark. Press CTRL + F2.... Adding a wordfile Add a language definition to your wordfile for use with UltraEdit's powerful syntax highlighting Projects In UltraEdit for Linux, projects are a convenient, time-saving, feature that allow you to group and manage associated files. Additionally, Projects are integrated throughout the framework of UltraEdit making it easier to perform other actions on your... Search Favorites UltraEdit for Linux includes a Search and Replace Favorites feature that allows you to manage frequently used Find and Replace strings. Create, name, and edit your Search and Replace Favorites... Column mode How to use column and block selection mode in UltraEdit for Linux Templates How to create text editing templates in UltraEdit for Linux Keyboard shortcuts A quick reference guide to UltraEdit's (Linux) default keyboard shortcuts How to use the UltraEdit for Linux tar package This guide shows you how to download and use the tar.gz package of UltraEdit UltraEdit for Linux v1.20: Scripting enhancements One of UEx's trademark features is the ability to automate tasks through scripting; v1.2 extends the power of scripting further with includes. UltraEdit for Linux Command Line Support UltraEdit for Linux has many convenient command line options and flags for calling UEx from a console/terminal as part of a script, or simply for convenience. Advanced file sorting Sort files in UEx with a powerful array of options and settings, including optional sort keys UltraCompare 使用技巧 Compare text snippets A tutorial showing you how to compare text snippets without having to save your snippets into a file. Diff your snippets, merge your changes, save the result as a separate file, then clear out the snippets (and their temp files...) Increase your virtual memory Large file comparisons may require your system to use virtual memory. This tutorial shows you how to configure Windows to increase the amount of virtual memory on your system. Compare large files UltraCompare is a very robust file comparison tool which includes support for comparing large files even several GB large. This power tip shows you how to optimize UltraCompare for maximum performance when working with large files. Compare .zip, .rar., and .jar Archives Got Archives? UltraCompare's archive compare feature allows you to compare the contents of .zip files, .rar files, Java .jar files, and even password-protected .zip files. Use the archive compare and examine differences between archives or folders on th Version Control Comparison UltraCompare v6.40 includes major improvements to the command line support that allow greater flexibility when integrating with other applications. If you're using version control in a team development environment, then UltraCompare v6.40 is exactly... Visually inspect HTML code How to use UltraCompare Professional's integrated browser view to visually compare and inspect HTML code Compare directories using FTP/SFTP Configure FTP/SFTP accounts in UltraCompare Professional to backup or sync FTP directories and compare local and remote folders. Block and line mode merge Merge differences and save them between 2 or 3 files at the click of a button Sync files and folders with the Folder Synchronization feature Folder Synchronization is a powerful feature in UltraCompare which allows you to sync files between local, remote, network, and even FTP folders. Recursive compare Use recursive compare to evaluate subdirectories' content for differences Find and eliminate duplicate files Unnecessary and unwanted duplicate files can eat up valuable system disk space. This power tip will show you how to quickly and safely eliminate unwanted duplicate files from your system with the powerful Find Duplicates feature in UltraCompare Compare Word documents Compare multiple Microsoft Word documents - Identify and merge differences between Word documents. Command line tips Tips for running UltraCompare from a DOS command prompt Command line quick difference check Run a quick difference check between two files to quickly see if they're the same or different Ignore options Setting ignore options for file/folder comparisons in UltraCompare Ignore/compare column range Set parameters to ignore or compare up to 4 unique columns of data. Filtering files in folder mode Filtering files in UltraCompare while in folder mode Customizing the time/date format for folder comparison Many UltraCompare users in different regions of the world have different standard formats for dates and timestamps. UltraCompare provides the ability to customize the date and timestamp for your folder comparisons Editing files in UltraCompare How to use the integrated text editing capabilites within UltraCompare UltraCompare shell integration Tips for integrating UltraCompare into the right-click context menu in Windows Explorer Export/save text compare output How to export and save diff output from UltraCompare Web Compare If you work with web files, you are probably accustomed to downloading the file via FTP or viewing the source, saving the text, then doing a compare. We're sure you'll agree, this process is clunky and mechanical.... Manually Sync Your Compare Manually sync your compare lines UltraCompare Sessions If you're anything like us, you always have multiple applications running at once. Spawning multiple instances of any application makes it harder to work. So... UC gives you sessions to manage your compare operations! Customizing colors Tutorial on how to change the colors for folder/file compare in UltraCompare Reload previously active sessions When you're doing complex file and folder compare operations, it doesn't take long to open quite a few tabs. What happens when you close UC to move on to another task or to go home for the day- lose the session? Not with Reload active sessions... Session Manager If you've compared the same set of files/folders more than once... You need sessions. Sessions allow you to save compare options for a common set of files or folders which you can quickly recall anytime you open UltraCompare. Not only can you save... Workspace Manager The Workspace Manager is all about convenience, so the Explorer view allows you to drag/drop files and folders for quick and easy compare operations. Simply select the folder (or file) in the Explorer view and drag it to the compare frame. Bookmark Favorite Files/Folders in UltraCompare How to use Favorite in UltraCompare to bookmark your commonly used files/folders. FTP in Workspace Manager You can access your accounts through the Explorer tab of the Workspace Manager in UltraCompare Share FTP Accounts with UltraEdit/UEStudio Set up UltraEdit/UEStudio to share FTP accounts with UltraCompare FTP Folder Compare with CRC Have you wanted to do a quick folder compare - between a local directory and remote directory - without downloading the files first? No problem... As of v7.20, UltraCompare now supports an FTP CRC compare method. With the CRC compare feature... Mark and hide files and folders in folder compare Have you ever wanted to hide files/folders that aren't relevant for your immediate compare needs? We have... While UltraCompare offers many compare filters and ignore options, sometimes you just need more control... UltraSentry 使用技巧 Web browser cleanup Use UltraSentry to securely clean up history and temporary files associated with web browsers Application Cleaning Support Clean the sensitive data left behind after running your applications Delete browser cookies Protect your privacy and your security by securely deleting malicious or private cookies Download directory cleanup Securely delete your download history with UltraSentry Optimize your browser Using UltraSentry to improve speed, performance, and security of your browser Explorer/Microsoft office Integration Tips for integrating UltraSentry into the right-click context menu in Windows Explorer or MS Office Stealth mode Tutorial for running UltraSentry in the background or system tray Scheduling a task Tutorial for scheduling UltraSentry to automatically execute a specific cleaning task Run UltraSentry as a system service How to Schedule your profiles/cleaning operations and be sure that UltraSentry is running them whether you are logged in or not Using the Wizard UltraSentry's wizard makes secure/privacy cleaning operations quick and easy. This power tip shows you how to use the wizard. Total System Scrub Information on how to use UltraSentry's "Full System Scrub" profile to protect your privacy and secure your sensitive data Custom profiles This power tip describes how to set up your own custom profile so that you can securely clean only areas of the system that you wish to clean Securely delete email How to securely delete email on your system using UltraSentry Advanced features This power tip describes some of the advanced features and functionality of UltraSentry
Usage: ora [-u user] [-i instance#] [] General -u user/pass use USER/PASS to log in -i instance# append # to ORACLE_SID -sid set ORACLE_SID to sid -top # limit some large queries to on # rows - repeat Repeat an coomand time. Sleep between two calls Command are: - execute: cursors currently being executed - longops: run progression monitor - sessions: currently open sessions - stack get process stack using oradebug - cursors [all] : [all] parsed cursors - sharing : print why cursors are not shared - events [px]: events that someone is waiting for - events [read_by_other_session] events that someone is read by other session - ash [duration] [-f ] active session history for specified period e.g. 'ash 30' to display from [now - 30min] to [now] e.g. 'ash 30 10 -f foo.txt' to display a 10 minutes period from [now - 30min] and store the result in file foo.txt - ash_wait_graph [duration] [-f ] PQ event wait graph using ASH data Arguments are the same as for ash except that the output must be shown with the mxgraph tool - ash_sql Show all ash rows group by sampli_time and event for the specified sql_id - [-u ] degree degree of objects for a given user - [-u ] colstats stats for each table, column - [-u ] tabstats stats for each table - params []: view all parameters, even hidden ones - snap: view all snapshots status - bc: view contents of buffer cache - temp: view used space in temp tbs - asm: Show asm space/free space - space []: view used/free space in a given tbs - binds : display bind capture information for specified cursor - fulltext : display the entire SQL text of the specified statement - last_sql_hash []: hash value of the last styatement executed by the specified sid. If no sid speficied, return the last hash_value of user sessions - openv []: display optimizer env parameters for specified cursor - plan []: get explain plan of a particular cursor - pxplan : get explain plan of a particular cursor and all connected cursor slave SQL - wplan []: get explain plan with work area information - pxwplan : get explain plan with work area information of a particular cursor and all connected cursor slave SQL - eplan []: get explain plan with execution statistics - pxeplan : get explain plan with execution statistics of a particular cursor and all connected cursor slave SQL - gplan : get graphical explain plan of a particular cursor using dot specification - webplan get graphical explain plan of a particular [/] cursor using gdl specification []: optional: child_number, default is zero. optional: decorate to print further node information. default is 0, 1 => print further node information such as cost, filter_predicates etc. 2 => in addition to the above, print row vector information sample usage: # ora webplan 4019453623 print more information (decorate 1) # ora webplan 4019453623/1 1 more information, overload! (decorate 2) # ora webplan 4019453623/1 2 using sql_id along with child number instead of hash value # ora webplan aca4xvmz0rzup/3 1 - hash_to_sqlid : get the sql_id of the cursor given its hash value - sqlid_to_hash : get the hash value of the cursor given its (unquoted) sql_id - exptbs: generate export tablespace script - imptbs: generate import tablespace script - smm [limited]: SQL memory manager stats for active workareas - onepass: Run an ora wplan on all one-pass cursors - mpass: Run an ora wplan on all multi-pass cursors - pga: tell how much pga memory is used - pga_detail | -mem : Gives details on how PGA memory is consumed by a process (given its os PID) or by the set of precesses consuming more than MB of PGA memory (-mem option) - pgasnap [] Snapshot the pga advice stats - pgaadv [-s []] [-o graphfile] [-m min_size]: generate a graph from v and display it or store it in a file if the -o option is used. -s [] to diff with a previous snapshot (see pgasnap cmd) -o [graphfile] to store the result in a file instead of displaying it -m [min_size] only consider workareas with a minimum size - pgaadvhist [-f []] display the advice history for all factors or for factor between f_min and f_max - sga: tell how much sga memory is used - sga_stats: tell how sga is dynamically used - sort_usage: tell how temp tablespace is used in detail - sgasnap [] Snapshot the sga advice stats - sgaadv [-s []] [-o graphfile] generate a graph from v and v and store it in a file if the -o option is used. -s [] to diff with a previous snapshot (see sgasnap cmd) -o [graphfile] to store the result in a file instead of displaying it - process []: display process info with pga memory - version: display Oracle version number - cur_mem [ ] display the memory used for a given or all cursors - shared_mem [ ] detailed dump of cursor shared mem allocations - runtime_mem [ ] detailed dump of cursor runtime memory allocations - all_mem [ ] do all of the memory dumps - pstack |all [] run pstack on specified process (or all if 'all' specified) and store files in specified dir ( when not specified) - idxdesc [username] list all indexes for a given user or for a given user and table - segsize [username] list size of all objects(segments) for given user for a given user and object - tempu list temporary ts usage of all users or for a given user - sqlstats [ ] list sql execution stats (like buffer_gets, phy. reads etc) for a given sql_id/hash_value of statement - optstats [username] list optimizer stats for all tables stored in dictionary for a given user or for a given user and table - userVs list all user Views (user_tables, user_indexes etc) - fixedVs list all V$ Views - fixedXs list all X$ Views - px_processes list all px processes (QC and slaves) - cursor_summary summarize stats about (un)pinned cursors - rowcache summarizes row cache statistics - monitor_list lists all the statements that have been monitored - monitor [xml]: wraps dbms_sqltune.report_sql_monitor(). Directly passe the arguments to the PL/SQL procedure. Args are: sql_id, session_id, session_serial, sql_exec_start, sql_exec_id, inst_id, instance_id_filter, parallel_filter, report_level, type. Examples: - monitor xml shows XML report - monitor show last monitored stmt - monitor sql_id=>'8vz99cy9bydv8', session_id=>105 will show monitor info for sql_id 8vz99cy9bydv8 and session_id 105 Use simply ora monitor 8vz99cy9bydv8 to display monitoring information for sql_id 8vz99cy9bydv8. Syntax for parallel filters is: [qc][servers([,] [,] )] Use /*+ monitor */ to force monitoring. - monitor_old [ash_all] [] [qc| [ []]] Old version of SQL monitoring, use a SQL query versus the report_sql_monitor() package. Display monitoring info for the LAST execution of the specified cursor. Cursor response time needs to be at least 5s for monitoring to start (use the monitor hint to force monitoring). Without any parameter, will display monitoring info for the last cursor that was monitored - ash_all will aggregate ash data over all executions of the cursor (useful for short queries that are executed many times). If parallel: - qc to see only data for qc - slave_grp# to see only data for one parallelizer - slave_grp# + slave_set# to see only data for one slave set of one parallelizer, - slave_grp# + slave_set# + slave# to see data only for the specified slave - sql_task [progress | interrupt | history | report ] progress: progress monitoring for executing sql tasks interrupt: interrupt an executing sql task history: print a history of last n executions report: get a sql tune report - sql_use_temp_segment Find Who And What SQL Is Using Temp Segments. - sh Run a shell command. E.g. ora repeat 5 10 sh 'ps -edf | grep DESC' - awr_dbid Show AWR dbid - awr_dbtime [dbid] Show AWR dbtime - awr_dbtime [dbid] [inst] Show AWR dbtime - awr_dbtime_order [dbid] Show AWR dbtime order by desc - awr_sql_elaps_time [dbid] Show AWR SQL elapsed time - awr_sql_elaps_time [dbid] [inst] Show AWR SQL elapsed time - awr_sql_elaps_time_order [dbid] Show AWR SQL elapsed time order by desc - awr_logical_reads_order [dbid] - awr_logical_reads [dbid] Show AWR logical reads M Show AWR logical reads M order by desc - awr_physical_reads [dbid] Show AWR physical reads M - awr_physical_reads_order [dbid] Show AWR physical reads M order by desc - awr_db_cpu_per [dbid] [inst] Show AWR db_cpu_time cpu percent - awr_user_cpu_per [dbid] [inst] Show AWR oracle user_time cpu percent including backgroud process - awr_sql sql_id [dbid] Show AWR sql_id executions, per elapsed time. - awr_fulltext sql_id [dbid] Show AWR sql fulltext - awr_plan sql_id plan_hash [dbid] Show AWR sql plan, if plan_hash is null, show all plans. - awr_binds sql_id end_snap_id [dbid] Show AWR bind values in end_snap_id. - tab_frag owner [frag_percent] Show table fragment. - index_frag owner [frag_percent] Show index fragment. - rman_fullrestore_scripts dest_dbfile_dir Generate rman full database restore scripts - top_buffers_gets Top 10 by buffer gets > 10000 - top_physical_reads Top 10 by Physical Reads (disk_reads > 1000) - top_executions Top 10 by Executions > 100 - top_parse_calls Top 10 by Parse Calls > 1000 - top_sharable_memory Top 10 by Sharable Memory > 1M - top_version_count Top 10 by Version Count > 20 - top_cpu_usage Top 10 by CPU usage (cpu_time) - top_running_time Top 10 by Running Time (first_load_time desc) - create_tbs path size Create test database's tablespace script - create_tbs path size [dbid]Create dbid's test database's tablespace script - hold_txlock Show sessions holding a TX lock - wait_txlock Show sessions waiting a TX lock - rowid Display rowid's file_id, file_name, block info, object info, extent_id Memory: The detailed memory dumps need to have events set to work. The events bellow can be added to the init.ora file event="10277 trace name context forever, level 10" # mutable mem event="10235 trace name context forever, level 4" # shared mem NOTE ==== - Set environment variable ORA_USE_HASH to 1 to get SQL hash values instead of SQL ids - Set environment variable DBUSER to change default connect string which is "/ as sysdba" - Set environment variable ORA_TMP to the default temp directory (default if /tmp when not set)
实验三 移植U-Boot-1.3.1 实验 【实验目的】 了解 U-Boot-1.3.1 的代码结构,掌握其移植方法。 【实验环境】 1、Ubuntu 7.0.4发行版 2、u-boot-1.3.1 3、FS2410平台 4、交叉编译器 arm-softfloat-linux-gnu-gcc-3.4.5 【实验步骤】 一、建立自己的平台类型 (1)解压文件 #tar jxvf u-boot-1.3.1.tar.bz2 (2)进入 U-Boot源码目录 #cd u-boot-1.3.1 (3)创建自己的开发板: #cd board #cp smdk2410 fs2410 –a #cd fs2410 #mv smdk2410.c fs2410.c #vi Makefile (将 smdk2410修改为 fs2410) #cd ../../include/configs #cp smdk2410.h fs2410.h 退回 U-Boot根目录:#cd ../../ (4)建立编译选项 #vi Makefile smdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0 fs2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t fs2410 NULL s3c24x0 arm: CPU的架构(ARCH) arm920t: CPU的类型(CPU),其对应于 cpu/arm920t子目录。 fs2410: 开发板的型号(BOARD),对应于 board/fs2410目录。 NULL: 开发者/或经销商(vender),本例为空 s3c24x0: 片上系统(SOC) (5)编译 #make fs2410_config; #make 本步骤将编译 u-boot.bin文件,但此时还无法运行在FS2410开发板上。 二、修改 cpu/arm920t/start.S文件,完成 U-Boot的重定向 (1)修改中断禁止部分 # if defined(CONFIG_S3C2410) ldr r1, =0x7ff /*根据 2410 芯片手册,INTSUBMSK 有 11位可用 */ ldr r0, =INTSUBMSK Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) str r1, [r0] # endif (2)修改时钟设置(这个文件要根据具体的平台进行修改) (3)将从Nor Flash启动改成从 NAND Flash启动 在文件中找到 195-201 代码,并在 201行后面添加如下代码: 195 copy_loop: 196 ldmia r0!, {r3-r10} /* copy from source address [r0] */ 197 stmiar1!, {r3-r10} /* copy to target address [r1] */ 198 cmp r0, r2 /* until source end addreee [r2] */ 199 ble copy_loop 200 #endif /* CONFIG_SKIP_RELOCATE_UBOOT */ 201 #endif #ifdef CONFIG_S3C2410_NAND_BOOT @ reset NAND mov r1, #NAND_CTL_BASE ldr r2, =0xf830 @ initial value str r2, [r1, #oNFCONF] ldr r2, [r1, #oNFCONF] bic r2, r2, #0x800 @ enable chip str r2, [r1, #oNFCONF] mov r2, #0xff @ RESET command strb r2, [r1, #oNFCMD] mov r3, #0 @ wait nand1: add r3, r3, #0x1 cmp r3, #0xa blt nand1 nand2: ldr r2, [r1, #oNFSTAT] @ wait ready tst r2, #0x1 beq nand2 ldr r2, [r1, #oNFCONF] orr r2, r2, #0x800 @ disable chip str r2, [r1, #oNFCONF] @ get read to call C functions (for nand_read()) ldr sp, DW_STACK_START @ setup stack pointer mov fp, #0 @ no previous frame, so fp=0 @ copy U-Boot to RAM ldr r0, =TEXT_BASE mov r1, #0x0 mov r2, #0x30000 bl nand_read_ll tst r0, #0x0 beq ok_nand_read Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)bad_nand_read: loop2: b loop2 @ infinite loop ok_nand_read: @ verify mov r0, #0 ldr r1, =TEXT_BASE mov r2, #0x400 @ 4 bytes * 1024 = 4K-bytes go_next: ldr r3, [r0], #4 ldr r4, [r1], #4 teq r3, r4 bne notmatch subs r2, r2, #4 beq stack_setup bne go_next notmatch: loop3: b loop3 @ infinite loop #endif @ CONFIG_S3C2410_NAND_BOOT (4)在 “ _start_armboot: .word start_armboot ”后加入: .align 2 DW_STACK_START: .word STACK_BASE+STACK_SIZE-4 三、创建 board/fs2410/nand_read.c 文件,加入读 NAND Flash 的操作。 #include #define __REGb(x) (*(volatile unsigned char *)(x)) #define __REGi(x) (*(volatile unsigned int *)(x)) #define NF_BASE 0x4e000000 # if defined(CONFIG_S3C2410) #define NFCONF __REGi(NF_BASE + 0x0) #define NFCMD __REGb(NF_BASE + 0x4) #define NFADDR __REGb(NF_BASE + 0x8) #define NFDATA __REGb(NF_BASE + 0xc) #define NFSTAT __REGb(NF_BASE + 0x10) #define BUSY 1 inline void wait_idle(void) { int i; while(!(NFSTAT & BUSY)) for(i=0; i<10; i++); } /* low level nand read function */ int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size) { int i, j; Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) { return -1; /* invalid alignment */ } /* chip Enable */ NFCONF &= ~0x800; for(i=0; i<10; i++); for(i=start_addr; i > 9) & 0xff; NFADDR = (i >> 17) & 0xff; NFADDR = (i >> 25) & 0xff; wait_idle(); for(j=0; j NFCONF = conf; } Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)static inline void NF_Cmd(u8 cmd) { S3C2410_NAND * const nand = S3C2410_GetBase_NAND(); nand->NFCMD = cmd; } static inline void NF_CmdW(u8 cmd) { NF_Cmd(cmd); udelay(1); } static inline void NF_Addr(u8 addr) { S3C2410_NAND * const nand = S3C2410_GetBase_NAND(); nand->NFADDR = addr; } static inline void NF_WaitRB(void) { S3C2410_NAND * const nand = S3C2410_GetBase_NAND(); while (!(nand->NFSTAT & (1NFDATA); } static inline u32 NF_Read_ECC(void) { S3C2410_NAND * const nand = S3C2410_GetBase_NAND(); return(nand->NFECC); } static inline void NF_SetCE(NFCE_STATE s) { S3C2410_NAND * const nand = S3C2410_GetBase_NAND(); switch (s) { case NFCE_LOW: nand->NFCONF &= ~(1 20); } #endif (2)配置GPIO 和 PLL 根据开发板的硬件说明和芯片手册,修改GPIO 和 PLL的配置。 六、修改 include/configs/fs2410.h 头文件 (1)加入命令定义 /* Command line configuration. */ #include #define CONFIG_CMD_ASKENV #define CONFIG_CMD_CACHE #define CONFIG_CMD_DATE #define CONFIG_CMD_DHCP #define CONFIG_CMD_ELF #define CONFIG_CMD_PING #define CONFIG_CMD_NAND #define CONFIG_CMD_REGINFO #define CONFIG_CMD_USB #define CONFIG_CMD_FAT (2)修改命令提示符 #define CFG_PROMPT "SMDK2410 # " -> #define CFG_PROMPT "FS2410# " (3)修改默认载入地址 #define CFG_LOAD_ADDR 0x33000000 -> #define CFG_LOAD_ADDR 0x30008000 (4)加入 Flash环境信息 #define CFG_ENV_IS_IN_NAND 1 #define CFG_ENV_OFFSET 0X30000 #define CFG_NAND_LEGACY //#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */ (5)加入Nand Flash设置(在文件结尾处) /* NAND flash settings */ #if defined(CONFIG_CMD_NAND) #define CFG_NAND_BASE 0x4E000000 /* NandFlash控制器在SFR区起始寄存器地址 */ #define CFG_MAX_NAND_DEVICE 1 /* 支持的最在Nand Flash数据 */ #define SECTORSIZE 512 /* 1页的大小 */ #define NAND_SECTOR_SIZE SECTORSIZE Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)#define NAND_BLOCK_MASK 511 /* 页掩码 */ #define ADDR_COLUMN 1 /* 一个字节的Column地址 */ #define ADDR_PAGE 3 /* 3字节的页块地址!!!!!*/ #define ADDR_COLUMN_PAGE 4 /* 总共4字节的页块地址!!!!! */ #define NAND_ChipID_UNKNOWN 0x00 /* 未知芯片的ID号 */ #define NAND_MAX_FLOORS 1 #define NAND_MAX_CHIPS 1 /* Nand Flash命令层底层接口函数 */ #define WRITE_NAND_ADDRESS(d, adr) {rNFADDR = d;} #define WRITE_NAND(d, adr) {rNFDATA = d;} #define READ_NAND(adr) (rNFDATA) #define NAND_WAIT_READY(nand) {while(!(rNFSTAT&(1<<0)));} #define WRITE_NAND_COMMAND(d, adr) {rNFCMD = d;} #define WRITE_NAND_COMMANDW(d, adr) NF_CmdW(d) #define NAND_DISABLE_CE(nand) {rNFCONF |= (1<<11);} #define NAND_ENABLE_CE(nand) {rNFCONF &= ~(1<<11);} /* the following functions are NOP's because S3C24X0 handles this in hardware */ #define NAND_CTL_CLRALE(nandptr) #define NAND_CTL_SETALE(nandptr) #define NAND_CTL_CLRCLE(nandptr) #define NAND_CTL_SETCLE(nandptr) /* 允许 Nand Flash写校验 */ #define CONFIG_MTD_NAND_VERIFY_WRITE 1 (6)加入Nand Flash启动支持(在文件结尾处) /* Nandflash Boot*/ #define STACK_BASE 0x33f00000 #define STACK_SIZE 0x8000 /* NAND Flash Controller */ #define NAND_CTL_BASE 0x4E000000 #define bINT_CTL(Nb) __REG(INT_CTL_BASE + (Nb)) /* Offset */ #define oNFCONF 0x00 #define CONFIG_S3C2410_NAND_BOOT 1 /* Offset */ #define oNFCONF 0x00 #define oNFCMD 0x04 #define oNFADDR 0x08 #define oNFDATA 0x0c #define oNFSTAT 0x10 #define oNFECC 0x14 #define rNFCONF (*(volatile unsigned int *)0x4e000000) #define rNFCMD (*(volatile unsigned char *)0x4e000004) Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)#define rNFADDR (*(volatile unsigned char *)0x4e000008) #define rNFDATA (*(volatile unsigned char *)0x4e00000c) #define rNFSTAT (*(volatile unsigned int *)0x4e000010) #define rNFECC (*(volatile unsigned int *)0x4e000014) #define rNFECC0 (*(volatile unsigned char *)0x4e000014) #define rNFECC1 (*(volatile unsigned char *)0x4e000015) #define rNFECC2 (*(volatile unsigned char *)0x4e000016) #endif (7)加入 jffs2的支持 /*JFFS2 Support */ #undef CONFIG_JFFS2_CMDLINE #define CONFIG_JFFS2_NAND 1 #define CONFIG_JFFS2_DEV "nand0" #define CONFIG_JFFS2_PART_SIZE 0x4c0000 #define CONFIG_JFFS2_PART_OFFSET 0x40000 /*JFFS2 Support */ (8)加入 usb的支持 /* USB Support*/ #define CONFIG_USB_OHCI #define CONFIG_USB_STORAGE #define CONFIG_USB_KEYBOARD #define CONFIG_DOS_PARTITION #define CFG_DEVICE_DEREGISTER #define CONFIG_SUPPORT_VFAT #define LITTLEENDIAN /* USB Support*/ 七、修改 include/linux/mtd/nand.h头文件 屏蔽如下定义: #if 0 /* Select the chip by setting nCE to low */ #define NAND_CTL_SETNCE 1 /* Deselect the chip by setting nCE to high */ #define NAND_CTL_CLRNCE 2 /* Select the command latch by setting CLE to high */ #define NAND_CTL_SETCLE 3 /* Deselect the command latch by setting CLE to low */ #define NAND_CTL_CLRCLE 4 /* Select the address latch by setting ALE to high */ #define NAND_CTL_SETALE 5 /* Deselect the address latch by setting ALE to low */ #define NAND_CTL_CLRALE 6 /* Set write protection by setting WP to high. Not used! */ #define NAND_CTL_SETWP 7 /* Clear write protection by setting WP to low. Not used! */ Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)#define NAND_CTL_CLRWP 8 #endif 八、修改 include/linux/mtd/nand_ids.h 头文件 在该文件中加入开发板的 NAND Flash型号 {"Samsung K9F1208U0B", NAND_MFR_SAMSUNG, 0x76, 26, 0, 4, 0x4000, 0}, 九、修改 common/env_nand.c文件 我们使用了早期的Nand读写方式,因此做出下列移植: (1) 加入函数原型定义 extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE]; extern int nand_legacy_erase(struct nand_chip *nand, size_t ofs, size_t len, int clean); /* info for NAND chips, defined in drivers/nand/nand.c */ extern nand_info_t nand_info[CFG_MAX_NAND_DEVICE]; (2) 修改saveenv函数 注释//if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE)) 加入:if (nand_legacy_erase(nand_dev_desc + 0, CFG_ENV_OFFSET, CFG_ENV_SIZE, 0)) 注释//ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr); 加入:ret = nand_legacy_rw(nand_dev_desc + 0,0x00 | 0x02, CFG_ENV_OFFSET, CFG_ENV_SIZE, &total, (u_char*)env_ptr); (3) 修改env_relocate_spec函数 注释//ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr); 加入:ret = nand_legacy_rw(nand_dev_desc + 0, 0x01 | 0x02, CFG_ENV_OFFSET, CFG_ENV_SIZE, &total, (u_char*)env_ptr); 十、修改 common/cmd_boot.c 文件,添加内核启动参数设置 (1) 首先添加头文件#include (2) 修改do_go函数。具体修改为: int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { #if defined(CONFIG_I386) DECLARE_GLOBAL_DATA_PTR; #endif ulong addr, rc; int rcode = 0; ///////////////////////////////////////////////////////////////////////// char *commandline = getenv("bootargs"); struct param_struct *my_params=(struct param_struct *)0x30000100; memset(my_params,0,sizeof(struct param_struct)); my_params->u1.s.page_size=4096; my_params->u1.s.nr_pages=0x4000000>>12; memcpy(my_params->commandline,commandline,strlen(commandline)+1); Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)/////////////////////////////////////////////////////////////////////// if (argc usage); return 1; } addr = simple_strtoul(argv[1], NULL, 16); printf ("## Starting application at 0x%08lX ...\n", addr); /* * pass address parameter as argv[0] (aka command name), * and all remaining args */ #if defined(CONFIG_I386) /* * x86 does not use a dedicated register to pass the pointer * to the global_data */ argv[0] = (char *)gd; #endif #if !defined(CONFIG_NIOS) //////////////////////////////////////////////////////////////////// __asm__( "mov r1, #193\n" "mov ip, #0\n" "mcr p15, 0, ip, c13, c0, 0\n" /* zero PID */ "mcr p15, 0, ip, c7, c7, 0\n" /* invalidate I,D caches */ "mcr p15, 0, ip, c7, c10, 4\n" /* drain write buffer */ "mcr p15, 0, ip, c8, c7, 0\n" /* invalidate I,D TLBs */ "mrc p15, 0, ip, c1, c0, 0\n" /* get control register */ "bic ip, ip, #0x0001\n" /* disable MMU */ "mov pc, %0\n" "nop\n" : :"r"(addr) ); ////////////////////////////////////////////////////////// rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]); #else /* * Nios function pointers are address >> 1 */ rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]); #endif if (rc != 0) rcode = 1; Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) printf ("## Application terminated, rc = 0x%lX\n", rc); return rcode; } 其中用//括起来的代码是要添加的代码。否则在引导LINUX 内核的时候出现一个 Error: a 或无法传递内核启动参数的错误。其原因是平台号或启动参数没有正确传入内核。 十一、交叉编译 U-BOOT #make distclean #make fs2410_config export PATH=$PATH:/home/linux/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin: #make CROSS_COMPILE= arm-softfloat-linux-gnu- 生成的 u-boot.bin 即为我们移植后的结果。下载到开发板上运行! Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)U-Boot简介 U-Boot,全称 Universal Boot Loader,是遵循 GPL 条款的开放源码项目。从 FADSROM、 8xxROM、PPCBOOT 逐步发展演化而来。其源码目录、编译形式与 Linux 内核很相似,事 实上,不少U-Boot源码就是相应的 Linux内核源程序的简化,尤其是一些设备的驱动程序, 这从U-Boot源码的注释中能体现这一点。 但是U-Boot不仅仅支持嵌入式Linux系统的引导, 当前,它还支持 NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS嵌入式操作系统。其目 前要支持的目标操作系统是OpenBSD, NetBSD, FreeBSD,4.4BSD, Linux, SVR4, Esix, Solaris, Irix, SCO, Dell, NCR, VxWorks, LynxOS, pSOS, QNX, RTEMS, ARTOS。这是 U-Boot中 Universal的一层含义,另外一层含义则是 U-Boot除了支持 PowerPC系列的处理器外,还能 支持 MIPS、 x86、ARM、NIOS、XScale等诸多常用系列的处理器。这两个特点正是U-Boot 项目的开发目标,即支持尽可能多的嵌入式处理器和嵌入式操作系统。就目前来看,U-Boot 对 PowerPC 系列处理器支持最为丰富,对 Linux 的支持最完善。其它系列的处理器和操作 系统基本是在2002年11 月PPCBOOT改名为U-Boot后逐步扩充的。 从PPCBOOT向U-Boot 的顺利过渡,很大程度上归功于 U-Boot 的维护人德国 DENX 软件工程中心 Wolfgang Denk[以下简称 W.D]本人精湛专业水平和持着不懈的努力。当前,U-Boot 项目正在他的领 军之下,众多有志于开放源码 BOOT LOADER移植工作的嵌入式开发人员正如火如荼地将 各个不同系列嵌入式处理器的移植工作不断展开和深入, 以支持更多的嵌入式操作系统的装 载与引导。 选择 U-Boot的理由: ① 开放源码; ② 支持多种嵌入式操作系统内核,如 Linux、NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS; ③ 支持多个处理器系列,如 PowerPC、ARM、x86、MIPS、XScale; ④ 较高的可靠性和稳定性; ④ 较高的可靠性和稳定性; ⑤ 高度灵活的功能设置,适合U-Boot调试、操作系统不同引导要求、产品发布等; ⑥ 丰富的设备驱动源码,如串口、以太网、SDRAM、FLASH、LCD、NVRAM、EEPROM、 RTC、键盘等; ⑦ 较为丰富的开发调试文档与强大的网络技术支持; U-Boot主要目录结构 - board 目标板相关文件,主要包含 SDRAM、FLASH 驱动; - common 独立于处理器体系结构的通用代码,如内存大小探测与故障检测; - cpu 与处理器相关的文件。如 mpc8xx子目录下含串口、网口、LCD 驱动及中断初始化等 文件; - driver 通用设备驱动,如 CFI FLASH 驱动(目前对INTEL FLASH 支持较好) Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)- doc U-Boot的说明文档; - examples可在 U-Boot下运行的示例程序;如 hello_world.c,timer.c; - include U-Boot头文件;尤其 configs子目录下与目标板相关的配置头文件是移植过程中经 常要修改的文件; - lib_xxx 处理器体系相关的文件,如 lib_ppc, lib_arm目录分别包含与 PowerPC、ARM体系 结构相关的文件; - net 与网络功能相关的文件目录,如 bootp,nfs,tftp; - post 上电自检文件目录。尚有待于进一步完善; - rtc RTC驱动程序; - tools 用于创建 U-Boot S-RECORD 和 BIN 镜像文件的工具; U-Boot支持的主要功能 U-Boot可支持的主要功能列表 系统引导 支持NFS挂载、RAMDISK(压缩或非压缩)形式的根文件系统 支持 NFS挂载、从 FLASH 中引导压缩或非压缩系统内核; 基本辅助功能 强大的操作系统接口功能;可灵活设置、传递多个关键参数给操作系统,适 合系统在不同开发阶段的调试要求与产品发布,尤对Linux支持最为强劲; 支持目标板环境参数多种存储方式,如 FLASH、NVRAM、EEPROM; CRC32校验,可校验 FLASH 中内核、RAMDISK 镜像文件是否完好; 设备驱动 串口、 SDRAM、 FLASH、 以太网、 LCD、 NVRAM、 EEPROM、 键盘、 USB、 PCMCIA、 PCI、RTC等驱动支持; 上电自检功能 SDRAM、FLASH 大小自动检测;SDRAM故障检测;CPU型号; 特殊功能 XIP内核引导; 移植前的准备 (1)、首先读读 uboot自带的 readme文件,了解了一个大概。 (2)、看看 common.h,这个文件定义了一些基本的东西,并包含了一些必要的头文件。再 看看 flash.h,这个文件里面定义了 flash_info_t为一个 struct。包含了 flash的一些属性定义。 并且定义了所有的 flash 的属性,其中,AMD 的有:AMD_ID_LV320B,定义为“#define AMD_ID_LV320B 0x22F922F9” 。 (3)、对于“./borad/at91rm9200dk/flash.c”的修改,有以下的方面: “void flash_identification(flash_info_t *info)”这个函数的目的是确认 flash的型号。注意的 是,这个函数里面有一些宏定义,直接读写了 flash。并获得 ID 号。 (4)、修改: ”./board/at91rm9200dk/config.mk”为 TEXT_BASE=0x21f80000 为 TEXT_BASE=0x21f00000 (当然,你应该根据自己的板子来 修改,和一级boot的定义的一致即可)。 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)(5)、再修改”./include/configs/at91rm9200dk.h”为 修改 flash和 SDRAM的大小。 (6)、另外一个要修改的文件是: ./borad/at91rm9200dk/flash.c。这个文件修改的部分比较的多。 a. 首先是OrgDef的定义,加上目前的 flash。 b. 接下来,修改”#define FLASH_BANK_SIZE 0x200000”为自己flash的 容量 c. 在修改函数 flash_identification(flash_info_t * info)里面的打印信息,这部分将在 u-boot 启动的时候显示。 d. 然后修改函数 flash_init(void)里面对一些变量的赋值。 e. 最后修改的是函数 flash_print_info(flash_info_t * info)里面实际打印的函数信息。 f. 还有一个函数需要修改,就是: “flash_erase” ,这个函数要检测先前知道的 flash类型是 否匹配,否则,直接就返回了。把这里给注释掉。 (7)、接下来看看 SDRAM的修改。 这个里面对于“SIZE”的定义都是基于字节计算的。 只要修改”./include/configs/at91rm9200dk.h”里面的 “#define PHYS_SDRAM_SIZE 0X200000”就可以了。注意,SIZE 是以字节为单位的。 (8)、还有一个地方要注意 就是按照目前的设定,一级 boot 把 u_boot 加载到了 SDRAM 的空间为:21F00000 -> 21F16B10,这恰好是 SDRAM的高端部分。另外,BSS为 21F1AE34。 (9)、编译后,可以写入 flash了。 a. 压缩这个 u-boot.bin “gzip –c u-boot.bin > u-boot.gz” 压缩后的文件大小为: 43Kbytes b. 接着把 boot.bin和 u-boot.gz 烧到 flash里面去。 Boot.bin大约 11kBytes,在 flash的 0x1000 0000 ~ 0x1000 3fff U-Boot移植过程 ① 获得发布的最新版本 U-Boot源码,与 Linux内核源码类似,也是 bzip2 的压缩格式。可 从 U-Boot的官方网站 http://sourceforge.net/projects/U-Boot上获得; ② 阅读相关文档,主要是 U-Boot 源码根目录下的 README 文档和 U-Boot 官方网站的 DULG ( The DENX U-Boot and Linux Guide ) 文档 http://www.denx.de/twiki/bin/view/DULG/Manual。尤其是DULG 文档,从如何安装建立交叉 开发环境和解决 U-Boot移植中常见问题都一一给出详尽的说明; Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) ③ 订阅 U-Boot 用户邮件列表 http://lists.sourceforge.net/lists/listinfo/u-boot-users。在移植 U-Boot 过程中遇有问题 , 在参考相关文档和搜 索 U-Boot-User 邮 件 档 案 库 http://sourceforge.net/mailarchive/forum.php?forum_id=12898 仍不能解决的情况下,第一时间 提交所遇到的这些问题,众多热心的 U-Boot开发人员乐于迅速排查问题,而且很有可能, W.D本人直接参与指导; ④ 在建立的开发环境下进行移植工作。绝大多数的开发环境是交叉开发环境。在这方面, DENX 和 MontaVista 均提供了完整的开发工具集; ⑤ 在目标板与开发主机间接入硬件调试器。 这是进行U-Boot移植应当具备且非常关键的调 试工具。因为在整个 U-Boot的移植工作中,尤其是初始阶段,硬件调试器是我们了解目标板 真实运行状态的唯一途径。 在这方面, W.D 本人和众多嵌入式开发人员倾向于使用 BDI2000。 一方面,其价格不如 ICE 调试器昂贵,同时其可靠性高,功能强大,完全能胜任移植和调 试 U-Boot。另外,网上也有不少关于 BDI2000调试方面的参考文档。 ⑥ 如果在参考开发板上移植 U-Boot,可能需要移除目标板上已有的 BOOT LOADER。可以 根据板上 BOOT LOADER的说明文档,先着手解决在移除当前 BOOT LOADER的情况下, 如何进行恢复。以便今后在需要场合能重新装入原先的BOOT LOADER。 U-Boot移植方法 当前,对于 U-Boot的移植方法,大致分为两种。一种是先用 BDI2000创建目标板初始运行 环境,将 U- Boot镜像文件 u-boot.bin下载到目标板 RAM中的指定位置,然后,用 BDI2000 进行跟踪调试。其好处是不用将 U-Boot 镜像文件烧写到 FLASH 中去。但弊端在于对移植 开发人员的移植调试技能要求较高,BDI2000 的配置文件较为复杂。另外一种方法是用 BDI2000先将 U-Boot 镜像文件烧写到 FLASH 中去,然后利用GDB和 BDI2000进行调试。 这种方法所用 BDI2000的配置文件较为简单,调试过程与 U-Boot移植后运行过程相吻合, 即 U-Boot先从 FLASH 中运行,再重载至 RAM中相应位置,并从那里正式投入运行。唯一 感到有些麻烦的就是需要不断烧写 FLASH。 但考虑到 FLASH 常规擦写次数基本为 10万次 左右,作为移植 U-Boot,不占用太多的次数,应该不为 FLASH 烧写有什么担忧。同时, W. D本人也极力推荐使用后一种方法。笔者建议,除非U-Boot移植资深人士或有强有力的 技术支持,建议采用第二种移植方法。 U-Boot移植主要修改的文件 从移植 U-Boot最小要求-U-Boot能正常启动的角度出发,主要考虑修改如下文件: ① .h头文件,如 include/configs/RPXlite.h。可以是 U-Boot源码中已有的目标板头 文件,也可以是新命名的配置头文件;大多数的寄存器参数都是在这一文件中设置完成的; ② .c文件, 如board/RPXlite/RPXlite.c。 它是SDRAM的驱动程序, 主要完成SDRAM Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)的 UPM表设置,上电初始化。 ③ FLASH的驱动程序, 如board/RPXlite/flash.c, 或common/cfi_flash.c。 可在参考已有FLASH 驱动的基础上,结合目标板 FLASH 数据手册,进行适当修改; ④ 串口驱动,如修改cpu/mpc8xx/serial.c串口收发器芯片使能部分。 U-Boot移植要点 ① BDI2000 的配置文件。如果采用第二种移植方法,即先烧入 FLASH 的方法,配置项只 需很少几个,就可以进行 U-Boot的烧写与调试了。对 PPC 8xx系列的主板,可参考DULG 文档中 TQM8xx 的配置文件进行相应的修改。下面,笔者以美国 Embedded Planet 公司的 RPXlite DW 板为例,给出在嵌入式Linux交叉开发环境下的 BDI2000参考配置文件以作参 考: ; bdiGDB configuration file for RPXlite DW or LITE_DW ; -------------------------------------------- [INIT] ; init core register WSPR 149 0x2002000F ;DER : set debug enable register ; WSPR 149 0x2006000F ;DER : enable SYSIE for BDI flash program WSPR 638 0xFA200000 ;IMMR : internal memory at 0xFA200000 WM32 0xFA200004 0xFFFFFF89 ;SYPCR [TARGET] CPUCLOCK 40000000 ;the CPU clock rate after processing the init list BDIMODE AGENT ;the BDI working mode (LOADONLY | AGENT) BREAKMODE HARD ;SOFT or HARD, HARD uses PPC hardware breakpoints [HOST] IP 173.60.120.5 FILE uImage.litedw FORMAT BIN LOAD MANUAL ;load code MANUAL or AUTO after reset DEBUGPORT 2001 START 0x0100 [FLASH] CHIPTYPE AM29BX8 ;;Flash type (AM29F | AM29BX8 | AM29BX16 | I28BX8 | I28BX16) CHIPSIZE 0x400000 ;;The size of one flash chip in bytes BUSWIDTH 32 ;The width of the flash memory bus in bits (8 | 16 | 32) WORKSPACE 0xFA202000 ; RAM buffer for fast flash programming FILE u-boot.bin ;The file to program FORMAT BIN 0x00000000 ERASE 0x00000000 BLOCK ERASE 0x00008000 BLOCK ERASE 0x00010000 BLOCK Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)ERASE 0x00018000 BLOCK [REGS] DMM1 0xFA200000 FILE reg823.def ② U-Boot 移植参考板。这是进行 U-Boot 移植首先要明确的。可以根据目标板上 CPU、 FLASH、SDRAM的情况,以尽可能相一致为原则,先找出一个与所移植目标板为同一个或 同一系列处理器的 U-Boot 支持板为移植参考板。如 RPXlite DW 板可选择 U-Boot 源码中 RPXlite 板作为 U-Boot 移植参考板。对 U-Boot 移植新手,建议依照循序渐进的原则,目标 板文件名暂时先用移植参考板的名称,在逐步熟悉 U-Boot 移植基础上,再考虑给目标板重 新命名。在实际移植过程中,可用 Linux 命令查找移植参考板的特定代码,如 grep –r RPXlite ./ 可确定出在 U-Boot中与 RPXlite板有关的代码,依此对照目标板实际进行屏蔽或 修改。同时应不局限于移植参考板中的代码,要广泛借鉴U-Boot 中已有的代码更好地实现 一些具体的功能。 ③ U-Boot烧写地址。 不同目标板, 对 U-Boot在 FLASH 中存放地址要求不尽相同。 事实上, 这是由处理器中断复位向量来决定的,与主板硬件相关,对 MPC8xx 主板来讲,就是由硬 件配置字(HRCW)决定的。也就是说,U-Boot烧写具体位置是由硬件决定的,而不是程序设 计来选择的。程序中相应 U-Boot 起始地址必须与硬件所确定的硬件复位向量相吻合;如 RPXlite DW 板的中断复位向量设置为 0x00000100。因此, U-Boot 的 BIN 镜像文件必须烧 写到 FLASH 的起始位置。 事实上, 大多数的 PPC系列的处理器中断复位向量是 0x00000100 和 0xfff00100。这也是一般所说的高位启动和低位启动的 BOOT LOADER 所在位置。可通 过修改 U-Boot 源码.h 头文件中 CFG_MONITOR_BASE 和 board//config.mk中的 TEXT_BASE 的设置来与硬件配置相对应。 ④ CPU寄存器参数设置。根据处理器系列、类型不同,寄存器名称与作用有一定差别。必 须根据目标板的实际,进行合理配置。一个较为可行和有效的方法,就是借鉴参考移植板的 配置,再根据目标板实际,进行合理修改。这是一个较费功夫和考验耐力的过程,需要仔细 对照处理器各寄存器定义、参考设置、目标板实际作出选择并不断测试。MPC8xx处理器较 为关键的寄存器设置为 SIUMCR、PLPRCR、SCCR、BRx、ORx。 ⑤ 串口调试。能从串口输出信息,即使是乱码,也可以说 U-Boot移植取得了实质性突破。 依据笔者调试经历,串口是否有输出,除了与串口驱动相关外,还与 FLASH 相关的寄存器 设置有关。因为 U-Boot 是从 FLASH 中被引导启动的,如果 FLASH 设置不正确,U-Boot 代码读取和执行就出现一些问题。因此,还需要就FLASH 的相关寄存器设置进行一些参 数调试。同时,要注意串口收发芯片相关引脚工作波形。依据笔者调试情况,如果串口无输 出或出现乱码,一种可能就是该芯片损坏或工作不正常。 ⑥ 与启动 FLASH 相关的寄存器 BR0、OR0 的参数设置。应根据目标板 FLASH 的数据手 册与 BR0 和 OR0 的相关位含义进行合理设置。这不仅关系到 FLASH 能否正常工作,而且 与串口调试有直接的关联。 ⑦ 关于 CPLD 电路。目标板上是否有 CPLD 电路丝毫不影响 U-Boot 的移植与嵌入式操 作系统的正常运行。事实上,CPLD 电路是一个集中将板上电路的一些逻辑关系可编程设置 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)的一种实现方法。其本身所起的作用就是实现一些目标板所需的脉冲信号和电路逻辑,其功 能完全可以用一些逻辑电路与 CPU口线来实现。 ⑧ SDRAM的驱动。串口能输出以后,U-Boot移植是否顺利基本取决于 SDRAM的驱动是 否正确。与串口调试相比,这部分工作更为核心,难度更大。 MPC8xx 目标板 SDRAM 驱 动涉及三部分。一是相关寄存器的设置;二是 UPM表;三是 SDRAM上电初始化过程。任 何一部分有问题,都影响 U- Boot、嵌入式操作系统甚至应用程序的稳定、可靠运行。所 以说,SDRAM 的驱动不仅关系到 U-Boot 本身能否正常运行,而且还与后续部分相关,是 相当关键的部分。 ⑨ 补充功能的添加。在获得一个能工作的 U-Boot后,就可以根据目标板和实际开发需要, 添加一些其它功能支持。如以太网、LCD、NVRAM 等。与串口和 SDRAM 调试相比,在 已有基础之上,这些功能添加还是较为容易的。大多只是在参考现有源码的基础上,进行一 些修改和配置。 另外,如果在自主设计的主板上移植 U-Boot,那么除了考虑上述软件因素以外,还需要排 查目标板硬件可能存在的问题。如原理设计、PCB 布线、元件好坏。在移植过程中,敏锐 判断出故障态是硬件还是软件问题,往往是关系到项目进度甚至移植成败的关键,相应难度 增加许多。 下面以移植 u-boot 到 44B0开发板的步骤为例,移植中上仅需要修改和硬件相关的部分。在 代码结构上: 1) 在 board 目录下创建 ev44b0ii 目录,创建 ev44b0ii.c 以及 flash.c,memsetup.S,u-boot.lds 等。不需要从零开始,可选择一个相似的目录,直接复制过来,修改文件名以及内容。我在 移植 u-boot 过程中,选择的是 ep7312 目录。由于 u-boot 已经包含基于 s3c24b0 的开发板 目录,作为参考,也可以复制相应的目录。 2) 在 cpu 目录下创建 arm7tdmi 目录,主要包含 start.S, interrupts.c 以及 cpu.c,serial.c几个文 件。同样不需要从零开始建立文件,直接从arm720t 复制,然后修改相应内容。 3) 在 include/configs 目录下添加 ev44b0ii.h,在这里放上全局的宏定义等。 4) 找到 u-boot 根目录下 Makefile 修改加入 ev44b0ii_config : unconfig @./mkconfig $(@:_config=) arm arm7tdmi ev44b0ii 5) 运行 make ev44bii_config,如果没有错误就可以开始硬件相关代码移植的工作 u-boot 的体系结构 1) 总体结构 u-boot 是一个层次式结构。从上图也可以看出,做移植工作的软件人员应当提供串口驱动 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)(UART Driver),以太网驱动(Ethernet Driver),Flash 驱动(Flash 驱动),USB 驱动(USB Driver)。目前,通过 USB 口下载程序显得不是十分必要,所以暂时没有移植 USB 驱动。 驱动层之上是 u-boot 的应用,command 通过串口提供人机界面。我们可以使用一些命令做 一些常用的工作,比如内存查看命令 md。 Kermit 应用主要用来支持使用串口通过超级终端下载应用程序。TFTP 则是通过网络方式 来下载应用程序,例如uclinux 操作系统。 2) 内存分布 在 flash rom 中内存分布图 ev44b0ii 的 flash 大小 2M(8bits),现在将 0-40000 共 256k 作为 u-boot 的存储空间。由于 u-boot 中有一些环境变量,例如 ip 地址,引导文件名等,可在命 令行通过 setenv 配置好,通过 saveenv 保存在 40000-50000(共 64k)这段空间里。如果存在 保存好的环境变量,u-boot 引导将直接使用这些环境变量。正如从代码分析中可以看到, 我们把 flash 引导代码搬移到 DRAM 中运行。下图给出 u-boot 的代码在 DRAM 中的位 置。引导代码 u-boot 将从 0x0000 0000 处搬移到 0x0C700000 处。特别注意的由于 ev44b0ii uclinux 中断向量程序地址在 0x0c00 0000 处,所以不能将程序下载到0x0c00 0000 出,通 常下载到 0x0c08 0000 处。 2) start.S 代码结构 1) 定义入口 一个可执行的 Image 必须有一个入口点并且只能有一个唯一的全局入口,通常这个入口放 在 Rom(flash)的 0x0 地址。例如 start.S 中的 .globl _start _start: 值得注意的是你必须告诉编译器知道这个入口, 这个工作主要是修改连接器脚本文件 (lds)。 2) 设置异常向量(Exception Vector) 异常向量表,也可称为中断向量表,必须是从 0 地址开始,连续的存放。如下面的就包括 了复位(reset),未定义处理(undef),软件中断(SWI),预去指令错误(Pabort),数据错误 (Dabort), 保留,以及 IRQ,FIQ 等。注意这里的值必须与 uclinux 的 vector_base 一致。这就是说如果 uclinux 中 vector_base(include/armnommu/proc-armv/system.h) 定 义 为 0x0c00 0000, 则 HandleUndef 应该在 0x0c00 0004。 b reset //for debug ldr pc,=HandleUndef ldr pc,=HandleSWI ldr pc,=HandlePabort ldr pc,=HandleDabort b . ldr pc,=HandleIRQ ldr pc,=HandleFIQ ldr pc,=HandleEINT0 /*mGA H/W interrupt vector table*/ ldr pc,=HandleEINT1 ldr pc,=HandleEINT2 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)ldr pc,=HandleEINT3 ldr pc,=HandleEINT4567 ldr pc,=HandleTICK /*mGA*/ b . b . ldr pc,=HandleZDMA0 /*mGB*/ ldr pc,=HandleZDMA1 ldr pc,=HandleBDMA0 ldr pc,=HandleBDMA1 ldr pc,=HandleWDT ldr pc,=HandleUERR01 /*mGB*/ b . b . ldr pc,=HandleTIMER0 /*mGC*/ ldr pc,=HandleTIMER1 ldr pc,=HandleTIMER2 ldr pc,=HandleTIMER3 ldr pc,=HandleTIMER4 ldr pc,=HandleTIMER5 /*mGC*/ b . b . ldr pc,=HandleURXD0 /*mGD*/ ldr pc,=HandleURXD1 ldr pc,=HandleIIC ldr pc,=HandleSIO ldr pc,=HandleUTXD0 ldr pc,=HandleUTXD1 /*mGD*/ b . b . ldr pc,=HandleRTC /*mGKA*/ b . b . b . b . b . /*mGKA*/ b . b . ldr pc,=HandleADC /*mGKB*/ b . b . b . b . b . /*mGKB*/ b . Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)b . ldr pc,=EnterPWDN 作为对照:请看以上标记的值: .equ HandleReset, 0xc000000 .equ HandleUndef,0xc000004 .equ HandleSWI, 0xc000008 .equ HandlePabort, 0xc00000c .equ HandleDabort, 0xc000010 .equ HandleReserved, 0xc000014 .equ HandleIRQ, 0xc000018 .equ HandleFIQ, 0xc00001c /*the value is different with an address you think it may be. *IntVectorTable */ .equ HandleADC, 0xc000020 .equ HandleRTC, 0xc000024 .equ HandleUTXD1, 0xc000028 .equ HandleUTXD0, 0xc00002c .equ HandleSIO, 0xc000030 .equ HandleIIC, 0xc000034 .equ HandleURXD1, 0xc000038 .equ HandleURXD0, 0xc00003c .equ HandleTIMER5, 0xc000040 .equ HandleTIMER4, 0xc000044 .equ HandleTIMER3, 0xc000048 .equ HandleTIMER2, 0xc00004c .equ HandleTIMER1, 0xc000050 .equ HandleTIMER0, 0xc000054 .equ HandleUERR01, 0xc000058 .equ HandleWDT, 0xc00005c .equ HandleBDMA1, 0xc000060 .equ HandleBDMA0, 0xc000064 .equ HandleZDMA1, 0xc000068 .equ HandleZDMA0, 0xc00006c .equ HandleTICK, 0xc000070 .equ HandleEINT4567, 0xc000074 .equ HandleEINT3, 0xc000078 .equ HandleEINT2, 0xc00007c .equ HandleEINT1, 0xc000080 .equ HandleEINT0, 0xc000084 3) 初始化 CPU 相关的 pll,clock,中断控制寄存器 依次为关闭 watch dog timer,关闭中断,设置 LockTime,PLL(phase lock loop),以及时钟。 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)这些值(除了LOCKTIME)都可从 Samsung 44b0 的手册中查到。 ldr r0,WTCON //watch dog disable ldr r1,=0x0 str r1,[r0] ldr r0,INTMSK ldr r1,MASKALL //all interrupt disable str r1,[r0] /***************************************************** * Set clock control registers * *****************************************************/ ldr r0,LOCKTIME ldr r1,=800 // count = t_lock * Fin (t_lock=200us, Fin=4MHz) = 800 str r1,[r0] ldr r0,PLLCON /*temporary setting of PLL*/ ldr r1,PLLCON_DAT /*Fin=10MHz,Fout=40MHz or 60MHz*/ str r1,[r0] ldr r0,CLKCON ldr r1,=0x7ff8 //All unit block CLK enable str r1,[r0] 4) 初始化内存控制器 内存控制器,主要通过设置 13 个从 1c80000 开始的寄存器来设置,包括总线宽度, 8 个内存 bank,bank 大小,sclk,以及两个 bank mode。 /***************************************************** * Set memory control registers * *****************************************************/ memsetup: adr r0,SMRDATA ldmia r0,{r1-r13} ldr r0,=0x01c80000 //BWSCON Address stmia r0,{r1-r13} 5) 将 rom 中的程序复制到 RAM 中 首先利用 PC 取得 bootloader 在 flash 的起始地址,再通过标号之差计算出这个程序代 码的大小。这些标号,编译器在连接(link)的时候生成正确的分布的值。取得正 确信息后,通过寄存器(r3 到 r10)做为复制的中间媒介,将代码复制到 RAM 中。 relocate: /* * relocate armboot to RAM */ Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)adr r0, _start /* r0 <- current position of code */ ldr r2, _armboot_start ldr r3, _armboot_end sub r2, r3, r2 /* r2 <- size of armboot */ ldr r1, _TEXT_BASE /* r1 <- destination address */ add r2, r0, r2 /* r2 baudrate) + 0.5) -1 )计算得出。这可以在手 册中查到。其他的函数包括发送,接收。这个时候没有中断,是通过循环等待来判断是否动 作完成。 例如,接收函数: while(!(rUTRSTAT0 & 0x1)); //Receive data read return RdURXH0(); 2. 时钟部分 实现了延时函数 udelay。 这里的 get_timer 由于没有使用中断,是使用全局变量来累加的。 3. flash 部分 flash 作为内存的一部分,读肯定没有问题,关键是 flash 的写部分。 Flash 的写必须先擦除,然后再写。 unsigned long flash_init (void) { int i; u16 manId,devId; //first we init it as unknown,even if you forget assign it below,it's not a problem for (i=0; i < CFG_MAX_FLASH_BANKS; ++i){ flash_info[i].flash_id = FLASH_UNKNOWN; flash_info[i].sector_count=CFG_MAX_FLASH_SECT; } /*check manId,devId*/ _RESET(); _WR(0x555,0xaa); _WR(0x2aa,0x55); _WR(0x555,0x90); manId=_RD(0x0); _WR(0x555,0xaa); _WR(0x2aa,0x55); _WR(0x555,0x90); Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)devId=_RD(0x1); _RESET(); printf("flashn"); printf("Manufacture ID=%4x(0x0004), Device ID(0x22c4)=%4xn",manId,devId); if(manId!=0x0004 && devId!=0x22c4){ printf("flash check faliluren"); return 0; }else{ for (i=0; i = CFG_FLASH_BASE //onitor protection ON by default flash_protect(FLAG_PROTECT_SET, CFG_MONITOR_BASE, CFG_MONITOR_BASE+monitor_flash_len-1, &flash_info[0]); #endif */ flash_info[0].size =PHYS_FLASH_SIZE; return (PHYS_FLASH_SIZE); } flash_init 完成初始化部分,这里的主要目的是检验flash 的型号是否正确。 int flash_erase (flash_info_t *info, int s_first, int s_last) { volatile unsigned char *addr = (volatile unsigned char *)(info->start[0]); int flag, prot, sect, l_sect; //ulong start, now, last; u32 targetAddr; u32 targetSize; /*zyy note:It is required and can't be omitted*/ rNCACHBE0=( (0x2000000>>12)<>12); //flash area(Bank0) must be non-cachable area. rSYSCFG=rSYSCFG & (~0x8); //write buffer has to be off for proper timing. if ((s_first s_last)) { if (info->flash_id == FLASH_UNKNOWN) { printf ("- missingn"); } else { printf ("- no sectors to erasen"); Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)} return 1; } if ((info->flash_id == FLASH_UNKNOWN) || (info->flash_id > FLASH_AMD_COMP)) { printf ("Can't erase unknown flash type - abortedn"); return 1; } prot = 0; for (sect=s_first; sectprotect[sect]) { prot++; } } if (prot) { printf ("- Warning: %d protected sectors will not be erased!n", prot); } else { printf ("n"); } l_sect = -1; /* Disable interrupts which might cause a timeout here */ flag = disable_interrupts(); /* Start erase on unprotected sectors */ for (sect = s_first; sectprotect[sect] == 0) {/* not protected */ targetAddr=0x10000*sect; if(targetAddr<0x1F0000) targetSize=0x10000; else if(targetAddr<0x1F8000) targetSize=0x8000; else if(targetAddr<0x1FC000) targetSize=0x2000; else targetSize=0x4000; F29LV160_EraseSector(targetAddr); l_sect = sect; if(!BlankCheck(targetAddr, targetSize)) printf("BlankCheck Errorn"); } } /* re-enable interrupts if necessary */ if (flag) enable_interrupts(); Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)/* wait at least 80us - let's wait 1 ms */ udelay (1000); /* *We wait for the last triggered sector */ if (l_sect > 16) & 0xffff; low=swap_16(low); high=swap_16(high); tempPt=(volatile u16 *)dest; _WR(0x555,0xaa); _WR(0x2aa,0x55); _WR(0x555,0xa0); *tempPt=high; Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)_WAIT(); _WR(0x555,0xaa); _WR(0x2aa,0x55); _WR(0x555,0xa0); *(tempPt+1)=low; _WAIT(); return 0; } wirte_word 则想 flash 里面写入 unsigned long 类型的 data, 因为flash 一次只能写入16bits, 所以这里分两次写入。 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com)u-boot源码分析——启动第一阶段 分析代码当然要从上电后执行的第一条指令开始看起咯, 那第一条指令在哪呢? 还是以 smdk2410 为 例,我们看它的链接脚本: 文件 board/smsk2410/u-boot.lds: …… ENTRY(_start) //指明入口地址(见汇编指令) SECTIONS { . = 0x00000000; //入口地址为 0x00000000,硬件决定的 . = ALIGN(4); //按 4 字节对齐,即按字对齐(32 位) .text: //文本段,即代码段 { cpu/arm920t/start.o (.text) //确定启动后执行的第一个文件 *(.text) } . = ALIGN(4); .rodata : { *(.rodata) } …… } 由这个文件可知第一个执行的文件是 cpu/arm920t/start.S,那第一条指令(_start)很可能就在这个文件中 了。我们看这个文件: cpu/arm920t/start.S: .globl _start /*这 8 行为中断向量表,参考arm书籍可确定这段代码的编写方法*/ _start: b reset //复位向量,CPU上电后执行的第一条语句 ldr pc, _undefined_instruction ldr pc, _software_interrupt ldr pc, _prefetch_abort ldr pc, _data_abort ldr pc, _not_used ldr pc, _irq //中断向量 ldr pc, _fiq //快速中断向量 /*.word为伪指令,变量替换*/ _undefined_instruction: .word undefined_instruction _software_interrupt: .word software_interrupt Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) _prefetch_abort: .word prefetch_abort _data_abort: .word data_abort _not_used: .word not_used _irq: .word irq _fiq: .word fiq S3C2410的 CPU规定开机后的 PC寄存器地址为 0,即从 0 地址开始执行指令,因此我们必须把我们的 复位代码放在 0 地址处才能正常开机。 ARM核也规定启动地址处的 32个字节必须存放异常向量跳转表,里面保存有中断,异常等的处理函数 地址。当系统产生中断时,必定跳到这里来开始处理中断。具体可参考 ARM方面的书籍。 由 u-boot.lds可知入口地址为_start, 即开机后从_start处开始执行指令。所以第一条指令就是: b reset //跳转到 reset处进行复位处理 cpu/arm920t/start.S: // CPU上电后跳转到此处,CPU进入 SVC32模式,这样可以拥有特权操作,参考 ARM书籍 /* the actual reset code */ reset: mrs r0,cpsr bic r0,r0,#0x1f orr r0,r0,#0xd3 msr cpsr,r0 /* turn off the watchdog */ //CPU上操作 watchdog相关的寄存器地址,可参考CPU的 datasheet,这里用到的地址都是实地址, //因为还没为 MMU等部件进行初始化,也没切换操作模式呢。 #if defined(CONFIG_S3C2400) # define pWTCON 0x15300000 # define INTMSK 0x14400008 /* Interupt-Controller base addresses */ # define CLKDIVN 0x14800014 /* clock divisor register */ #elif defined(CONFIG_S3C2410) # define pWTCON 0x53000000 # define INTMSK 0x4A000008 /* Interupt-Controller base addresses */ # define INTSUBMSK 0x4A00001C # define CLKDIVN 0x4C000014 /* clock divisor register */ #endif #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) ldr r0, =pWTCON mov r1, #0x0 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) str r1, [r0] //关闭 watchdog,具体寄存器含义可参考 CPU手册 /* * mask all IRQs by setting all bits in the INTMSK - default */ mov r1, #0xffffffff ldr r0, =INTMSK str r1, [r0] //关闭所有的中断 # if defined(CONFIG_S3C2410) ldr r1, =0x3ff ldr r0, =INTSUBMSK str r1, [r0] //关闭所有的中断 # endif /* FCLK:HCLK:PCLK = 1:2:4 */ /* default FCLK is 120 MHz ! */ //设置 HCLK 为 FCLK/2, PCLK 为 FCLK/4, FCLK 为 CPU产生 clock,HCLK 为 AHB总线上的设备产生 //clock, PCLK 为 APB总线上的设备产生 clock,具体参考 s3c2410的 datasheet ldr r0, =CLKDIVN mov r1, #3 str r1, [r0] #endif /* CONFIG_S3C2400 || CONFIG_S3C2410 */ /* * we do sys-critical inits only at reboot, * not when booting from ram! */ //做系统相关的重要初始化,这些初始化代码只在系统重起的时候执行, // CONFIG_SKIP_LOWLEVEL_INIT 可以看 README. #ifndef CONFIG_SKIP_LOWLEVEL_INIT bl cpu_init_crit //可以先看这段代码在转回来接着看后面的复位过程。 #endif //内存配置完后,可以进行重定位操作了 #ifndef CONFIG_SKIP_RELOCATE_UBOOT relocate: /* 重定位 u-boot到 RAM中*/ adr r0, _start /* r0 = flash中的代码的起始地址*/ ldr r1, _TEXT_BASE /* r1= 代码在 RAM中的起始地址 */ cmp r0, r1 /* 看是否 u-boot就在 RAM中运行*/ beq stack_setup /*如果在 RAM中则无需重定位*/ /*开始重定位,即把u-boot从 flash中搬到 RAM 中去运行*/ ldr r2, _armboot_start /*r2 = flash中代码的起始地址,看_armboot_start的定义*/ ldr r3, _bss_start /*r3 = bss段的起始地址,_bss_start可在 u-boot.lds中查看。*/ Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) sub r2, r3, r2 /* r2 = 需要重定位的字节数*/ add r2, r0, r2 /* r2 = flash中 RO,RW 内容的结束地址 */ //开始把代码从 flash中搬运到 RAM中 copy_loop: ldmia r0!, {r3-r10} /*获取从 r0开始的代码,存入 r3—r10*/ stmia r1!, {r3-r10} /*把 r3—r10 的内容存入r1 所在位置,即 RAM中*/ cmp r0, r2 /*copy所有代码 */ ble copy_loop #endif /* CONFIG_SKIP_RELOCATE_UBOOT */ /*设置栈地址*/ stack_setup: ldr r0, _TEXT_BASE /*upper 128 KiB: relocated uboot*/ sub r0, r0, #CFG_MALLOC_LEN /*malloc分配内存的区域,大小以板子的配置而定,smdk2410的在 include/configs/smdk2410.h中定义*/ sub r0, r0, #CFG_GBL_DATA_SIZE /* 存放 bdinfo的区域,定义同上*/ #ifdef CONFIG_USE_IRQ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) //保留中断所需的区域 #endif sub sp, r0, #12 /* 保留 12 字节给 abort-stack, 并设好堆栈*/ //bss段内容清 0 clear_bss: ldr r0, _bss_start /* find start of bss segment */ ldr r1, _bss_end /* stop here */ mov r2, #0x00000000 /* clear */ clbss_l:str r2, [r0] /* clear loop... */ add r0, r0, #4 cmp r0, r1 ble clbss_l #if 0 /* try doing this stuff after the relocation */ ldr r0, =pWTCON mov r1, #0x0 str r1, [r0] /* mask all IRQs by setting all bits in the INTMR - default*/ mov r1, #0xffffffff ldr r0, =INTMR str r1, [r0] /* FCLK:HCLK:PCLK = 1:2:4 */ /* default FCLK is 120 MHz ! */ ldr r0, =CLKDIVN mov r1, #3 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) str r1, [r0] /* END stuff after relocation */ #endif ldr pc, _start_armboot //跳转到_start_armboot处执行。 _start_armboot: .word start_armboot 总结 reset这块代码,主要完成了一下几个部分: 1. 重要部分的初始化工作,如禁止中断,关闭 watchdog,初始化 memory控制器等 2. 重定位boot loader 到 ram 3. 设置好堆栈 4. 跳转到第 2阶段执行 完成这些后,此时内存的分布情况如下: 这个图代表的是 u-boot自己在内存的情况, 和上面的图不一样, 这里的_TEXT_BASE 就是 0x33F8’ 0000 接着看 CPU_init_critical cpu/arm920t/start.S: /* ************************************************************************** * CPU_init_critical registers * 设置 cache,TLB,MMU等寄存器 * 设置内存操作的时序 * ************************************************************************* */ cpu_init_crit: /* * flush v4 I/D caches */ /*使 cache和 TLB无效,可以参考 data sheet*/ mov r0, #0 mcr p15, 0, r0, c7, c7, 0 /* 使指令 cache和数据 cache无效 */ mcr p15, 0, r0, c8, c7, 0 /* 使 TLB无效 */ /* * disable MMU stuff and caches */ mrc p15, 0, r0, c1, c0, 0 /*读出 c1 控制寄存器的值*/ bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS) bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM),小端对齐,关闭数据 cache,关 //闭错误检测,关闭MMU orr r0, r0, #0x00000002 @ set bit 2 (A) Align, 使能错误检测 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache, 使能指令 cache mcr p15, 0, r0, c1, c0, 0 /*设置 c1 控制寄存器*/ /*可以参考 data sheet*/ Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) /* * before relocating, we have to setup RAM timing * because memory timing is board-dependend, you will * find a lowlevel_init.S in your board directory. */ //在把 u-boot 重定位到 RAM 前,我们必须先把 RAM 的时序设置好,内存时序是依板子而定的, 所以这里的初始化应该由我们提供,一般在我们的板子所在目录下有个 lowlevel_init.S来负责这件事情。 特定板子的目录还记得吗, 呵呵回到上面在看看。 mov ip, lr bl lowlevel_init mov lr, ip mov pc, lr //类似于函数返回 cpu_init_crit主要是使能了 instruction cache,关闭了 MMU等部件,但是好像在 u-boot后面的代码里没有 看见打开 MMU 的操作,我猜测可能是留到了 OS 启动的时候再打开了吧,data cache 在第二阶段的 board_init下被使能。 接着看 lowlevel_init。以 smdk2410位例 board/smdk2410/lowlevel_init.S _TEXT_BASE: .word TEXT_BASE .globl lowlevel_init lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ // 内存控制器的配置, 配置完后就可以使用内存了 ldr r0, =SMRDATA //在下面定义 ldr r1, _TEXT_BASE sub r0, r0, r1 // ldr r1, =BWSCON /* Bus Width Status Controller */ add r2, r0, #13*4 0: ldr r3, [r0], #4 str r3, [r1], #4 //设置内存配置寄存器,可以对着datasheet来看这里的设置,包括时序位宽等 等, 使用一个循环来配置所有的寄存器 cmp r2, r0 bne 0b /* everything is fine now */ mov pc, lr .ltorg /* the literal pools origin */ //这些就是要被设置进内存配置寄存器的值, SMRDATA: Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON< <20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) .word 0x32 .word 0x30 .word 0x30 这部分代码主要是设置 memory的时序,位宽等参数 Create PDF files without this message by purchasing novaPDF printer (http://www.novapdf.com) U-BOOT源码分析及移植 本文从以下几个方面粗浅地分析 u-boot并移植到 FS2410 板上: 1、u-boot工程的总体结构 2、u-boot的流程、主要的数据结构、内存分配。 3、u-boot的重要细节,主要分析流程中各函数的功能。 4、基于 FS2410板子的u-boot移植。实现了 NOR Flash和 NAND Flash启动,网络功能。 这些认识源于自己移植 u-boot过程中查找的资料和对源码的简单阅读。下面主要以 smdk2410为分析对 象。 一、u-boot工程的总体结构: 1、源代码组织 对于 ARM而言,主要的目录如下: board 平台依赖 存放电路板相关的目录文件,每一套板子对 应一个目 录。如 smdk2410(arm920t) cpu 平台依赖 存放 CPU 相关的目录文件,每一款 CPU 对应一个目 录,例如:arm920t、 xscale、i386 等目录 lib_arm 平台依赖 存放对 ARM 体系结构通用的文件,主要用于实现 ARM平台通用的函数,如软件浮点。 common 通用 通用的多功能函数实现,如环境,命令,控制台相关的函数实 现。 include 通用 头文件和开发板配置文件,所有开发板的配置文件都在 configs目录下 lib_generic 通用 通用库函数的实现 net 通用 存放网络协议的程序 drivers 通用 通用的设备驱动程序,主要有以太网接口的驱动,nand 驱 动。 ....... 2.makefile简要分析 所有这些目录的编译连接都是由顶层目录的 makefile 来确定的。 在执行 make之前,先

1,077

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧