u-boot-2012.10移植到AT91RM9200(包括NAND FLASH)
基于中嵌SRM9204
目 录
5 保存环境变量到NAND Flash和添加NAND 分区信息
6.2修改drivers/mtd/nand/nand_util.c
7.3 修改arch/arm/cpu/arm920t/at91/cpu.c
7.1注释掉include/config_cmd_default.h中一些不用的命令
7.2注释掉include/configs/at91rm9200ek.h中一些不用的命令
8.1配置:修改include/configs/at91rm9200ek.h
1 配置
1.1修改顶层Makefile(可选)
root@zjh:/home/work/u-boot-2012.10#vi Makefile
411 $(obj)u-boot.bin: $(obj)u-boot
412 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
413 $(BOARD_SIZE_CHECK)
414 cp u-boot.bin /home/tftpboot 根据自己的环境修改交叉编译器前缀
我的交叉编译器版本为4.4.3
1.2配置
root@zjh:/home/work/u-boot-2012.10#vi boards.cfg
搜索at91
60 at91rm9200ek arm arm920t at91rm9200ek atmel at91 at91rm9200ek
61 at91rm9200ek_ram arm arm920t at91rm9200ek atmel at91 at91rm9200ek:RAMBOOT
可以看到有两行,一个是基于Flash启动,一个是基于RAM启动,我们先配置成基于RAM启动,编译后使用原有的u-boot将新的u-boot下载到RAM,通过go命令运行
root@zjh:/home/work/u-boot-2012.10#make at91rm9200ek_ram_config
root@zjh:/home/work/u-boot-2012.10#make
以上两步可合成一步
root@zjh:/home/work/u-boot-2012.10#make at91rm9200ek_ram
编译成功后,将生成u-boot.bin,如果进行了1.1,则会将u-boot.bin拷贝到tftp服务器目录/home/tftpboot
1.3下载、运行、测试
首先查看u-boot链接地址
root@zjh:/home/work/u-boot-2012.10#vi include/configs/at91rm9200ek.h
42 #ifdefCONFIG_RAMBOOT
43 #define CONFIG_SKIP_LOWLEVEL_INIT
44 #define CONFIG_SYS_TEXT_BASE 0x20100000
45 #else
46 #defineCONFIG_SYS_TEXT_BASE 0x10000000
47 #endif
我们配置为RAM启动,将会跳过底层初始化,这是链接地址为0x20100000
启动原有的u-boot,执行如下操作
U-Boot@zjh> tftpboot u-boot.bin
emac: Starting autonegotiation...
emac: Autonegotiation complete
emac: link up, 100Mbps full-duplex
Using emac device
TFTP from server 192.168.1.100; our IP address is 192.168.1.105
Filename 'u-boot.bin'.
Load address: 0x20100000
Loading: T ###############
done
Bytes transferred = 206924 (3284c hex)
U-Boot@zjh> go
## Starting application at 0x20100000 ...
U-Boot 2012.10 (Aug 02 2013 - 10:50:07)
DRAM: 32 MiB
WARNING: Caches not enabled
Flash: 8 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0
U-Boot>
2 修改内存配置参数(根据芯片手册修改)
2.1 修改配置参数
root@zjh:/home/work/u-boot-2012.10#vi include/configs/at91rm9200ek.h
83 #defineCONFIG_SYS_SDRAM_SIZE SZ_M
09 #defineCONFIG_SYS_SDRC_CR_VAL 0x2188c159 /* set up the CONFIG_SYS_SDRAM */
2.2 编译
root@zjh:/home/work/u-boot-2012.10#make distclean && make at91rm9200ek_ram
注:最后先make distclean,再编译,否则有时可能会有问题
2.3运行测试
启动原有的u-boot,执行如下操作
U-Boot@zjh> tftpboot u-boot.bin
emac:Starting autonegotiation...
emac:Autonegotiation complete
emac: linkup, 100Mbps full-duplex
Using emacdevice
TFTP fromserver 192.168.1.100; our IP address is 192.168.1.105
Filename'u-boot.bin'.
Load address:0x20100000
Loading: T###############
done
Bytestransferred = 206924 (3284c hex)
U-Boot@zjh>go 20100000
## Startingapplication at 0x20100000 ...
U-Boot2012.10 (Aug 02 2013 - 11:24:55)
DRAM: 64 MiB
WARNING:Caches not enabled
Flash: 8 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any keyto stop autoboot: 0
U-Boot>
3 配置网络参数
3.1 配置
root@zjh:/home/work/u-boot-2012.10#vi include/configs/at91rm9200ek.h
146 /*
147 * Network Driver Setting
148 */
149 #defineCONFIG_DRIVER_AT91EMAC
150 #defineCONFIG_SYS_RX_ETH_BUFFER 16
151 #defineCONFIG_RMII
152 #defineCONFIG_MII
153
154 #define CONFIG_NETMASK 255.255.255.0
155 #define CONFIG_IPADDR 192.168.1.105
156 #define CONFIG_SERVERIP 192.168.1.100
157 #define CONFIG_ETHADDR 00:0c:29:4d:e4:f4
也可以不用配置,启动u-boot后跳过命令设置
3.2 编译
root@zjh:/home/work/u-boot-2012.10#make distclean && make at91rm9200ek_ram
3.3运行测试
启动原有的u-boot,执行如下操作
U-Boot@zjh> tftpboot u-boot.bin
emac:Starting autonegotiation...
emac:Autonegotiation complete
emac: linkup, 100Mbps full-duplex
Using emacdevice
TFTP fromserver 192.168.1.100; our IP address is 192.168.1.105
Filename'u-boot.bin'.
Load address:0x20100000
Loading:###############
done
Bytestransferred = 207016 (328a8 hex)
U-Boot@zjh>go 20100000
## Startingapplication at 0x20100000 ...
U-Boot2012.10 (Aug 02 2013 - 11:33:02)
DRAM: 64 MiB
WARNING:Caches not enabled
Flash: 8 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any keyto stop autoboot: 0
U-Boot>ping 192.168.1.100
emac: linkup, 100Mbps full-duplex
Using emacdevice
host192.168.1.100 is alive
4 移植NANDFlash驱动
4.1 原理图
4.2配置
root@zjh:/home/work/u-boot-2012.10#vi include/configs/at91rm9200ek.h
70 #define CONFIG_ATMEL_LEGACY
137 #include<config_cmd_default.h>
138
140 #defineCONFIG_CMD_DHCP
141 #defineCONFIG_CMD_FAT
142 #defineCONFIG_CMD_MII
143 #defineCONFIG_CMD_PING
144 #defineCONFIG_CMD_USB
145 #undefCONFIG_CMD_FPGA
146 #define CONFIG_CMD_NAND
148 /* NAND flash */
149 #ifdef CONFIG_CMD_NAND
150 #define CONFIG_NAND_ATMEL
151 #define CONFIG_SYS_MAX_NAND_DEVICE 1
152 #define CONFIG_SYS_NAND_BASE 0x40000000 // CS3
153 #define CONFIG_SYS_NAND_DBW_8
154 #define CONFIG_SYS_NAND_MASK_ALE (1 << 22)
154 #define CONFIG_SYS_NAND_MASK_CLE (1 << 21)
155 #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PC0
156 #define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC2
157 #endif
4.2添加代码
root@zjh:/home/work/u-boot-2012.10#vi drivers/mtd/nand/atmel_nand.c
34 #include <asm/arch/at91_pmc.h>
34 #include <asm/arch/at91_mc.h>
void nand_init_f(void)
{
at91_mc_t *mc = (at91_mc_t *)ATMEL_BASE_MC;
at91_pmc_t *pmc = (at91_pmc_t*)ATMEL_BASE_PMC;
u32 csa;
csa = readl(&mc->ebi.csa);
writel(csa | AT91_EBI_CSA_CS3A,&mc->ebi.csa);
writel(AT91_SMC_CSR_ACSS_STANDARD |AT91_SMC_CSR_DBW_8 | AT91_SMC_CSR_WSEN | \
AT91_SMC_CSR_NWS(5) | AT91_SMC_CSR_TDF(1)| AT91_SMC_CSR_RWSETUP(1) | \
AT91_SMC_CSR_RWHOLD(2),&mc->smc.csr[3]);
/* Enable PIOC clock */
writel(1 << ATMEL_ID_PIOC,&pmc->pcer);
at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */
at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */
at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 0);
}
ntatmel_nand_chip_init(int devnum, ulong base_addr)
{
int ret;
struct mtd_info *mtd =&nand_info[devnum];
struct nand_chip *nand =&nand_chip[devnum];
nand_init_f();
…
}
static voidat91_nand_hwcontrol(struct mtd_info *mtd,
int cmd, unsigned intctrl)
{
struct nand_chip *this = mtd->priv;
if (ctrl& NAND_CLE)
writeb(cmd, this->IO_ADDR_W + CONFIG_SYS_NAND_MASK_CLE);
else
writeb(cmd, this->IO_ADDR_W +CONFIG_SYS_NAND_MASK_ALE);
}
root@zjh:/home/work/u-boot-2012.10#vi drivers/mtd/nand/nand_base.c
#include<asm/arch/gpio.h>
#include<asm/arch/at91_pio.h>
static voidnand_select_chip(struct mtd_info *mtd, int chipnr)
{
switch (chipnr) {
case -1:
at91_set_gpio_value(CONFIG_SYS_NAND_ENABLE_PIN, 1);
break;
case 0:
at91_set_gpio_value(CONFIG_SYS_NAND_ENABLE_PIN, 0);
break;
default:
BUG();
}
}
4.3 编译
4.4 运行测试
启动原有的u-boot,执行如下操作
U-Boot@zjh> tftpboot u-boot.bin
emac:Starting autonegotiation...
emac:Autonegotiation complete
emac: linkup, 100Mbps full-duplex
Using emacdevice
TFTP fromserver 192.168.1.100; our IP address is 192.168.1.105
Filename'u-boot.bin'.
Load address:0x20100000
Loading: T##################
done
Bytestransferred = 250916 (3d424 hex)
U-Boot@zjh>go 20100000
## Startingapplication at 0x20100000 ...
U-Boot 2012.10(Aug 05 2013 - 15:05:34)
DRAM: 64 MiB
WARNING:Caches not enabled
Flash: 8 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any keyto stop autoboot: 0
U-Boot>
5 保存环境变量到NAND Flash和添加NAND 分区信息
5.1 配置环境变量保存到NAND
root@zjh:/home/work/u-boot-2012.10#vi include/configs/at91rm9200ek.h
//#define CONFIG_ENV_IS_IN_FLASH
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_OFFSET 0x0
#defineCONFIG_ENV_SIZE SZ_128K
5.2 配置支持NAND 分区信息
#define CONFIG_CMD_MTDPARTS
#define CONFIG_MTD_DEVICE
#define MTDIDS_DEFAULT "nand0=at91rm9200-0"
/* writeable partitions require their size and offset beerasesize aligned */
#define MTDPARTS_DEFAULT "mtdparts=at91rm9200-0:128k(params),"\
"4m(kernel),"\
"-(rootfs)"
5.3编译
5.4 运行测试
启动原有的u-boot,执行如下操作
U-Boot@zjh> tftpboot u-boot.bin
……
U-Boot2012.10 (Aug 05 2013 - 15:22:35)
DRAM: 64 MiB
WARNING:Caches not enabled
Flash: 8 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any keyto stop autoboot: 0
U-Boot>save
SavingEnvironment to NAND...
ErasingNand...
Erasing at0x0 -- 100% complete.
Writing toNand... done
U-Boot>mtd default
U-Boot>save
SavingEnvironment to NAND...
ErasingNand...
Erasing at0x0 -- 100% complete.
Writing toNand... done
U-Boot>mtd
device nand0<at91rm9200-0>, # parts = 3
#: name size offset mask_flags
0: params 0x00020000 0x00000000 0
1: kernel 0x00400000 0x00020000 0
2: rootfs 0x07be0000 0x00420000 0
activepartition: nand0,0 - (params) 0x00020000 @ 0x00000000
defaults:
mtdids : nand0=at91rm9200-0
mtdparts:mtdparts=at91rm9200-0:128k(params),4m(kernel),-(rootfs)
U-Boot>
6 支持烧写yaffs2文件系统
6.1配置
root@zjh:/home/work/u-boot-2012.10#vi include/configs/at91rm9200ek.h
#define CONFIG_CMD_NAND_YAFFS
6.2修改drivers/mtd/nand/nand_util.c
if (!need_skip && !(flags& WITH_DROP_FFS) && !(flags &WITH_YAFFS_OOB)) {
rval= nand_write (nand, offset, length, buffer);
if(rval == 0)
return0;
*length= 0;
printf("NAND write to offset %llx failed %d\n",
offset,rval);
returnrval;
}
……
if(flags & WITH_YAFFS_OOB) {
intpage, pages;
size_tpagesize = nand->writesize;
size_tpagesize_oob = pagesize + nand->oobsize;
structmtd_oob_ops ops;
ops.len= pagesize;
ops.ooblen= nand->oobsize;
ops.mode= MTD_OOB_RAW;
ops.ooboffs = 0;
……
6.3 编译、运行测试
7 打印CPU时钟信息并添加自己的log
7.1 配置
root@zjh:/home/work/u-boot-2012.10#vi include/configs/at91rm9200ek.h
#define CONFIG_DISPLAY_CPUINFO
7.2 修改arch/arm/lib/board.c
static int display_banner(void)
{
printf("\n\n%s\n\n",version_string);
printf("----成都思晗科技有限公司-----赵建辉\n\n");
debug("U-Bootcode: %08lX -> %08lX BSS: ->%08lX\n",
_TEXT_BASE,
_bss_start_ofs + _TEXT_BASE,_bss_end_ofs + _TEXT_BASE);
#ifdef CONFIG_MODEM_SUPPORT
debug("ModemSupport enabled\n");
#endif
#ifdef CONFIG_USE_IRQ
debug("IRQStack: %08lx\n", IRQ_STACK_START);
debug("FIQStack: %08lx\n", FIQ_STACK_START);
#endif
return(0);
}
7.3 修改arch/arm/cpu/arm920t/at91/cpu.c
#ifdefined(CONFIG_DISPLAY_CPUINFO)
intprint_cpuinfo(void)
{
char buf[32];
printf("CPU: %s\n",CONFIG_SYS_ATMEL_CPU_NAME);
printf("Crystal frequency: %8sMHz\n",
strmhz(buf,get_main_clk_rate()));
printf("CPU clock : %8s MHz\n",
strmhz(buf,get_cpu_clk_rate()));
printf("Master clock : %8s MHz\n",
strmhz(buf,get_mck_clk_rate()));
return 0;
}
#endif
7.4 编译
7.5运行测试
## Startingapplication at 0x20100000 ...
U-Boot2012.10 (Aug 05 2013 - 15:54:35)
----成都思晗科技有限公司-----赵建辉
CPU: AT91RM9200
Crystal frequency: 18.432 MHz
CPU clock : 179.712 MHz
Master clock : 59.904 MHz
DRAM: 64 MiB
WARNING:Caches not enabled
Flash: 8 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any keyto stop autoboot: 0
U-Boot>
7 精简u-boot
7.1注释掉include/config_cmd_default.h中一些不用的命令
//#define CONFIG_CMD_CONSOLE /* coninfo */
//#define CONFIG_CMD_EDITENV /* editenv */
//#define CONFIG_CMD_FPGA /* FPGA configuration Support */
//#define CONFIG_CMD_IMI /* iminfo */
//#define CONFIG_CMD_ITEST /* Integer (and string) test */
//#define CONFIG_CMD_LOADS /* loads */
//#define CONFIG_CMD_MISC /* Misc functions like sleep etc*/
//#define CONFIG_CMD_NFS /* NFS support */
//#define CONFIG_CMD_SETGETDCR /* DCR support on 4xx */
//#define CONFIG_CMD_SOURCE /* "source" command support */
//#define CONFIG_CMD_XIMG /* Load part of Multi Image */
7.2注释掉include/configs/at91rm9200ek.h中一些不用的命令
//#define CONFIG_CMD_DHCP
//#define CONFIG_CMD_FAT
//#define CONFIG_CMD_USB
//#undef CONFIG_CMD_FPGA
……
/*
* USB Config
*/
#ifdef CONFIG_CMD_USB
#defineCONFIG_USB_ATMEL 1
#defineCONFIG_USB_OHCI_NEW 1
#defineCONFIG_USB_KEYBOARD 1
#defineCONFIG_USB_STORAGE 1
#defineCONFIG_DOS_PARTITION 1
#defineCONFIG_SYS_USB_OHCI_CPU_INIT 1
#defineCONFIG_SYS_USB_OHCI_REGS_BASE ATMEL_USB_HOST_BASE
#defineCONFIG_SYS_USB_OHCI_SLOT_NAME "at91rm9200"
#defineCONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15
#endif
7.3编译
root@zjh:/home/work/u-boot-2012.10#make distclean && make at91rm9200ek_ram
查看u-boot.bin大小
root@zjh:/home/work/u-boot-2012.10#ll -h u-boot.bin
-rw-r--r-- 1root root 203K 2013-08-05 16:25 u-boot.bin
之前是260k
7.4运行测试
启动原有的u-boot,执行如下操作
U-Boot2012.10 (Aug 05 2013 - 16:24:26)
----成都思晗科技有限公司-----赵建辉
CPU:AT91RM9200
Crystalfrequency: 18.432 MHz
CPUclock : 179.712 MHz
Masterclock : 59.904 MHz
DRAM: 64 MiB
有点问题
8 支持NOR Flash启动
8.1配置:修改include/configs/at91rm9200ek.h
#ifdefCONFIG_RAMBOOT
#defineCONFIG_SKIP_LOWLEVEL_INIT
#defineCONFIG_SYS_TEXT_BASE 0x20100000
#else
#defineCONFIG_SYS_TEXT_BASE 0x00000000
#endif
8.2编译
root@zjh:/home/work/u-boot-2012.10#make distclean && make at91rm9200ek
8.3烧写u-boot.bin到NOR FLASH
U-Boot@zjh>tftp 21000000 u-boot.bin
emac:Starting autonegotiation...
emac:Autonegotiation complete
emac: linkup, 100Mbps full-duplex
Using emacdevice
TFTP fromserver 192.168.1.100; our IP address is 192.168.1.105
Filename'u-boot.bin'.
Load address:0x21000000
Loading: T###############
done
Bytestransferred = 207836 (32bdc hex)
U-Boot@zjh>protect off all
Un-ProtectFlash Bank # 1
.......................................................................................................................................done
U-Boot@zjh>erase 10000000 +3ffff
...........done
Erased 11sectors
U-Boot@zjh>cp.b 21000000 10000000 3ffff
Copy toFlash... done
U-Boot@zjh>reset
resetting ...
U-Boot2012.10 (Aug 05 2013 - 16:32:02)
----成都思晗科技有限公司-----赵建辉
CPU: AT91RM9200
Crystalfrequency: 18.430 MHz
CPUclock : 179.692 MHz
Masterclock : 59.897 MHz
DRAM: 64 MiB
WARNING:Caches not enabled
Flash: 8 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any keyto stop autoboot: 0
U-Boot>
u-boot-2012.10移植到AT91RM9200(包括NAND FLASH)的更多相关文章
- linux2.6.30.4内核移植(2)——Nand Flash驱动移植
内核源码:linux2.6.30.4 交叉编译工具:3.4.5 移植linux内核至:TQ2440 工作基础:http://www.cnblogs.com/nufangrensheng/p/36696 ...
- Davinci DM6446开发攻略-UBOOT-2009.03移植2 nand flash的烧写
很长一段时间没有更新博客了,是因为要推出新开发方案和做好客户服务工作,忙得不易乐乎.有关DAVINCI U-BOOT的移植,以前写过一篇u-boot-1.3.4(2008年的),其实和这个u-bo ...
- table-cell http://www.cnblogs.com/StormSpirit/archive/2012/10/24/2736453.html
http://www.cnblogs.com/StormSpirit/archive/2012/10/24/2736453.html
- ok6410 u-boot-2012.04.01移植六完善MLC NAND支持
继ok6410 u-boot-2012.04.01移植四.五后,开发板基本已支持MLC NAND,支持DM9000.但是通过NAND命令更新u-boot到NAND,还存在问题,需要根据u-boot的n ...
- DM6446开发攻略:UBOOT-2009.03移植及nand flash烧写
有关DAVINCI U-BOOT的移植,以前写过一篇u-boot-1.3.4(2008年的),其实和这个u-boot-2009.03差别不大,只不过这个u-boot-2009.03是从TI的网站上下载 ...
- u-boot移植总结(三)(转)S3C2440对Nand Flash操作和电路原理(基于K9F2G08U0A)
S3C2440对Nand Flash操作和电路原理(基于K9F2G08U0A) 转载自:http://www.cnblogs.com/idle_man/archive/2010/12/23/19153 ...
- s5pc100开发板Nand flash移植
相关软件下载地址:http://pan.baidu.com/s/16yo8Y fsc100开发板 交叉编译工具:arm-cortex_a8-linux-gnueabi-gcc 添加针对我们平台 ...
- [hi3521] nand flash 的 boot 启动模式的区别?
spi nand flash 的 boot 启动模式选择.0:1 线 boot:1:4 线 boot.请问,1线boot和4线boot有什么区别呢?该如何选择呢? 收藏 顶 踩 回复 使用 ...
- Spring Boot 的 10 个核心模块
学习 Spring Boot 必须得了解它的核心模块,和 Spring 框架一样,Spring Boot 也是一个庞大的项目,也是由许多核心子模块组成的. 你所需具备的基础 告诉你,Spring Bo ...
随机推荐
- javascript中Date使用总结(转)
//全局函数 Date //Date 类的静态方法 Date.parse Date.UTC //Date 对象的建立方法 new Date() new Date(毫秒数) new Date(标准时间格 ...
- 3中转换JSON数据的方式
一:前言 来公司一个星期,把最近做的东西梳理下,并把觉得有必要的知识点记载下,现在传数据很多都是用JSON来传数据,所以我就找了集中传json的方式,其实是有五种的,但是有一个我没有用过,太陌生了,上 ...
- [51nod] 1305 Pairwise Sum and Divide 数学
有这样一段程序,fun会对整数数组A进行求值,其中Floor表示向下取整: fun(A) sum = 0 for i = 1 to A.length for j = ...
- IntelliJ 创建main函数快捷
今天偶然发现了IntelliJ中 创建main函数的快捷键,依次还有for循环,System.out.println(); 在编写代码的时候直接输入psv就会看到一个psvm的提示,此时点击tab键一 ...
- NGINX: 配置跨域请求
说明: 内容全部来自 SegmentFault Developer Nginx 配置跨域请求 跨域请求失败, nginx 报错: 403 No 'Access-Control-Allow-Origin ...
- Windows autoKeras的下载与安装连接
autoKeras autoKeras GitHub:https://github.com/jhfjhfj1/autokeras 百度网盘下载地址:http://pandownload.com/ 大牛 ...
- bzoj1008 矩乘递推
2013-11-17 10:38 原题传送门http://www.lydsy.com/JudgeOnline/problem.php?id=1008 比较水的题,直接矩阵乘法+递推就OK了 w[i,0 ...
- Google Breakpad: 实战crash .
Google Breakpad: 实战crash . http://blog.csdn.net/zm_21/article/details/24795205 C/C++程序最棘手的时候就是一个字“挂” ...
- 【 Linux 】为lnmp架构添加memcached支持
一.首先搭建lnmp平台,这里不再演示.通过php页面来进行测试如下: [root@node1 ~]# vim /usr/local/nginx/html/info.php <?php $lin ...
- JavaScript的for循环语句
语法格式 for(初始化值;循环的条件;每一次循环的递增值){ // 循环的条件结果为true,则执行循环体中的代码 } 示例(打印出1-10之间的整数): for(var a=1;a<=10; ...