开发环境搭建

Version 1.0


1. 硬件连接

电源: DC 12V,

调试串口: TTL电平,特率115200

图1-1 SSC016主板示意图


2. 准备编译环境

通常我们会以交叉编译的方式进行开发和调试,即“宿主机+目标机”的形式。而宿主机和目标机的连接我们一般采用串口连接或网络连接,如下图所示:

图2-1 交叉编译连接方式

注:我们提供的debug tool作用为读寄存器和烧写Mboot。


2.1. 安装Linux服务器

建议使用Ubuntu 16.04。


2.2. 安装交叉编译工具

boot、kernel、project统一使用一个交叉编译工具。

Glibc:arm-linux-gnueabihf-sigmastar-9.1.0-

Uclibc:arm-sigmastar-linux-uclibcgnueabihf-9.1.0-


3. 编译

本系列支持nor flash和spi nand flash两种启动方式,因此在SDK中编译有所区分,通过不同的配置文件来实现,SDK中包含了最新的boot和kernel的image,脚本打包成可烧录image。


3.1. 编译boot

910/920 config共用,以glibc为例。

  • SPI-NOR package

    # declare -x ARCH="arm"
    # declare -x CROSS_COMPILE="arm-linux-gnueabihf-sigmastar-9.1.0-"
    # cd boot
    # make mercury6_defconfig; 
    # make clean;
    # make
    
  • SPI- NAND package

    # declare -x ARCH="arm"
    # declare -x CROSS_COMPILE="arm-linux-gnueabihf-sigmastar-9.1.0-"
    # cd boot
    # make mercury6_spinand_defconfig; 
    # make clean;
    # make
    
  • Get image

    # cp u-boot.xz.img.bin ${ your_release_path }   // 选择spi-nor时
    # cp u-boot_spinand.xz.img.bin ${ your_release_path }// 选择spi-spinand时
    

3.2. 编译kernel

  • SPI-NOR Kernel (ASIC)

    CHIP Kernel make config DTS
    910Q mercury6_ssc017_s01a_defconfig mercury6-ssc017-s01a-padmux.dtsi
    920Q mercury6_ssc016_s01a_demo_defconfig mercury6-ssc016-s01a-demo-padmux.dtsi
  • SPI-NAND Kernel (ASIC)

    CHIP Kernel make config DTS
    910Q mercury6_ssc017_s01a_spinand_defconfig mercury6-ssc017-s01a-padmux.dtsi
    920Q mercury6_ssc016_s01a_demo_spinand_defconfig mercury6-ssc016-s01a-demo-padmux.dtsi

    注:请参考表格和芯片版本做对应的编译。

    # declare -x ARCH="arm"
    # declare -x CROSS_COMPILE="$compiler" 
    (exp: glibc “arm-linux-gnueabihf-”)
    # cd kernel
    # make xxx_kernel_make_config
    (exp: make mercury6_ssc017_s01a_defconfig)
    # make clean;
    # make -j8
    
  • Get image

    # cp arch/arm/boot/uImage.xz ${ your_release_path }
    

3.3. 编译SDK(ALKAID)

  • SPI-NOR flash package

    CHIP Glibc Uclibc
    910Q xvr_m6_nor.glibc-9.1.0-squashfs.017a.256.qfn128_defconfig xvr_m6_nor.uclibc-9.1.0-squashfs.017a.256.qfn128_defconfig
    920Q xvr_m6_nor.glibc-9.1.0-squashfs.016a.512x512.bga2.demo_defconfig xvr_m6_nor.uclibc-9.1.0-squashfs.016a.512x512.bga2.demo_defconfig
  • SPI-NAND flash package

    CHIP Glibc Uclibc
    910Q xvr_m6_spinand.glibc-9.1.0-squashfs.017a.256.qfn128_defconfig xvr_m6_spinand.uclibc-9.1.0-squashfs.017a.256.qfn128_defconfig
    920Q xvr_m6_spinand.glibc-9.1.0-squashfs.016a.512x512.bga2.demo_defconfig xvr_m6_spinand.uclibc-9.1.0-squashfs.016a.512x512.bga2.demo_defconfig

    注:请参考表格和芯片版本做对应的编译。

    # cd $/{Alkaid}/project
    # . /setup_config.sh xxx_alkaid_build_config
    (exp: ./setup_config.sh xvr_m6_spinand.glibc-9.1.0-squashfs.016a.512x512.bga2.demo_defconfig)
    # make image
    
  • Get image

    # cd ${Alkaid}/project/image/output/images
    

4. 烧写


4.1. 用uboot烧录程序

  • Run tftp (FTP server) on PC

    1. 使用tftp工具指向image path:SDK\project\image\output\images\,并选择正确的网卡。

    2. 连接板子的网口到PC端,连接debug串口工具到PC端,并检查连接的正确性。

  • Run tftp (FTP Client) on EVB

    板子开机,长按回车,进入bootloader command line. sigmastar 的boot loader。

    • 首次烧录请设置IP:(除非ip设置变更或者更换flash)

      # set -f gatewayip 192.168.1.1
      # set -f ipaddr 192.168.1.127           (设定FTP Client (EVB板子)使用的IP)
      # set -f netmask 255.255.255.0
      # set -f serverip 192.168.1.100         (设定FTP server (PC) 的IP)
      # saveenv
      # estart                                (第一次设定ip后要先使网络通)
      

      注:

      1. 为了保证烧录顺利,请保证PC和开发板处于同一网段。

      2. 请采用静态方式固定分配ip。防止烧录时ip地址跳变。

      3. 您也可以使用独立网卡使PC端直连开发板,固定该网卡的内网ip地址,并按上述方法设定开发板。

    • 在UBOOT console下执行以下指令即可自动透过ethernet烧录。

      # estar (OR: estar auto_update.txt)
      

4.2. 用ISP Tool烧录uboot

本方式适用于空机烧录,或者uboot已经损坏导致无法通过uboot升级的场合。

4.2.1. SPI-NOR-Flash

  • 默认分区

    No range size
    IPL 0x00000000-0x00010000 64KB
    IPL_CUST 0x00010000-0x00020000 64KB
    MXPT 0x00020000-0x00030000 64KB
    UBOOT 0x00030000-0x0004F000 124KB
    UBOOT_ENV 0x0004F000-0x00050000 4KB
    BOOT 0x00000000-0x00050000 320KB
    KERNEL 0x00050000-0x00250000 2048KB
    ROOTFS 0x00250000-0x00650000 4096KB
    NVRSERVICE 0x00650000-0x00950000 3072KB
    CUSTOMER 0x00950000-0x01000000 6848KB
  • ISP工具烧录

    offset Binary放置目录
    IPL.bin 0x00000 project\image\output\images\boot\IPL.bin
    IPL_CUST.bin 0x10000 project\image\output\images\boot\IPL_CUST.bin
    MXP_SF.bin 0x20000 project\image\output\images\boot\MXP_SF.bin
    u-boot.xz.img.bin 0x30000 project\image\output\images\boot\u-boot.xz.img.bin
  • 烧录步骤

    1. 执行ISP tool。并且关闭UART terminal,否则无法正常Connect

    2. 选择SPI tab,并且选择类型为SPINOR

    3. 加载烧录文件IPL.bin,并点击Connect

    4. 设置烧录偏移地址0x0000,并点击Run

      注:Erase Device下面要勾选file area;如果选All Chip,会把整片flash数据擦除。

      图4-4

    5. 加载 image IPL_CUST.bin,设置Base shift at 0x10000,点击Run

      注:可能随着版本变化,Base shift的地址以ISP工具烧录表中数据为准。

    6. 加载image MXP_SF.bin, 设置Base shift at 0x20000,点击Run

    7. 加载image u-boot.xz.img.bin , 设置Base shift at 0x30000,点击Run

    8. 重启EVB板子,关闭工具。

4.2.2. SPI-NAND Flash

  • 默认分区

    No range size
    CIS 0x00000000-0x0020000 128KB
    IPL0 0x00140000-0x00200000 768KB
    IPL_CUST0 0x00200000-0x00260000 384KB
    IPL_CUST1 0x00260000-0x002c0000 384KB
    UBOOT0 0x002c0000-0x00320000 384KB
    UBOOT1 0x00320000-0x00380000 384KB
    ENV 0x00380000-0x003c0000 256KB
    KERNEL 0x003c0000-0x008c0000 5120KB
    RECOVERY 0x008c0000-0x00dc0000 5120KB
    rootfs 0x00dc0000-0x013c0000 6144KB
    UBI 0x013c0000-0x008000000 110848KB
  • ISP(或flash)工具烧录

    • Images
    Offset Image所在目录
    GCIS.bin 0x000000 project\image\output\images\boot\GCIS.bin
    IPL.bin 0x140000 project\image\output\images\boot\IPL.bin
    IPL_CUST.bin 0x200000 project\image\output\images\boot\IPL_CUST.bin
    u-boot_spinand.xz.img.bin 0x2C0000 project\image\output\images\boot\u-boot_spinand.xz.img.bin
    • 烧录步骤

      1. 执行ISP tool。并且关闭UART terminal,否则可能无法正常Connect

      2. 选择SPI tab,并且选择类型为SPINAND

      3. 加载烧录文件GCIS.bin,并点击Connect,成功会出现Connected,并且工具上会显示出当前的flash型号。

      4. 设置烧录偏移地址0x0000,点击Run;烧录成功出现PASS,否则为FAIL

        注:勾选erase all chip就代表把整片擦除,可根据需要选择是否勾上。

      5. 加载 image IPL.bin, 设置Base shift at 0x140000,点击Run

      6. 加载image IPL_CUST.bin, 设置Base shift at 0x200000,点击Run

      7. 加载image u-boot_spinand.xz.img.bin , 设置Base shift at 0x2C0000,点击Run

      8. 重启EVB板子,关闭工具。