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

Reduce ram origin #52

Merged
merged 3 commits into from
Feb 12, 2021
Merged

Conversation

martinwork
Copy link
Collaborator

This includes #51.

The ORIGIN value is the minimum required with the settings in microbit-foundation/codal-microbit-nrf5sdk#12.

@finneyj
Copy link
Contributor

finneyj commented Feb 12, 2021

Thanks @martinwork.

Can you just briefly give rationale here? It looks like we've slightly increased the GATT table size, but significantly reduced the RAM origin? How is it that we're reclaiming a lot of memory from the GATT table region, yet also apparently increasing the GATT table size?

Is this is throwback from when we switched to a different version of soft device? or are we configuring a smaller GATT table somewhere?

@martinwork
Copy link
Collaborator Author

Yes, it's because I forgot to minimise the RAM ORIGIN when we switched to S113, otherwise it would need to be increased again to allow for https://github.com/microbit-foundation/codal-microbit-nrf5sdk/pull/12/files, as it would if we were still using S140.

Add the definitions below to get the SDK to DMESG the ORIGIN/RAM start possible after softdevice's share. e.g.:
nrf_sdh_ble: RAM starts at 0x20002440
nrf_sdh_ble: RAM start location can be adjusted to 0x20001F60.
nrf_sdh_ble: RAM size for application can be adjusted to 0x1E0A0.

softdevice's RAM requirement are affected by NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE and NRF_SDH_BLE_VS_UUID_COUNT:
https://github.com/microbit-foundation/codal-microbit-nrf5sdk/blob/master/sdk_config/sdk_config.h#L4540

Settings for codal.json to report RAM usage in
https://github.com/microbit-foundation/codal-microbit-nrf5sdk/blob/master/nRF5SDK/components/softdevice/common/nrf_sdh_ble.c#L229

        "DEVICE_DMESG_BUFFER_SIZE":2048,
        "DMESG_SERIAL_DEBUG":1,

        "MICROBIT_DMESG_LEVEL" : 0,

        "NRF_LOG_BACKEND_DMESG_ENABLED" : 1,
        "NRF_LOG_BACKEND_DMESG_FLUSH" : 1,

        "NRF_LOG_ENABLED" : 1,
        "NRF_LOG_DEFERRED" : 0,
        "NRF_LOG_DEFAULT_LEVEL": 4,
        
        "NRF_SDH_BLE_LOG_ENABLED": 1,
        "NRF_SDH_BLE_LOG_LEVEL": 4

Other SDK debug settings:

        "NRF_SDH_LOG_ENABLED": 1,
        "NRF_SDH_LOG_LEVEL": 4,

        "NRF_SDH_SOC_LOG_ENABLED": 1,
        "NRF_SDH_SOC_LOG_LEVEL": 4,

        "PM_LOG_ENABLED": 1,
        "PM_LOG_LEVEL": 4,

        "NRF_PWR_MGMT_CONFIG_LOG_ENABLED": 1,
        "NRF_PWR_MGMT_CONFIG_LOG_LEVEL": 4

@finneyj
Copy link
Contributor

finneyj commented Feb 12, 2021

OK - thanks @martinwork!

I trust your analysis, just wanted to check the rationale.
No-one would thank you for creating an unstable BSS/HEAP region . :)

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

Successfully merging this pull request may close these issues.

2 participants