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.

[参考译文] MSPM0G3107:

Guru**** 2394305 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1501280/mspm0g3107

器件型号:MSPM0G3107

工具/软件:

如何将 main()写入 bootloder,我需要自定义引导加载程序

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Saras、

    我无法理解您的描述。 您能提供更多详细信息、谢谢。

    B.R.

    Sal

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我正在使用没有引导加载程序的 FOTA。 我在0x0000000编写一个 Application1代码。 此应用程序1通过 UART 接收数据并在0x00002000 (这是我的应用程序2)写入闪存。 现在、我要从 app1跳转到 app2。 需要执行哪些步骤。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    移动数据
      闪存中      (Rx) :origin = 0x00000000、length = 0x00020000
      SRAM       (rwx):origin = 0x20200000、长度= 0x00008000
      BCR_CONFIG   (R) :origin = 0x41C00000、length = 0x000000FF
      BSL_CONFIG   (R) :origin = 0x41C00100、length = 0x00000080
    }

    很重要
      .intvecs: > 0x00000000
      .text :palign(8){}> flash
      .const : palign(8){}> flash
      .cinit :palign (8){}> FLASH
      .pinit :palign(8){}> flash
      .rodata : palign(8){}> flash
      .arm.exidx  :palign(8){}> flash
      .init_array :palign(8){}> flash
      .binit    : palign(8){}> flash
      .TI.ramfunc :load = FLASH、palign (8)、run=SRAM、table (BINIT)

      .vtable : > sram
      .args : > sram
      .data : > sram
      .bss  : > sram
      .sysmem : > sram
      .stack : > SRAM (high)

      .bCRConfig :{}> BCR_config
      .BSLSConfig :{}> BSL_config
    }
     
    这是我的命令
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    为了进行跳转、我使用了以下代码


      uint32_t newAppStackPointer =*((uint32_t *)(MAIN_BASE_ADDRESS));
      uint32_t newAppResetHandler =*((uint32_t *)(MAIN_BASE_ADDRESS + 4));

      NVIC_DisableIRQ (UART0_INT_IRQn);

      //禁用中断
      __disable_irq()

      //将主栈指针(MSP)设置为新应用程序的值
      __set_msp (newAppStackPointer);

      //可选:取消外设初始化、禁用 SysTick、禁用中断等

      //跳转到新应用程序的重置处理程序
      AppEntryFunction appEntry =(AppEntryFunction)newAppResetHandler;
      appEntry ();
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Sarawati:

    请参阅我们 SDK 示例代码中的建议:

    static void start_app(uint32_t *vector_table)
    {
        /* The following code resets the SP to the value specified in the
         * provided vector table, and then the Reset Handler is invoked.
         *
         * Per ARM Cortex specification:
         *
         *           ARM Cortex VTOR
         *
         *
         *   Offset             Vector
         *
         * 0x00000000  ++++++++++++++++++++++++++
         *             |    Initial SP value    |
         * 0x00000004  ++++++++++++++++++++++++++
         *             |         Reset          |
         * 0x00000008  ++++++++++++++++++++++++++
         *             |          NMI           |
         *             ++++++++++++++++++++++++++
         *             |           .            |
         *             |           .            |
         *             |           .            |
         *
         * */
    
        /* Reset the SP with the value stored at vector_table[0] */
        __asm volatile(
            "LDR R3,[%[vectab],#0x0] \n"
            "MOV SP, R3       \n" ::[vectab] "r"(vector_table));
    
        /* Set the Reset Vector to the new vector table (Will be reset to 0x000) */
        SCB->VTOR = (uint32_t) vector_table;
    
        /* Jump to the Reset Handler address at vector_table[1] */
    
        ((void (*)(void))(*(vector_table + 1)))();
    }

    链接: https://dev.ti.com/tirex/explore/node?node=A__ACTHfq7Nnk5GvMBsiZuiIw__MSPM0-SDK__a3PaaoK__LATEST&placeholder=true 

    B.R.

    Sal