Skip to content

MTS targets: Don't use any printf() calls when NDEBUG is defined #5013

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

Merged
merged 1 commit into from
Sep 5, 2017

Conversation

janjongboom
Copy link
Contributor

@janjongboom janjongboom commented Sep 4, 2017

The current behavior prevents linking out printf() and friends in release builds. This patch makes blinky on xDot use 15K(!!!!) less flash when compiling release build with GCC_ARM.

/cc @chrissnow This pushes my bootloader for xDot to 22K on GCC, 21K on ARMCC.

@reissjason @sg-

…vents linking out printf() and friends in release build
Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It make sense to remove prints in release, but why do you add new macro in one place and just remove the printf in another?

@janjongboom
Copy link
Contributor Author

@bulislaw Because in 2 files there's only one printf so wrapping it in an #ifdef made sense. In the other file there's multiple calls to printf so figured I'd macro it up.

I'm open to suggestions though on how to make this more clean.

@bulislaw
Copy link
Member

bulislaw commented Sep 4, 2017

Fair enough. I guess we should introduce some sort of mbed wide debug print wrappers (that don't require external lib) sooner rather than later.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 4, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Sep 5, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1210

All builds and test passed!

@sg-
Copy link
Contributor

sg- commented Sep 5, 2017

Why didn't this use the debug statement?

https://github.com/ARMmbed/mbed-os/blob/master/platform/mbed_debug.h

@maclobdell
Copy link
Contributor

cc @felser @klaas019

@0xc0170 0xc0170 self-assigned this Sep 6, 2017
0xc0170 added a commit to 0xc0170/mbed-os that referenced this pull request Sep 6, 2017
Instead of using #if NDEBUG, we can directly invoke debug() function. Fixes ARMmbed#5013
adbridge pushed a commit that referenced this pull request Oct 6, 2017
Instead of using #if NDEBUG, we can directly invoke debug() function. Fixes #5013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants