Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Address Discrepances between Debugging and nrfjprog memrd

Introduction

I use fStorage to write some data to flash and I read the data by following procedure:

    uint32_t Read32(uint32_t address)
    {
        return *(mpFlashConfig->p_start_addr + address);
    }

All seamed working correctly. But then I tried to read some addresses with nrfjprog and I only go zeros.

Analysis

I have two data section with each one page and according debugger (Visual Studio, VisualGDB, GCC 7.2.0)

  • Section A
    • mpFlashConfig->p_start_addr = 0x6'8000
    • address = 0x4c00
    • sum = 0x6'cc00
  • Section B
    • mpFlashConfig->p_start_addr = 0x6'8000
    • address = 0x5000
    • sum = 0x6'cc00

When I search memory with nrfjprog memrd, then I find the test words (written in page start address) in following addresses:

  • Section A: 0x7'B000
  • Section B: 0x7'C000

Obviously, these addresses do not match. As far as I know, the nrfjprog uses Byte-Addresses. 0x4c00 must be a word address because bytes-size of page is 0x1000 (4096). p_start_addr is an uint32_t const pointer, so far I suppose it is also a word address. Muliplying the sum of both together is still a different address than detected by nrfjprog.

Do you have any idea, what fails here?

Versions and Tools

I use Softdevice S132 v3.0.0 and SDK v12.3.

The code is executed on nRF52823_CIAA with 512 kB Flash.

Further, nrfjprog 9.7.1 is used.

Related