These are chat archives for SmingHub/Sming

19th
Sep 2016
Piotr Dobrowolski
@Informatic
Sep 19 2016 07:00
Hi all, just to make sure - am I correct, that Sming does not have autodependencies implemented in its makefiles?
frankdownunder
@frankdownunder
Sep 19 2016 07:24
When I was looking at rBoot_Generic, I saw this code:
if ((numToken == 2) && (commandToken[1] == "loop")) {
commandOutput->printf("Entering loop for wdt reset");
int i =0;
do {
i ++;
} while (true);
}
I expected a reset - but was surprised to NOT get one.
Perhaps I didn't wait long enough, or is it because, using RTOS, the operating system preempts the current thread and "feeds the watchdog". If so, thats great, and we should put a comment in to note this behaviour difference between sming and smingRTOS.
My next question would be - assuming that a reset is actually desired for testing purposes - what test case are we looking at ? And what should the code look like in order to get the reset to happen?
Perhaps I am overthinking all this :smile:
hreintke
@hreintke
Sep 19 2016 19:26
@frankdownunder :
rBoot_Generic needs serious thoughts.
You noticed correct that the loop doesn't work, indeed because of RTOS preemption.
I included it because a WDT reset causes a hard reset (entering bootloader) and sdk reset causes soft reset.
frankdownunder
@frankdownunder
Sep 19 2016 21:09
@hreintke I will try creating a task of high priority to execute the loop.
frankdownunder
@frankdownunder
Sep 19 2016 23:38
@hreintke
I tried it, and it worked, sort of, I had to make the priority 14 to get it to reset.
void vMakeHardResetHappen(void *pvParameters)
{
    /* This loops forever.  The watchdog (depending on the priority of this task)
     * will eventually reset the processor
     * Doing so should get rBoot to boot to the other ROM ?
    */
    int i =0;
    do
    {
        i ++;
    } while (true);
    // Never get here . . .
    vTaskDelete(NULL);
}

void processApplicationCommands(String commandLine, CommandOutput* commandOutput)
{
    commandOutput->printf("This command is handled by the application\r\n");
    Vector<String> commandToken;
    int numToken = splitString(commandLine, ' ' , commandToken);
    if ((numToken == 2) && (commandToken[1] == "loop"))
    {
        Serial.println("Entering loop for wdt hard reset. should cause reset to the other ROM");
        xTaskCreate(vMakeHardResetHappen,
                    (const signed char*) "MakeHardResetHappen_task",
                256,    // usStackDepth
                NULL,    // pvParameters
                14,     // priority - even higher than TCPIP which is 10
                NULL);
    }