RT1052 BootLoader总结

RT1052 BootLoader总结‍

 

 

  1. 概述

    Bootloader涉及到的RT1052单片机资源有:Cache,ram,外部SDRAM,ARM7汇编指令,外部dataFlash.

    升级功能涉及到的其他功能有:服务器存贮和传输升级Bin文件;上位机接收和发送BiN文件;判断升级是否成功和提示。​

  2. 流程图

RT1052 BootLoader总结_第1张图片

RT1052 BootLoader总结_第2张图片

 

 

  1. app程序与Bootloader程序不同的地方总结如下

    3.1   xxx.s启动文件增加了如下区域

    AREA    |.ram_vtor_table|, DATA, READONLY

 

 IMPORT  |Image$$ARM_LIB_STACK$$ZI$$Limit|

               R_Vectors   DCD  |Image$$ARM_LIB_STACK$$ZI$$Limit| ; Top of Stack

 

 DCD     Reset_Handler  ; Reset Handler

                DCD     NMI_Handler                         ;NMI Handler

 

《MIMXRT1052xxxxx_flexspi_nor_sdram.scf》

 

 

#define m_itcm_vectors_start     0x00000000

#define m_itcm_vectors_size      0x00000400

 

#define m_itcm_start                   0x00000400

#define m_itcm_size                    0x0001FC00

 

 

 RW_vectors_data m_itcm_vectors_start m_itcm_vectors_size { ; RW data

startup_MIMXRT1052.o (.ram_vtor_table)

  }

 

ARM_LIB_HEAP +0 EMPTY Heap_Size {    ; Heap region growing up

  }

  ARM_LIB_STACK m_data_start+m_data_size EMPTY -Stack_Size { ; Stack region growing down

  }

 

3.2  evkbimxrt1050_flexspi_nor.ini更改SP,PC

  SP = _RDWORD(0x60008000);          // Setup Stack Pointer

  PC = _RDWORD(0x60008004);          // Setup Program Counter

_WDWORD(0xE000ED08, 0x60008000);   // Setup Vector Table Offset Register

3.3 ***.scf分散加载文件更改

#define m_interrupts_start             0x60008000

#define m_interrupts_size              0x00000400

3.4 target-->user,生成Bin,命令。

RUN1:fromelf.exe  --bincombined --bincombined_base=0x60008000 --output  "[email protected]" "[email protected]"

RUN2:fromelf.exe  --m32  --output  "[email protected]" "#L"

3.5  Linker:设置改变:

  1. --remove

  2. --keep=*(.boot_hdr.ivt)

  3. --keep=*(.boot_hdr.boot_data)

  4. --keep=*(.boot_hdr.dcd_data)

  1. --keep=*(.boot_hdr.conf)

  2. --keep=*(NonCacheable)

  3. --keep=*(m_usb_dma_init_data)

    --predefine="-DXIP_BOOT_HEADER_ENABLE=1"

改为:

--remove

--keep=*(.ram_vtor_table)

--predefine="-DXIP_BOOT_HEADER_ENABLE=1"

3.6应用程序初始化里面的SDRAM的初始化一定要去掉!!

//    /* Set SEMC_PODF. */

//    CLOCK_SetDiv(kCLOCK_SemcDiv, 7);

//    /* Set Semc alt clock source. */

//    CLOCK_SetMux(kCLOCK_SemcAltMux, 0);

//    /* Set Semc clock source. */

//    CLOCK_SetMux(kCLOCK_SemcMux, 0);

 

3.8 Main函数里面:增加

 

 __disable_irq();  

 

SCB->VTOR = 0x00000000;  //Enable ITCM Vectors Table

__enable_irq();

4.0 keil报错处理:"flexspi_nor_debug\CGAaxf.out": Error: Q0471E: Base address 0x60008000 is above start address 0x60000000 of load region #0 

处理办法: 删掉输出文件夹里面的*.bin文件。

 

4.1需要深入研究的地方有:

  __ISB();

    __DSB();

    /* Enable I cache and D cache */

    SCB_DisableDCache();

    SCB_DisableICache();

vControlSwitch();

已经确认,vControlSwitch();之前,必须关闭cache。创造一个干净的环境。

 

Bootloader打印信息如下:

Start xmodem1k client.

 

App SP:0x81d00000.

App PC:0x6000863d.

mcu ready to recv data...

CCCCCCCCCCCCCCCCCCCC

 Wait timeout,Jump App.

 

------------------------------------------

App SP:0x81d00000.

App PC:0x60008415.

mcu ready to recv data...

 

Wait timeout,Jump App.

------------------------------------------

 20181217 TWO int main2(void) : 0x6000a6b5.

 PC:0x6000a6b5

技术咨询请加微信:18124528727

你可能感兴趣的:(RT1052 BootLoader总结)