Skip to content

incorrect/useless call to printf() in _exit() #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
WestfW opened this issue Dec 16, 2017 · 1 comment
Closed

incorrect/useless call to printf() in _exit() #47

WestfW opened this issue Dec 16, 2017 · 1 comment

Comments

@WestfW
Copy link
Contributor

WestfW commented Dec 16, 2017

in cores/arduino/syscalls_sam3.c, the implementation of _exit() includes:

extern void _exit( int status )
{
    printf( "Exiting with status %d.\n", status ) ;

    for ( ; ; ) ;
}

This causes something like 12k of printf and stdio code to be included in every sketch, and probably doesn't do anything useful since there is no guarantee that the UART has been initialized at all (even assuming that printf() ends up using the skeleton _write() code that is also there...)

@facchinm
Copy link
Member

Thanks for spotting, if you could add a PR I'll be glad to merge it (and release an updated SAM core after a looong time)

WestfW added a commit to WestfW/ArduinoCore-sam that referenced this issue Dec 19, 2017
The use of printf here is problematic (stdio and/or uart is
probably not even set up) and expensive (~10k of code!)
See arduino#47
@WestfW WestfW closed this as completed Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants