readme

来自「A sample source code to blink led for AT」· 代码 · 共 64 行

TXT
64
字号
This simple application maps the AT91RM9200 system controller into  user space to access the controllers peripherals such as GPIO, etc.  In this program the GPIO signals controlling the user LEDs are toggled  at a fixed rate.AT91RM9200.h was taken from u-boot tree (open-source)If you are using the sample buildroot cross compiler tree from  KwikByte FTP server (copied to your root at /), you can build  with "make" command.If not, edit the Makefile for your compiler (top lines):BASE_TOOLS=/buildroot/build_arm_nofpu/staging_dir/binCC=${BASE_TOOLS}/arm-linux-gccLD=${BASE_TOOLS}/arm-linux-ldBy default, the application is built as a static binary so no libraries  are required on the target.  Also, debugging information is included  so you can debug this image.If you want to reduce the size of the image, make sure libraries are installed  on the target and change the Makefile (LDFLAGS) so that the image is not  statically linked and debug information is not includedMost people will not want to do this because this program is just a simple  example anyway.After you transfer the image to the board, make sure the file has the correct  permissions.  You can view the permissions with "ls -al led_app".  You can  set permissions with "chmod 755 led_app".Execute the program with "./led_app"--------------------------------------------------------------Transferring the program to the board:If the app is not already on the board, you can do one of the following to  get it there:  1) Mount NFS share and copy to local directory  2) Copy to USB disk from PC, then copy from USB disk to board  3) Use TFTP  <- easiest methodMake sure you set the MAC on the board first.  This is done with  "setenv ethaddr x.x.x.x.x.x".  The 'x' characters must be replaced with a  valid MAC.  Then, set the local IP with "setenv ipaddr y.y.y.y" where  the 'y' values are set for your network.  You can test the setting with  "ping z.z.z.z" where the 'z' characters represent another machine on the  network that will respond to ping packets: e.g., a router.  This is all  done within U-Boot.  You can save the changes with "saveenv" or just proceed.  Boot the board now with "boot".  During the next seconds, you will see the  boot progress displayed on the serial terminal (serial cable is included  with the board).  The root password is empty, so just login as 'root'.  Verify the network configuration with "ifconfig eth0".  If you did not  set the IP, you can do so here with "ifconfig eth0 y.y.y.y".    Now, "tftp -g -r led_app h.h.h.h" where the 'h' characters are the IP  address of the TFTP server: e.g., your host PC running a simple TFTP server  program.  Now, check the file permissions (see above) and run the program.  You will see the LEDs toggling and observe some output on the serial terminal!

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?