This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to execute from SDRAM due to incorrect MPU Settings

Hi,

what should be the settings for MPU if I want to execute code from Internal Flash and external SDRAM in my target

configuration?

Target Map for your reference is as follows,

Internal Flash -> 0x0
External SDRAM -> 0xA1000000

More details:
1. I have modified the scatter file to create two load regions, One LR for Internal flash starting at 0x0 and another LR for external SDRAM starting at 0xA100000

2. I am using emWin graphics library wherein emWin display buffer is using SDRAM memory starting from 0xA0000000

3. I have created two binaries(as there are two load regions) from final .axf file and I have dumped one binary in Internal flash and the other in external SDRAM through a PC utility and a secondary boot loader in my firmware

4. I can see the code in SDRAM during DEBUG mode, but as soon as the control reaches 0xA1000000, the next step lands me in HARDFAULT HANDLER.

I think, the MPU settings are incorrect. If anyone has gone through this ordeal, please point a link or any suggestions would be appreciated.

An HAL

Parents Reply Children
  • Hello,
    During the debug session, I have checked the Memory Protection Unit window through Peripherals window.

    I have configured MPU with a single region of 4GB space, as Region 0.
    It showed following settings on the Memory Protection Unit window :

    n = 0,
    EN = 1,
    ADDR = 0x00000000,
    SIZE = 4G,
    SRD = 0xFF,
    B = 1,
    C = 1,
    S = 1,
    TEX = 000B,
    AP = P: R/W, U: R/W
    XN = 0,
    MPU Control : 0x00000007, ENABLE = set, HFNMIENA = set, PRIVDEFENA = set.