Skip to content
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

Cellular: Fix plmn trace for IAR #10172

Merged
merged 1 commit into from Mar 21, 2019

Conversation

Projects
None yet
8 participants
@kivaisan
Copy link
Contributor

commented Mar 20, 2019

Description

IAR compiler does not seem to like printing null strings. PLMN can be null depending on user configuration.

This is fix for ARMmbed/mbed-os-example-cellular#125.

Pull request type

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

Reviewers

@AriParkkila @mirelachirica @AnttiKauppila

Release Notes

Cellular: Fix plmn trace for IAR
IAR compiler does not seem to like printing null strings.
@AnttiKauppila

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2019

@0xc0170 @adbridge This is targeted to next 5.12.rcX version

@@ -259,7 +259,7 @@ nsapi_error_t AT_CellularContext::set_blocking(bool blocking)

void AT_CellularContext::set_plmn(const char *plmn)
{
tr_info("CellularContext plmn %s", plmn);
tr_info("CellularContext plmn %s", (plmn ? plmn : "NULL"));

This comment has been minimized.

Copy link
@0xc0170

0xc0170 Mar 20, 2019

Member

This seems to be regular use, do we need to do this condition for every const char* for trace msg ? Is this a place to fix it, not tr_ module?

@kjbracey-arm what do you think about this bugfix?

This comment has been minimized.

Copy link
@kjbracey-arm

kjbracey-arm Mar 20, 2019

Contributor

It's definitely needed in any situation where NULL is a valid value. So if set_plmn(NULL) is legal, this is a necessary change. If set_plmn(NULL) is illegal, it's debatable.

It's generally nice if your trace doesn't blow stuff up with illegal values, so it is handy when the C library catches it for you. (Up until the point you port to another library that isn't nice).

But I'm not generally in favour of hiding illegal conditions. If in this case set_plmn(NULL) is illegal, it's helped us just catch that illegal use.

There's some second-order oddity here in the example that they're literally doing "plmn": 0 in the JSON, rather than "plmn": null, which is triggering the passing of 0 in the C code. JSON null would not define the macro.

Trace code can't do this itself - it's not parsing the format string or handling the parameters - they just go straight to a C library printf.

This comment has been minimized.

Copy link
@kivaisan

kivaisan Mar 20, 2019

Author Contributor

In this case we also needs to be careful not to break any API. Cellular-example mbed_app.json has had "null" values defined as 0 for long time, so I don't think we want to change the behaviour anymore. Right?

This comment has been minimized.

Copy link
@kjbracey-arm

kjbracey-arm Mar 20, 2019

Contributor

Aside from the JSON, the actual CellularInterface API is unclear on whether NULL is legal or not for the various config APIs, but I'd guess it's supposed to be, meaning "reset to none" (or default if APN database?). So I think this particular check is required.

@0xc0170 0xc0170 requested a review from kjbracey-arm Mar 20, 2019

@0xc0170
Copy link
Member

left a comment

Thanks @kjbracey-arm, clear now.

@adbridge adbridge added needs: CI and removed needs: review labels Mar 20, 2019

@adbridge

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2019

ci started

@mbed-ci

This comment has been minimized.

Copy link

commented Mar 20, 2019

Test run: FAILED

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

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-IAR8
@cmonr

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2019

CI restarted, since the buld failure was actually a GitHob 502 timeout

@mbed-ci

This comment has been minimized.

Copy link

commented Mar 20, 2019

Test run: SUCCESS

Summary: 13 of 13 test jobs passed
Build number : 2
Build artifacts

@cmonr cmonr added ready for merge and removed needs: CI labels Mar 20, 2019

@0xc0170 0xc0170 merged commit 014a5ec into ARMmbed:master Mar 21, 2019

28 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARMC5 Success
Details
jenkins-ci/build-ARMC6 Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR8 Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(+0 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARMC5 Success
Details
jenkins-ci/mbed2-build-ARMC6 Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR8 Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Local astyle testing has passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/doxy-spellcheck Local doxy-spellcheck testing has passed
Details
travis-ci/events Passed, runtime is 10216 cycles
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/include_check Local include_check testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8408B
Details
travis-ci/psa-autogen Local psa-autogen testing has passed
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
travis-ci/tools-py3.5 Local tools-py3.5 testing has passed
Details
travis-ci/tools-py3.6 Local tools-py3.6 testing has passed
Details
travis-ci/tools-py3.7 Local tools-py3.7 testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.