This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

基于EMIF的nor flash启动mode的自己的想法,看看是否正确



1 mode 开关设置emif16

2 将.bin文件写入nor flash内,同时是否需要对数据的大小端转换??????????????????????

直接复位程序是否在flash内执行?????????????????????????????

如果在ram内执行在加一段.asm文件主要就是数据搬移,和要执行的程序一起编译,生成bin文件后,下载程序后是否能boot成功

现在在ccs内读取bin文件,一直读的数据是错的,不知道是为什么.后将bin文件直接导入内存,然后才能对bin的数据进行写入flash内

  • 你没有说芯片的型号,我默认你是在6678下操作,

    1. 大小端转换要做,因为bootloader只认小端;

    2. 复位当然是在flash里执行;

    3. 二次boot可以做,一般是第一段程序将第二段程序搬移到指定位置再直接跳转到指定位置上;比如下面一段代码

    void
    start_boot
    (
    void
    )
    {
    void (*exit)();
    uint32_t entry_addr;

    while(1)
    {
    entry_addr = DEVICE_REG32_R(BOOT_MAGIC_ADDR(0));
    if (entry_addr != 0)
    {
    /* jump to the exit point, which will be the entry point for the full IBL */
    exit = (void (*)())entry_addr;
    (*exit)();
    }
    platform_delay(1);
    }
    }

    最后一个问题,bin文件直接从memory窗口load

  • 1 现在用的芯片我为6678,外接norflash,通过emif16启动

    2 bin.文件内的第一个字节是否写入flash内的第一个地址上???????????依次写入.和ccs中小端操作有没有关系??????????

    3 emif16启动的模式开关设置000,不知道对不对???????

    4 现在将程序写入flash内并没有正确执行.在仿真下可以串口一直向外发数.

    boot.asm

    .title  "Flash bootup utility"
            .option D,T
            .length 102
            .width  140
        

    BOOT_SIZE     .equ    0x40000       ;bootup code size in byte
    FLASH_START   .equ    0x70000400  ;flash start address
    BOOT_START    .equ    0x10800400  ;L2 sram start address

    CODE_SIZE     .equ    0x30000      ;application code size in byte
    CODE_START    .equ    0x400       ;application code start address

     .sect ".boot_sect"
     .global _boot

     .ref _c_int00
     
    _boot:
                MVKL  BOOT_START,A4 ;ram start address ->A4
       MVKH  BOOT_START,A4

            MVKL  FLASH_START,B4 ;flash start address ->B4
               MVKH  FLASH_START,B4

          MVKL  BOOT_SIZE,A0  ;0xc000,B0 ;B6 = BOOT_SIZE -1024
                MVKH  BOOT_SIZE,A0  ;0xc000,B0

    _wait_loop: LDH   *B4++[1],B5
                SUB   A0,1,A0
                NOP   4
                STH   B5,*A4++[1]
          [A0]  B     _wait_loop
                NOP   5
           
                MVKL .S2 _c_int00, B0
                MVKH .S2 _c_int00, B0
                B    .S2 B0
                nop   5
    ;
    ; end of the bootup routine

     

    不知道是否正确

    还有就是

    link.cmd文件:

    -c
    -heap  0x41000
    -stack 0xa000

    /* Memory Map 1 - the default */
    MEMORY
    {
        L1PSRAM (RWX)  : org = 0x0E00000, len = 0x7FFF
        L1DSRAM (RWX)  : org = 0x0F00000, len = 0x7FFF
        ISRAM          : org = 0x10800000, len = 0x400
        L2SRAM (RWX)   : org = 0x10800400, len = 0x70000
        MSMCSRAM (RWX) : org = 0xc0000000, len = 0x200000
    }
    SECTIONS
    {
        .csl_vect         >       L2SRAM
        .boot_sect        >       ISRAM
        .text             >       L2SRAM
        GROUP (NEAR_DP)
        {
        .neardata
        .rodata
        .bss
        } load > L2SRAM
        .stack      >       L2SRAM
        .cinit      >       L2SRAM
        .cio        >       L2SRAM
        .const      >       L2SRAM
        .data       >       L2SRAM
        .switch     >       L2SRAM
        .sysmem     >       L2SRAM
        .far        >       L2SRAM
        .testMem    >       L2SRAM
        .fardata    >       L2SRAM
        platform_lib >   L2SRAM
    }

    不知道是否正确

    hex6x的cmd文件

    -a
    -memwidth 16
    -boot
    -bootorg 0x70000400
    -bootsection .bootlaod 0x70000000
    ROMS
    {
     ROM1:  org = 0x70000000, length = 0x100000,romwidth = 16
     files = { urat_test.btbl }
    }

    norflash挂在ce2上 0x70000000递址上


     

  • Device Configuration 这个属性用设置吗

    比如 emif16  启动模式为000

    那么 Device Configuration的属性用设置吗 7 设置1 ,4 设置1

    No Boot/ EMIF16 Configuration Fields
    No Boot / EMIF16 Configuration Field Descriptions
    Bit Field Description
    9-8 Reserved Reserved
    7 Wait Enable Extended Wait mode for EMIF16.
              0 = Wait enable disabled (EMIF16 sub mode)
              1 = Wait enable enabled (EMIF16 sub mode)
    6 Reserved Reserved
    5-4 Sub-Mode Sub mode selection.
                  0 = No boot
                  1 = EMIF16 boot
    2 -3 = Reserved
    3 Reserved Reserved