This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52832: Disable executable RAM?

We're using the nRF52832 and want to trap if various parts of RAM are ever executed. We'd like to restrict as much as possible. We run nRF SDK 14.0.0 and SD132v5.

Seeing that SoftDevice claims ownership of the MWU, what's the recommended way to trap when code runs in our application's RAM?

Thanks,

Charles

Parents
  • Hi,

    I am afraid that you have few options since the MWU cannot be used when the SoftDevice is enabled. While access to the MWU peripheral is not enforced per se, it is still used by the SoftDevice and so trying to use it from the application may lead to undefined behavior. I do not know if it is even possible. If you try to figure out what regions are not used by the SoftDevice (if any) and try to use them then I cannot give any guarantees as to how it will work or what will happen if you update to a different SoftDevice.

    Regarding stack overflow you can figure out what is the worst case stack usage of your application through testing, by reading the memory of the device and see where the stack has grown (i.e. non-0xFF region.) Or by code analysis.

    You can find maximum call stack usage for the SoftDevice in the SoftDevice release notes. (For s132 it has not been written in the release notes for the most recent releases, but it has been unchanged at 0x05f4 bytes since 5.0.0-3.alpha. I have asked for getting it back into the release notes for future releases, even if it does not change.)

    Regards,
    Terje

Reply
  • Hi,

    I am afraid that you have few options since the MWU cannot be used when the SoftDevice is enabled. While access to the MWU peripheral is not enforced per se, it is still used by the SoftDevice and so trying to use it from the application may lead to undefined behavior. I do not know if it is even possible. If you try to figure out what regions are not used by the SoftDevice (if any) and try to use them then I cannot give any guarantees as to how it will work or what will happen if you update to a different SoftDevice.

    Regarding stack overflow you can figure out what is the worst case stack usage of your application through testing, by reading the memory of the device and see where the stack has grown (i.e. non-0xFF region.) Or by code analysis.

    You can find maximum call stack usage for the SoftDevice in the SoftDevice release notes. (For s132 it has not been written in the release notes for the most recent releases, but it has been unchanged at 0x05f4 bytes since 5.0.0-3.alpha. I have asked for getting it back into the release notes for future releases, even if it does not change.)

    Regards,
    Terje

Children
Related