Hard fault on STM32 with freertos (missing task stack trace)

Hi all,
I am trying memfault sdk on STM32 project with Cube-IDE, freeRtos and crash dump saved in flash.
This is done on a nucleo board with a simple test program (3 tasks) for possible inclusion in the real project.
Coredump.bin & project symbols are manually loaded.

The exception is correctly detected by MemFault GUI application and the faulting task stack trace is correct.
Thanks a lot MemFault !!!

Unfortunately I don’t see the stack trace of other running tasks :frowning:

Am I missing some configuration parameters to see all task stack frames?

Thanks for your attention
PaoloC

Hi @PaoloC! Thanks for getting in touch. Did you include the FreeRTOS module in your Memfault integration? You can find more details here:

Hi Francois,

thanks a lot for your answer !

I saw & followed the instructions at top of file memfault_freertos_ram_regions.c.

In particular for step 4 I have implemented & modified the function memfault_platform_coredump_get_regions.

The simple modification consists of defining the array of dump regions:

static sMfltCoredumpRegion s_coredump_regions[16];

Now Memfault correctly shows all tasks :blush::blush::blush:

My implementation of memfault_platform_coredump_get_regions is:

MEMFAULT_WEAK
const sMfltCoredumpRegion memfault_platform_coredump_get_regions(
        const sCoredumpCrashInfo *crash_info, 
        size_t *num_regions) 
{

  static sMfltCoredumpRegion s_coredump_regions[16]; // Added
  int region_idx = 0;
  const size_t active_stack_size_to_collect = 512;

  // first, capture the active stack
  s_coredump_regions[0] = MEMFAULT_COREDUMP_MEMORY_REGION_INIT(
      crash_info->stack_address, 
      memfault_platform_sanitize_address_range(crash_info->stack_address, active_stack_size_to_collect)
  );

  region_idx++;

  extern uint32_t __memfault_capture_start;
  extern uint32_t __memfault_capture_end;
  const. size_t memfault_region_size = (uint32_t)&__memfault_capture_end - (uint32_t)&__memfault_capture_start;

  s_coredump_regions[region_idx] = MEMFAULT_COREDUMP_MEMORY_REGION_INIT(
      &__memfault_capture_start, 
      memfault_region_size
  );
  region_idx++;

  region_idx += memfault_freertos_get_task_regions(&s_coredump_regions[region_idx],
  MEMFAULT_ARRAY_SIZE(s_coredump_regions) - region_idx);
  *num_regions = region_idx; // was: MEMFAULT_ARRAY_SIZE(s_coredump_regions);

  return &s_coredump_regions[0];
}

Great to hear you’re up and running!