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: Refactor APN db implementation to reduce memory usage #10821

Merged
merged 1 commit into from Jun 25, 2019

Conversation

@kivaisan
Copy link
Contributor

commented Jun 13, 2019

Description

Reduce memory usage by moving actual APN database into single object file
instead of having it defined in header as a static.

Also implementation is enabled only if either
cellular.use-apn-lookup or ppp-cell-iface.apn-lookup is enabled.

Pull request type

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

Reviewers

@jarvte @AnttiKauppila @mudassar-ublox

Release Notes

@ciarmcom ciarmcom requested review from AnttiKauppila, jarvte and ARMmbed/mbed-os-maintainers Jun 13, 2019
@ciarmcom

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

@jarvte
jarvte approved these changes Jun 13, 2019
/**
* Default APN settings used by many networks
*/
static const char *apndef = _APN("internet",,);

This comment has been minimized.

Copy link
@kjbracey-arm

kjbracey-arm Jun 13, 2019

Contributor

Can save a little more here by making that a char[] array like apnlut. It's currently a RAM pointer to a ROM char array.

This comment has been minimized.

Copy link
@kivaisan

kivaisan Jun 13, 2019

Author Contributor

Do you mean static const char apndef[] = _APN("internet",,); ? At least with GCC this does not change anything.

This comment has been minimized.

Copy link
@kjbracey-arm

kjbracey-arm Jun 14, 2019

Contributor

Yes.

I guess that as apndef is a file-scope variable, the compiler manages to figure out that no-one ever writes to it, so it can optimise it out, and treat it as a constant, even though it's not declared as such.

I'd still prefer to say what we actually need, rather than rely on the compiler being bright. If you don't need a pointer, don't declare one. Assuming non-automatic storage,

const char xx[] = "foo"; // 4 bytes of string in ROM

is better than

const char * const xx = "foo"; // 4 bytes of string in ROM, and a 4-byte pointer to it in ROM

is better than

const char *xx = "foo"; // 4 bytes of string in ROM, 4 bytes of pointer initialisation in ROM, 4 bytes of pointer in RAM

This comment has been minimized.

Copy link
@kivaisan

kivaisan Jun 14, 2019

Author Contributor

Fixed

@TommiTallgren

This comment has been minimized.

Copy link

commented Jun 13, 2019

This impact report was requested by @TommiTallgren - get yours at https://softagram.com/pull-request-bot
...

This report is added here just for the reference by our bot. There are 2 more and they are bacground information for the discussion with ARM to activate it for serving the community. Happy to hear your thoughts, more on how to read the report on here: http://help.softagram.com/articles/2847546-pull-merge-request-report-explained

@kivaisan kivaisan force-pushed the kivaisan:refactor_apn_db branch from 841173e to d689984 Jun 13, 2019
@adbridge adbridge added this to Needs Work in Test Jun 13, 2019
@adbridge adbridge moved this from Needs Work to Needs review in Test Jun 13, 2019
Reduce memory usage by moving actual APN database into single object file
instead of having it defined in header as a static.
@kivaisan kivaisan force-pushed the kivaisan:refactor_apn_db branch from d689984 to d7858f6 Jun 14, 2019
Test automation moved this from Needs review to Needs CI Jun 14, 2019
@adbridge adbridge added needs: CI and removed needs: review labels Jun 20, 2019
@adbridge

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2019

ci started

@mbed-ci

This comment has been minimized.

Copy link

commented Jun 21, 2019

Test run: FAILED

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

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-IAR
@0xc0170

This comment has been minimized.

Copy link
Member

commented Jun 24, 2019

Internal server error, will restart once RC4 is in

@0xc0170

This comment has been minimized.

Copy link
Member

commented Jun 24, 2019

CI restarted

@mbed-ci

This comment has been minimized.

Copy link

commented Jun 25, 2019

Test run: SUCCESS

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

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Jun 25, 2019
@0xc0170 0xc0170 merged commit 63d1ea3 into ARMmbed:master Jun 25, 2019
26 checks passed
26 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-ARM Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(-63965 bytes) RAM(-33358 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARM Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Success!
Details
travis-ci/docs Success!
Details
travis-ci/doxy-spellcheck Success!
Details
travis-ci/events Success! Runtime is 8674 cycles.
Details
travis-ci/gitattributestest Success!
Details
travis-ci/include_check Success!
Details
travis-ci/licence_check Success!
Details
travis-ci/littlefs Success! Code size is 8448B.
Details
travis-ci/psa-autogen Success!
Details
travis-ci/tools-py2.7 Success!
Details
travis-ci/tools-py3.5 Success!
Details
travis-ci/tools-py3.6 Success!
Details
travis-ci/tools-py3.7 Success!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Test
  
Needs CI
8 participants
You can’t perform that action at this time.