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.
您好!
我们想知道如何在通过看门狗计时器完成热复位后再次从应用切换回 SBL (次级引导加载程序)。 为方便您参考、我们将使用我们的 SBL 所在的此位置#define SBL_vector ((uint32_t) 0xE000ED08)。 因此我们的假设是、一旦热复位完成、它将转到这个指定的 SBL 位置并触发 SBL。 但这种功能不会发生、因此我们想知道如何实现这一点、以及需要进行哪些更改。
如果需要,我们可以提供更多信息。
注意:我们正在使用 SDK 05_04_00_01版本,TI 提供了一个热复位的示例代码,称为看门狗复位。 我们已经将此示例代码与示例 hello world 代码合并、并在此处附上了相应的代码更改以供您参考。
谢谢
/* * Copyright (C) 2018-2021 Texas Instruments Incorporated * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <stdio.h> #include <kernel/dpl/DebugP.h> #include <kernel/dpl/ClockP.h> #include <kernel/dpl/HwiP.h> #include <drivers/watchdog.h> #include "ti_drivers_config.h" #include "ti_drivers_open_close.h" #include "ti_board_open_close.h" //#include "transport.h" //#define SBL_VECTOR ((uint32_t) 0xE000ED08) #define SBL_VECTOR 0x00458000 volatile uint32_t *vtor; #define NUM_OF_ITERATIONS (3U) void app_switchtoSBL(); void app_switchtoSBL() { DebugP_log("Switching to SBL"); *vtor = SBL_VECTOR; #if (!UNIT_TEST) __asm(" MSR MSP, %0" : :"r" ((uint32_t)*vtor)); //__asm("BX %0"::"r" ((uint32_t)*(vtor))); __asm("BX %0"::"r" ((uint32_t)*(vtor+4))); #endif } void hello_world_main(void *args) { /* Watchdog timer expiry time in millisecond */ uint32_t wdtExpiryTimeinMs = gWatchdogParams[CONFIG_WDT0].expirationTime; uint32_t index = 0; /* Open drivers to open the UART driver for console */ Drivers_open(); Board_driversOpen(); DebugP_log("Hello World!\r\n"); Watchdog_enable(gWatchdogHandle[CONFIG_WDT0]); DebugP_log("Watchdog reset Mode Test Started ...\r\n"); DebugP_log("Servicing WDT for few iterations \r\n"); /* Service the WDT for more than expiry time */ for(index = 0; index < NUM_OF_ITERATIONS; index++) { /* Need to service the WDT in open window */ while(Watchdog_isClosedWindow(gWatchdogHandle[CONFIG_WDT0]) == true); /* Clear Watchdog timer */ Watchdog_clear(gWatchdogHandle[CONFIG_WDT0]); /* wait for (expiry time/2 ) time */ ClockP_usleep((wdtExpiryTimeinMs*100)/2); } DebugP_log("Watchdog triggers warm reset in %d (ms)\r\n", wdtExpiryTimeinMs); DebugP_log("All tests have passed!!\r\n"); /* Wait till WDT triggers the reset */ while(1) { DebugP_log("Prints will be stopped after reset mcw \r\n"); } app_switchtoSBL(); DebugP_log("stopped watchdog!!\r\n"); // Board_driversClose(); // Drivers_close(); }
你好。
我正在研究这一问题,并将在明天一天结束时作出答复。
此致、
桑托什
你好。
似乎缺少了 handleWdtReset 函数、该函数将强制 RBL 从闪存重新加载并处理前端。 由于 SBL 存储在 SFLASH 的初始段中、因此通过执行此操作、您将重新加载 SBL、后者将重新加载您的应用。 您是否曾尝试过这样做以查看是否可提供所需结果?
此致、
桑托什