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 (registration required) various documents highlighting:

System Workbench for STM32


sprintf stops execution

Hi all

I have a problem with the sprintf function in a stm32f4 discovery board.
i use win 10 32bit and the ac6 version is 1.14.1.201707031232

The code has
char s200;
int i;

i=0;
sprint((s,”some text : %d”, i);

In debug and normal execution the program stops in sprintf for ever.
If the sprintf function dont has any of the % parameters the function is executed normally.

Thank all in advance.

Are you using the 200 bytes char inside a function!? The local variables of the functions are being allocated on the stack, so maybe your stack size isn’t big enough to hold that much data. You can increase your stack size by editing the linker script, but anyway it isn’t a great idea to use 200 bytes buffer on the stack. Just use a global variable.

Thank you bugmenot

To test it I made a new project with only these lines

  1. include “stm32f4xx.h”
  2. include “stm32f4_discovery.h”


char s200;
int i;

int main(void)
{

i=0;
sprintf(s,”Text :”);

sprintf(s,”Text :%d”,i);

sprintf(s,”Text :”);

for(;;);
}

the first sprintf is executed but the second stops forever.
In the bigger project in which i face the problem the s and i was into the function body and i have change the linker script with heap and stack in 0x2000 but nothing.

Well, that is strange. What do you mean “stops forever”? The execution just never comes back from the function? I would try to use the debugger and pause the execution when it’s stuck, so I could find out where (which code line / instruction) and why and it got stuck.

I check it with the debugger
Pressing F6 the program pass the first sprintf but never goes out from the second sprintf


1 - You have to Include the stdio.h , gcc will provide fake function read about “warning: implicit declaration of function”.
2 - Make sure the optimzation is turned off and max for debugging
3 - The code you write does not compile, so please provide the code as in IDE

best reagds,
Mazen

Thank you mazensaad

the code in ide is as below

  1. include
  2. include “stm32f4xx.h”
  3. include “stm32f4_discovery.h”


char s 200 ;
int i;

int main(void)
{
i=0;
sprintf(s,”Text :”);
sprintf(s,”Text :%d”,i);
sprintf(s,”Text :”);
for(;;);
}

but when i press the post button i the char s loses his brackets,
anyway this section was a part of a bigger project and the printout was in a LCD display.
So when i put the sprintf function the program stops only when the sprintf has parameters.
I make a new project only with this code and i have the same results.
Going step by step with the debugger the execution stop in the second sprintf.
Do i must change the _write routine in syscalls.c ? But this is not a printf to make a redirection.

Thank you for your time and best regards
Akis