Page 1 of 1

MemoryAllocationStatistics not compiling

Posted: Mon Apr 27, 2020 4:35 pm
by Dimdim
Hi guys, I'm glad to see the forum being back up. :)

I'm trying to compile this sketch : https://github.com/stm32duino/STM32Exam ... istics.ino

And getting this error:

Code: Select all

free_memory_3:30:38: error: '_get_MSP' was not declared in this scope

   char * stack_ptr = (char*)_get_MSP();

                                      ^

exit status 1
'_get_MSP' was not declared in this scope
I'm using Roger's core.

Any ideas?

Re: MemoryAllocationStatistics not compiling

Posted: Mon Apr 27, 2020 5:34 pm
by stas2z
that example is for HAL based core, probably roger's core gcc doesn't support it
but it's not a problem

Code: Select all

__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void)
{
  register uint32_t result;

  __ASM volatile ("MRS %0, msp\n" : "=r" (result) );
  return(result);
}

Re: MemoryAllocationStatistics not compiling

Posted: Mon Apr 27, 2020 10:03 pm
by Dimdim
Thank you very much stas2z.

But where should I put this code?