# Printf within leon3 simulation

**URL:** <https://discourse.grlib.community/t/printf-within-leon3-simulation/298>\
**Category:** General - GRLIB SoC\
**Created:** [11 January 2023 13:59 UTC](https://discourse.grlib.community/t/printf-within-leon3-simulation/298 "2023-01-11T13:59:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ludek](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@ludek](https://discourse.grlib.community/u/ludek)\
**Post date:** [11 January 2023 13:59 UTC](https://discourse.grlib.community/t/printf-within-leon3-simulation/298/1 "2023-01-11T13:59:17Z")

</div>

Hello,

we have a template leon3 design in a simulator and it is running a simple program:

#include \<stdio.h\>

int main() {  
printf(“Hello world!\n”);  
}

When the source code is prepared with:

/opt/sparc-elf-4.4.2/bin/sparc-elf-gcc -O2 -g -msoft-float hello.c -o hello.exe  
/opt/sparc-elf-4.4.2/bin/sparc-elf-objcopy -O srec --gap-fill 0 hello.exe ram.srec

then the simulator console prints out “Hello world!” with no problems.

When the source code is prepared with:

/opt/bcc-2.2.2-gcc/bin/sparc-gaisler-elf-gcc -O2 -g -mcpu=leon3 -msoft-float hello.c -o hello.exe  
/opt/bcc-2.2.2-gcc/bin/sparc-gaisler-elf-objcopy -O srec --gap-fill 0 hello.exe ram.srec

then the simulator console does not print anything. Waveform shows that apbuart is indefinitely checked and the software locked in an indefinite loop, like miscompatibility between the software and the actual hardware.

Did anybody encounter such a behaviour? Does anybody have a clue what to do to make the simulator console prints working with bcc-2.2.2?

Thanks and best regards,

Ludek
