Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world.
And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download two short videos (registration required) highlighting:

System Workbench for STM32


malloc heap issue with CubeMX Project

after searching more the issue is in sycall.c _sbreak function provided by both CubeMX and ac6 project.
the heap increase check is not adpated to an rtos env (stack is in user ram area sp is not any more the main stack)
The heap break check condition is not perfect
ld file and sbreak should be fixed to compare first it is less than min heap and only if not checking vs stack
so it suceed even in rtos env until min heap is not consumed

ie
caddr_t _sbrk(int incr) {
extern char end asm(“end”);
extern char _min_heap_end asm(“_min_heap_end”);
static char *heap_end;
char *prev_heap_end;

if (heap_end == 0)
heap_end = &end;

prev_heap_end = heap_end;
if (prev_heap_end + incr > &_min_heap_end) {
if (heap_end + incr > stack_ptr) {
// write(1, “Heap and stack collision\n”, 25);
// abort();
errno = ENOMEM;
return (caddr_t) -1;
}
}
heap_end += incr;
return (caddr_t) prev_heap_end;
}

LD file changed to
._user_heap_stack :
{
. = ALIGN(4);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
PROVIDE ( _min_heap_end = . );
. = . + _Min_Stack_Size;
. = ALIGN(4);
} >RAM



A work arround it s to do a first malloc and free in main prior to start scheduler to setup the user minilal heap
for the time being it’s what i’ll use as ld file options are overwriten by CubeMX on code generation (a user section would be nice)

 

Newest Forum Posts

  1. openOCD Wrong device detected by maxim221, 12:32
  2. STM32429I_Discovery board with printf float support problem by johannes.visser@msc-technologies.eu, 2019-12-05 16:08
  3. malloc heap issue with CubeMX Project by johannes.visser@msc-technologies.eu, 2019-12-05 16:04
  4. Debugger not working by Daniel Jack Morley, 2019-11-27 21:46
  5. Compiler change problem by Lucian Pop, 2019-11-20 17:41
  6. Sample programs and compiling by jjtimer, 2019-11-20 10:31
  7. Unit test issues for STM32 by Rinkedevries, 2019-11-18 10:32
  8. Ubuntu 19.04 Debug problems by costantino, 2019-11-17 19:17
  9. Compile without eclipse by JSStabl, 2019-11-14 15:55
  10. Problem with PWM signal by ElectroniK, 2019-11-13 20:55

Last-Modified Blogs