【本章总结】
个人觉得这章内容过于杂乱,只需求记住假如nand中4096的程序想要被仿制出来履行,就把这个代码写进去,赤色部分是真实的代码,能够仿制曩昔,直接运用,其他就不做了解了。听了一个小时,这个教师讲的也挺乱的,也没有人能记住这么多东西吧。。。
【head.S init.c main.c nand.c Makefile】
代码详解,这儿先把一部分代码存放在NAND Flash 地址4096之后,当程序发动后经过NAND Flash操控器将他们读出来、履行。
留意:曾经的代码都小于4096,开发板发动后他们被主动仿制进“Steppingstone”;
【nand.lds】
SECTIONS {
}
关于这儿,我是这样了解的 。head.o init.o nand.o都放在Nand flash0地址处,0x0000 0000是他的链接地址,也便是放在0x0000 0000处运转;mian.o存放在Nand flash 4096地址处,0x3000 0000是他的链接地址,也便是放在0x3000 0000处运转
(或许也便是前一阵子看到的链接地址和加载地址的差异)
当开发板发动时,前4k的代码被考进SRAM,所以咱们需求在SRAM内完结初始化和跳转
【head.s】
SECTIONS {
} @******************************************************************************
@ File:head.s
@ 功用:设置SDRAM,将程序仿制到SDRAM,然后跳到SDRAM持续履行
@******************************************************************************
.text
.global _start
_start:
halt_loop:
*关于这一串代码,许多都是前面学过的常识,这儿咱们只重视装备Nand的赤色代码
bl nand_init
*方针地址,源地址,方针长度
这儿咱们能够跳转到nand_read中能够看一下
void nand_read(unsigned char *buf, unsigned long start_addr, int size)
{
#ifdef LARGER_NAND_PAGE
#else
#endif
#ifdef LARGER_NAND_PAGE
#endif
#ifdef LARGER_NAND_PAGE
#else
#endif
【nand.c】
#define LARGER_NAND_PAGE
#define GSTATUS1 (*(volatile unsigned int *)0x560000B0)
#define BUSY 1
#define NAND_SECTOR_SIZE 512
#define NAND_BLOCK_MASK (NAND_SECTOR_SIZE – 1)
#define NAND_SECTOR_SIZE_LP 2048
#define NAND_BLOCK_MASK_LP (NAND_SECTOR_SIZE_LP – 1)
typedef unsigned int S3C24X0_REG32;
typedef struct {
} S3C2410_NAND;
typedef struct {
} S3C2440_NAND;
typedef struct {
}t_nand_chip;
static S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
static S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
static t_nand_chip nand_chip;
void nand_init(void);
void nand_read(unsigned char *buf, unsigned long start_addr, int size);
static void nand_reset(void);
static void wait_idle(void);
static void nand_select_chip(void);
static void nand_deselect_chip(void);
static void write_cmd(int cmd);
static void write_addr(unsigned int addr);
static unsigned char read_data(void);
static void s3c2410_nand_reset(void);
static void s3c2410_wait_idle(void);
static void s3c2410_nand_select_chip(void);
static void s3c2410_nand_deselect_chip(void);
static void s3c2410_write_cmd(int cmd);
static void s3c2410_write_addr(unsigned int addr);
static unsigned char s3c2410_read_data();
static void s3c2440_nand_reset(void);
static void s3c2440_wait_idle(void);
static void s3c2440_nand_select_chip(void);
static void s3c2440_nand_deselect_chip(void);
static void s3c2440_write_cmd(int cmd);
static void s3c2440_write_addr(unsigned int addr);
static unsigned char s3c2440_read_data(void);
static void s3c2410_nand_reset(void)
{
}
static void s3c2410_wait_idle(void)
{
}
static void s3c2410_nand_select_chip(void)
{
}
static void s3c2410_nand_deselect_chip(void)
{
}
static void s3c2410_write_cmd(int cmd)
{
}
static void s3c2410_write_addr(unsigned int addr)
{
}
static unsigned char s3c2410_read_data(void)
{
}
static void s3c2440_nand_reset(void)
{
}
static void s3c2440_wait_idle(void)
{
}
static void s3c2440_nand_select_chip(void)
{
}
static void s3c2440_nand_deselect_chip(void)
{
}
static void s3c2440_write_cmd(int cmd)
{
}
static void s3c2440_write_addr(unsigned int addr)
{
}
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/ceping/260629.html