Giter Site home page Giter Site logo

FreeRTOS in Maixduino about maixduino HOT 6 CLOSED

sipeed avatar sipeed commented on June 4, 2024
FreeRTOS in Maixduino

from maixduino.

Comments (6)

chegewara avatar chegewara commented on June 4, 2024

https://github.com/kendryte/kendryte-freertos-sdk

from maixduino.

Neutree avatar Neutree commented on June 4, 2024

kendryte removed FreeRTOS from master branch, and you can use freertos branch: https://github.com/kendryte/kendryte-standalone-sdk/tree/freertos

from maixduino.

maxpromer avatar maxpromer commented on June 4, 2024

kendryte removed FreeRTOS from master branch, and you can use freertos branch: https://github.com/kendryte/kendryte-standalone-sdk/tree/freertos

I clone branch this to /cores/arduino/kendryte-standalone-sdk and i upload this code to Sipeed Maix One Dock but not work. new task not do.

#include <FreeRTOS.h>
#include <task.h>

void vTaskCode( void * pvParameters ) {
  for ( ;; ) {
    Serial.println("Run in task !");
    vTaskDelay(500 / portTICK_PERIOD_MS);
  }
}

TaskHandle_t xHandle = NULL;

void setup() {
  Serial.begin(115200);

  Serial.println("Task create");
  xTaskCreate(
    vTaskCode,       /* Function that implements the task. */
    "vTaskCode",     /* Text name for the task. */
    1024,            /* Stack size in words, not bytes. */
    NULL,            /* Parameter passed into the task. */
    4,               /* Priority at which the task is created. */
    &xHandle );      /* Used to pass out the created task's handle. */
}

void loop() {
  Serial.println("Main loop");
  vTaskDelay(500 / portTICK_PERIOD_MS);
}

cTCcGE.png

What i do wrong ?

from maixduino.

Neutree avatar Neutree commented on June 4, 2024

@maxpromer

Only one task was created, and scheduler not run yet in your code.

You should add some code to loop function:

vTaskStartScheduler();
while(1){}

the maixduino not run FreeRTOS scheduler by default, so you should run scheduler in your loop

You will understand all once you saw the source code as follow:

do {
loop();
//if (serialEventRun)
// serialEventRun();
} while (1);

from maixduino.

maxpromer avatar maxpromer commented on June 4, 2024

@maxpromer

Only one task was created, and scheduler not run yet in your code.

You should add some code to loop function:

vTaskStartScheduler();
while(1){}

the maixduino not run FreeRTOS scheduler by default, so you should run scheduler in your loop

You will understand all once you saw the source code as follow:

do {
loop();
//if (serialEventRun)
// serialEventRun();
} while (1);

It work ! Thank so much. freertos branch i don't see example to use FreeRTOS so i have not a way to understand use FreeRTOS (I'm not professional about FreeRTOS. i'm user)

And this full code of work.

#include <FreeRTOS.h>
#include <task.h>

void vTaskCode( void * pvParameters ) {
  for ( ;; ) {
    Serial.println("Run in task !");
    vTaskDelay(500 / portTICK_PERIOD_MS);
  }
}

void vTaskCode2( void * pvParameters ) {
  for ( ;; ) {
    Serial.println("Run in task 2 !");
    vTaskDelay(500 / portTICK_PERIOD_MS);
  }
}


TaskHandle_t xHandle = NULL, xHandle2 = NULL;

void setup() {
  Serial.begin(115200);

  Serial.println("Task create");
  xTaskCreate(
    vTaskCode,       /* Function that implements the task. */
    "vTaskCode",     /* Text name for the task. */
    1024,            /* Stack size in words, not bytes. */
    NULL,            /* Parameter passed into the task. */
    4,               /* Priority at which the task is created. */
    &xHandle );      /* Used to pass out the created task's handle. */

  xTaskCreate(
    vTaskCode2,       /* Function that implements the task. */
    "vTaskCode2",     /* Text name for the task. */
    1024,            /* Stack size in words, not bytes. */
    NULL,            /* Parameter passed into the task. */
    4,               /* Priority at which the task is created. */
    &xHandle2 );      /* Used to pass out the created task's handle. */
}

void loop() {
  vTaskStartScheduler();
  while(1){}
}

from maixduino.

maxpromer avatar maxpromer commented on June 4, 2024

I test code on Maixduino v0.3.10 the FreeRTOS work without clone freertos branch replace to /cores/arduino/kendryte-standalone-sdk so you can use FreeRTOS right now.

from maixduino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.