Embedded hi3518c Bare Board uboot Burn write, kernel burn write, fs Burn write Summary

Source: Internet
Author: User
Tags jlink

1, in Uboot I can add their own commands, add the method is to find a uboot command, and then imitate to add their own command code and implement the function can be

2, remember in the use of printf debugging, when encountering pointers or strings, it is best to use "%x", thought I do not know whether the pointer or string contains invisible characters, if there is not visible characters can cause errors, and the error is not good to find

3, for the environment variables in the uboot, in fact, is placed in the uboot inside, that is, the environment variables occupy the space of uboot, if you do not need to change the value of the environment variable in real time then you can not use env this partition, but if you need to modify the environment variables, First, you need to know the start address and size of the saveenv to prevent Env from being saved to overwrite other useful data in Flash. Run saveenv to see the start address and env size

4. Sometimes the first reset can be started when the kernel is finished, but when power is turned off and then on again, errors may occur, such as:

Resetting CPU ...

It is possible that the kernel is incomplete, indicating that the previous operation may have overwritten some of the contents of the kernel.

5. Special attention should be paid to the Flash (SPI) serial Flash Partitioning:

1): Uboot may have obvious code partition list for flash partition can be modified directly

2): When there is no such obvious code in the Uboot, it may be passed in the Uboot env.

setenv Bootargs mem=64m console=ttyama0,115200 root=/dev/mtdblock4 rootfstype=jffs2 mtdparts=hi_sfc:256k (boot) RO, 128k (env), 128k (config), 3072k (kernel), 11264k (ROOTFS)

Specifically which way you can go to the uboot source to find the function of the entry point of the input parameters

6, the specific information of the partition needs to be based on the size of the uboot (the smallest size of each partition is a sector, including kernel and ROOTFS)

0x000000000000-0x000000040000: "Boot"
0x000000040000-0x000000060000: "Env"
0x000000060000-0x000000080000: "conf"
0x000000080000-0x000000380000: "Kernel"
0x000000380000-0x000000e80000: "Rootfs"

7, uboot to flash partition has a maximum limit is generally (32)

The CPU must be initialized before using Jlink to burn, then go into normal mode and then initialize the memory before burning

HI3518C Initialization command:


Setmem 0x20030000 0x11000000 32
Setmem 0x20030004 0x0068306e 32
Setmem 0x20030008 0x12000000 32
Setmem 0x2003000c 0x007c2063 32
Setmem 0x20030010 0x19000000 32
Setmem 0x20030014 0x00682064 32
Setmem 0x20030020 0x1b000000 32
Setmem 0x20030024 0x007c40e1 32
Setmem 0x20030028 0x00000010 32
Setmem 0x2011001c 0x80000600 32

Setmem 0x20030028 0x00000410 32
Setmem 0x2011001c 0x80000600 32


Setmem 0x20050014 0x0fff8000 32
Setmem 0x2011001c 0x80000600 32


Setmem 0x20050000 0x00000214 32
Setmem 0x2011001c 0x80000600 32

Setmem 0x2011001c 0x80000600 32
Setmem 0x20110020 0x00000785 32
Setmem 0x20110058 0x3240a000 32
Setmem 0x20110010 0x00000001 32
Setmem 0x2011002c 0x00000122 32
Setmem 0x20110040 0x80000000 32
Setmem 0x20110050 0x62330a08 32
Setmem 0x20110054 0xff626720 32
Setmem 0x2011005c 0XFFCFF5F2 32
Setmem 0X201100AC 0x03000001 32
Setmem 0x2011001c 0x80000600 32

Setmem 0x201100f4 0x00000001 32
Setmem 0x20110004 0x00000000 32
Setmem 0x2011001c 0x80000600 32

Setmem 0x20120404 0x80000000 32
Setmem 0x2011001c 0x80000600 32


Setmem 0x20120408 0x01842200 32
Setmem 0x20120418 0x00220055 32
Setmem 0x2012041c 0x048b0d41 32
Setmem 0x20120420 0x03233881 32
Setmem 0x2012042c 0xf200001e 32
Setmem 0x20120434 0x288f6693 32
Setmem 0x20120438 0x0040009b 32
Setmem 0x2012043c 0x1001aa00 32
Setmem 0x20120584 0x0000006d 32
Setmem 0x20120440 0x00001730 32
Setmem 0x20120444 0x00000006 32
Setmem 0x20120448 0x00000008 32
Setmem 0x2011001c 0x80000600 32


Setmem 0x201205c0 0x00000e81 32
Setmem 0x20120600 0x00000e81 32
Setmem 0x2011001c 0x80000600 32

Setmem 0x20120404 0X000000FF 32
Setmem 0x2011001c 0x80000600 32


Setmem 0x20110058 0x3240a062 32
Setmem 0x20120408 0x01842200 32

Note: The previous line of each blank line Setmem 0x2011001c 0x80000600 32 is to implement the wait operation

1, on the bare board to use Jlink to burn write uboot need to know uboot in memory of the running address is the code snippet of the entrance, you can go to Uboot source to find Uboot.map to find the text entrance.

2, then in the string loadb 0x82000000 (also can be found in the uboot definition), and then SF write to Flash but need to erase after burning write

3, sometimes after burning write Uboot saveenv after reset can not find the kernel, and prompted wrong format image This may be the core of the head is not, because the saveenv of the time to overwrite the kernel of the file, so you need to go to uboot found similar to the following code:


#define CFG_ENV_ADDR 0x80000

#define Cfg_env_size 0x2000

Then recalculate the flash partition

4, the Flash partition 3.0 kernel and Uboot 2006 are used to divide the environment variables, similar code is as follows:

Setenv Bootargs ' mem=64m console=ttyama0,115200 root=/dev/mtdblock4 rootfstype=jffs2 mtdparts=hi_sfc:256k (boot) RO, 128k (env), 128k (conf), 2944k (OS), 12800k (Rootfs) '
Note: CPU and RAM initialization with Axd after speed 1000

SF probe 0;mw.b 0x82000000 FF 0x80000;

Burn uboot:
LOADB 0x82000000
SF probe 0;SF Erase 0x0 0x80000;sf write 0x82000000 0x0 0x80000

Burn kernel:
SF probe 0;mw.b 82000000 ff 300000;loadb 0x82000000;sf erase c0000 300000;sf write 82000000 c0000 300000
mw.b represents MW in bytes: writes to content in RAM, MW 32000000 FF 10000 (sets the 0x10000 byte of memory 0x32000000 to 0xFF)


Burn File System:
SF probe 0; mw.b 82000000 ff C80000; loadb 0x82000000;sf erase 3c0000 C80000; SF write 82000000 3c0000 C80000


Official uboot_env:

bootargs=mem=64m console=ttyama0,115200
Bootcmd=bootm 0x82000000
Bootdelay=1
baudrate=115200
ethaddr=00:00:23:34:45:66
ipaddr=192.168.1.10
serverip=192.168.1.2
netmask=255.255.255.0
Bootfile= "Uimage"
Stdin=serial
Stdout=serial
Stderr=serial
Verify=n
Ver=u-boot 2010.06 (Dec 12 2012-13:16:58)

Environment size:294/262140 bytes

hi3518_qy;

SF probe 0;mw.b 0x82000000 FF 0x80000;

Burn uboot:
LOADB 0x82000000
SF probe 0;SF Erase 0x0 0x80000;sf write 0x82000000 0x0 0x80000

Burn kernel:
SF probe 0;mw.b 82000000 ff 300000;loadb 0x82000000;sf erase c0000 300000;sf write 82000000 c0000 300000
mw.b represents MW in bytes: writes to content in RAM, MW 32000000 FF 10000 (sets the 0x10000 byte of memory 0x32000000 to 0xFF)

Burn File System:
SF probe 0; mw.b 82000000 ff C80000; loadb 0x82000000;sf erase 3c0000 C80000; SF write 82000000 3c0000 C80000

Setenv Bootargs ' mem=64m console=ttyama0,115200 root=/dev/mtdblock4 rootfstype=jffs2 mtdparts=hi_sfc:256k (boot) RO, 128k (env), 128k (conf), 2944k (OS), 12800k (Rootfs) '


Kernel:
Setenv bootcmd SF probe 0\;SF read 0x82000000 0xc0000 0x300000\;bootm 0x82000000

Remaining:
256k not used

Embedded hi3518c Bare Board uboot Burn write, kernel burn write, fs Burn write Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.