Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

How to port xTaskCreatePinnedToCore() into mongoose-os lib function?

2»

Comments

  • void mg_task(void *arg) {
      printf("***********Free RAM: \r\n");
      printf("$$$$$$$$$$$Free RAM: \r\n");
      while (1) {
       // mg_mgr_poll(&mgr, 1000);
        mgos_msleep(100);
      }
      vTaskDelete(NULL);
    }
    enum mgos_app_init_result mgos_app_init(void){//void user_init(void) {
      //uart_div_modify(0, UART_CLK_FREQ / 115200);
      LOG(LL_INFO,("&&&&&&&&&&&&&&&&&&&&&\n"));
    
      printf("Free RAM: \r\n");//, system_get_free_heap_size());
      xTaskCreate(mg_task,"mongoose",1024, NULL, 0, NULL);
      printf("%s", "hello, my task");
                  //MG_TASK_STACK_SIZE / 4, /* in 32-bit words */
                  //NULL, MGOS_TASK_PRIORITY, NULL);
     //xTaskCreatePinnedToCore(&my_task, "tskmad", 2048, NULL, 5, NULL, 0);
     // while (1);
      return MGOS_APP_INIT_SUCCESS;
    }
    
  • nliviunliviu Romania
    edited March 26

    Increase the stack size to 4096 and it will work.

    LE. I see @rojer told you to increase the stack size too.

  • moscodemoscode Seoul
    edited March 31

    You should test like below. The point is that I replaced "mgos_msleep(100);" with "vTaskDelay(100 / portTICK_PERIOD_MS)" for RTOS scheduler's context switch.

    void my_task(void *pvParameters){

    for(;;) {
    printf("%s", "hello, my task");
    vTaskDelay(100 / portTICK_PERIOD_MS);
    }
    vTaskDelete(NULL);
    }

Sign In or Register to comment.