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

Comparing big array in Segger embedded studio in release mode cause the issue

I see two different issue from Segger ES. The below piece of code work well in debug mode, comparison of array at 2k and it fails at release mode.
Wondering what's happening?

//2kb
static uint8_t m_buffer_tx[2048]; static uint8_t m_buffer_rx[2048];
 //this always fails in Segger ES release mode but becomes true in Debug mode.
if (memcmp(m_buffer_tx, m_buffer_rx, 2048) == 0) {
NRF_LOG_INFO("Data consistent");
}

if I change the buffer size compariosn to 512 I can see memcmpr passes. I am using Arm coterx-M4 its 32bit. I presume 2kb is not much of stack that i am comapring?
Related