cancel
Showing results for 
Search instead for 
Did you mean: 

Using System Workbench

RWils.11
Associate

Hello,

I am using system workbench to generate a project not using the HAL libraries, bare metal as they say. I have done quite well thus far although today's headache concerns the use of sprintf. It is crashing my processor (STM32L476RG). I can get it to work on STM32CubeIDE but I want to do my development in System Workbench which CubeIDE is based on. Hope someone can help mewith some advice. Casting between int32_t and float32_t also seem to present problems. I am missing something key here I suspect.

2 REPLIES 2
TDK
Guru

Not many details here. sprintf can fail if malloc fails. Casting to float might require the FPU to be enabled. Check for flags similiar to "-mfloat-abi=hard -mfpu=fpv4-sp-d16" during compiling. Consider describing your problem better than just "seem to present problems".

CubeIDE is based on Eclipse, which is the same as System Workbench, but I don't believe any code was reused from SW to create CubeIDE. SW4STM32 seems to be abandoned, or close to.  I'd consider switching.

If you feel a post has answered your question, please click "Accept as Solution".
RWils.11
Associate

Hello,

Yes sorry some more detail. All I am doing it:

float32_t ParamConverter(int32_t Input){

float32_t RetVal = 0;

char Holding[5];

int diag = sprintf(Holding, "%d", (int)Input);

return 0;

}

This then seems to crash the processor which then ends up in an infinite loop. As you say the SysWorkbench seems to be quite quiet and it may be less heartache to move to STM32CubeIDE. I have managed to port all of my code to Cube so this is a fix but not what I was intending. Thank you very much for coming back with suggestions. I did post in the Sys Workbench forum but was met with a stony silence which is educational in itself.

Thanks again.

Robert.