Core dump with mgos_pppos_cmd

If you are asking a question, please follow this template:

  1. My goal is: Getting to run the AT command to get its corresponding payload
  2. My actions are:
#include "mgos.h"
#include "mgos_pppos.h"

static bool ATGPS_cb(void *cb_arg, bool ok, struct mg_str data)
{
  if (!ok) {
    return false;
  }  
  LOG(LL_INFO, ("ATGPS_cb data length: %d", data.len));
  return true;
}

struct mgos_pppos_cmd ATCmd[] = {
    {.cmd = "AT$GPSACP", .cb = ATGPS_cb},
    // {.cmd = "AT$GPSACP"},
    {.cmd = NULL}
};

static void timer_cb(void *arg)
{
  if (!mgos_pppos_run_cmds(0, ATCmd))
  {
    LOG(LL_INFO, ("mgos_pppos_run_cmds FAILED"));
  }
  else
  {
    LOG(LL_INFO, ("mgos_pppos_run_cmds SUCCESS"));
  }
}

enum mgos_app_init_result mgos_app_init(void)
{
  mgos_set_timer(2000 /* ms */, MGOS_TIMER_REPEAT, timer_cb, NULL);
  return MGOS_APP_INIT_SUCCESS;
}
  1. The result I see is:


This problem happens rather frequently after a certain amount of time.

  1. My expectation & question is: How to run AT command without this problem? Is there another mechanism to extract the AT payload?

It looks like you use local build.
In this case, if you run mos console in the root directory of your application and a core dump occurs, the mos tool will analyse it and show where the exception was thrown (function, line number, etc.).