Skip to content

Remove printf completely and fix the optimization check #9296

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 4 commits into from
Jan 24, 2019

Conversation

SenRamakri
Copy link
Contributor

Description

printf call from mbed_error.c has been causing elevated rom usage for GCC builds for develop profile. This change refactor the code to use mbed_error_print before rebooting to avoid using printf. Also contains a fix for optimization check.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@bulislaw

@SenRamakri SenRamakri requested a review from bulislaw January 8, 2019 21:08
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 9, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 10, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 10, 2019

There are two devices failures, we will restart the test later today to make sure they are related to this changes . Please review

@cmonr
Copy link
Contributor

cmonr commented Jan 10, 2019

Restarted jenkins-ci/greentea-test job.

@cmonr
Copy link
Contributor

cmonr commented Jan 10, 2019

@SenRamakri Please take a look at the following logs: http://mbed-os-ci.s3-website-eu-west-1.amazonaws.com/?prefix=jenkins-ci/artifacts/9296/1/greentea-test/766/

The rerun failed a subset of test that originally failed.

@SenRamakri
Copy link
Contributor Author

@cmonr - Thanks for the info. The failures in K64F doesn't seem to be related to my changes. It appears to be some random failures. The test failures on 746ZG and 429ZI is related to crash-reporting but unfortunately I'm not able to reproduce the failure. Both IAR/GCC_ARM works just fine at my desk including the test which is timing-out in CI. I'm continuing to look into this though.

@SenRamakri
Copy link
Contributor Author

SenRamakri commented Jan 11, 2019

The test which is timing out is "crash_reporting" test. This test includes a host side scriptl which sends a message to the device to start the test. If the message goes out from host before the device starts listening for the message we may see timeouts like this. That's the only reason I can think as I see from the log that the host did send out that message but device acted like it never received it. I'm going to increase the time host side waits for the device to come up and then send the message. I'll try pushing this change and see if that helps.

@SenRamakri
Copy link
Contributor Author

@ARMmbed/mbed-os-maintainers - Can you please start CI on this?

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 14, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 14, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@SenRamakri
Copy link
Contributor Author

@ARMmbed/mbed-os-maintainers - FYI: It appears greentea tests failed across all targets for some reason. Looks like its unrelated to the commit.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2019

Test restarted

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2019

Restarted and failures are similar - isn't this related ? mbed_platform-crash_reporting is failing for few targets

@SenRamakri
Copy link
Contributor Author

@0xc0170 - mbed_platform-crash_reporting failure is related. But the challenge is I'm not able to reproduce this at my desk. I'm going to seek help from CI/Test team to see if we can formulate something to reproduce this at desk.

@OPpuolitaival
Copy link
Contributor

greentea test restarted

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 23, 2019

CI was restarted

@mbed-ci
Copy link

mbed-ci commented Jan 23, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 4
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 23, 2019

@SenRamakri Tests passed with debug msgs, please review

@SenRamakri
Copy link
Contributor Author

@0xc0170 , @cmonr - I have reviewed the test logs and see that all tests pass, and my debug messages confirm that tests did not timeout and worked as expected. Interestingly the changes did not fix anything in particular and I can see there may be some timing change associated with this which is helping to overcome some test issues in CI. At this point, I would like to keep these extra debug messages to debug issues in future in case the tests starts timing-out again and also due to the fact that the tests were randomly failing previously across different targets. So, after monitoring it for next few weeks/months we can remove these extra messages. If this is ok, we can merge this commit as it addresses some important memory issues. I'm also confused about the dynamic-memory-change reporting +192 bytes. When I compiled a tiny app(without any printf) with latest mbed-os/master I see
Total Flash memory (text + data): 59702(+59702) bytes
and with my branch its
Total Flash memory (text + data): 54012(+54012) bytes. (less by few Kbs)
So, I don't know reason for that +192 bytes increase reported here.

@SenRamakri
Copy link
Contributor Author

Ok, I did more analysis and I found the reason for +192 bytes reported by dynamic-memory-test. First of all, the dynamic-memory-test always build release profile and thus it never sees the 5K difference we are trying to address here for develop builds. In addition the new changes of moving the mbed_error_printf() added some extra stuff for release builds which probably caused +192b. As of now, I have fixed that with latest commit which should cut-down on that +192bytes increase for release builds.

@ARMmbed/mbed-os-maintainers - Please restart CI on this.

@SenRamakri SenRamakri force-pushed the sen_RemovePrintfCrashReport branch from fc6a1f9 to d0b9503 Compare January 23, 2019 23:40
@cmonr
Copy link
Contributor

cmonr commented Jan 24, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 24, 2019

Test run: FAILED

Summary: 1 of 12 test jobs failed
Build number : 5
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@SenRamakri
Copy link
Contributor Author

SenRamakri commented Jan 24, 2019

@ARMmbed/mbed-os-maintainers - The tests passed and with the latest commit the memory increase has also been optimized. The failure with NUCLEO_F429(in the previous run) seems to be some reporting issue as I see from the logs that tests actually passed. I think this PR can be merged now.

@cmonr cmonr merged commit 2941c8d into ARMmbed:master Jan 24, 2019
@janjongboom
Copy link
Contributor

This PR did not solve my issue. Without MBED_FAULT_HANDLER_DISABLED declared and no printf calls in my code I see 5.2K flash increase and 712 bytes static RAM increase.

@JanneKiiskila
Copy link
Contributor

@SenRamakri - did you notice Jan's comment?

@SenRamakri
Copy link
Contributor Author

@JanneKiiskila - Yes, we did and it was already responded, please see - #9464 (comment).

@@ -60,7 +60,7 @@ def test_steps(self):
wait_after_reset = wait_after_reset if wait_after_reset is not None else DEFAULT_CYCLE_PERIOD

#Wait 2 seconds for system to init
time.sleep(2.0)
time.sleep(7.0)
Copy link
Member

Choose a reason for hiding this comment

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

The comment above should have been fixed before merge.

Copy link
Contributor

Choose a reason for hiding this comment

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

@SenRamakri Please review

@kjbracey kjbracey mentioned this pull request Jan 30, 2019
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.

10 participants