cancel
Showing results for 
Search instead for 
Did you mean: 

How to run a program in sdram on STM32H743 ?

Bornason
Associate II

Hello guys, recently I designed a PCB board using STM32H743IIT6 and I encounter a problem when I try to run code in sdram. The details are described as below.

question:

I have a demand jumping to run a user program(function) in the sdram. But after I copy the user program(function) from norflash to sdram and move PC to run, I get hard fault exception.

I have no idea whether there is some special configuration before running code in sdram, but I have successfully run a user program in sdram on STM32F429 after a special remap as described in STM32F429 RM. After reading the STM32H743 RM, there is no special operation for running code in sdram. What I read is a remap description about sdram and no other comment.

0690X0000098FYaQAM.png

hardware part:

There is a sdram , a norflash and an eth on this board. I created the project with cubemx 5.2.1 and I have made the sdram ,norflash and eth works well.

software part:

There is a special operating system running on the flash of the mcu. The user program(function) is downloaded via the eth.

I am ensure the sdram and norflash work well and the user program is stored in the norflash with a crc check.

The start address of sdram is 0xC000 0000.

The start address of norflash is 0x6000 0000.

Thanks for reading and expect for your advice.

1 ACCEPTED SOLUTION

Accepted Solutions

The default mapping of SDRAM is in an area which is by default tagged as Execute Never (XN) in the MPU. Read PM0253 and the ARM Cortex-M7 Technical Reference Manual (from ARM).

0690X0000098G6SQAU.png

The remap is there to place one of the SDRAM banks onto an area which is by default not tagged as XN. Other option is to modify the default area of SDRAM in MPU so that it's not XN.

JW

View solution in original post

4 REPLIES 4

The default mapping of SDRAM is in an area which is by default tagged as Execute Never (XN) in the MPU. Read PM0253 and the ARM Cortex-M7 Technical Reference Manual (from ARM).

0690X0000098G6SQAU.png

The remap is there to place one of the SDRAM banks onto an area which is by default not tagged as XN. Other option is to modify the default area of SDRAM in MPU so that it's not XN.

JW

@Imen DAHMEN​  - this may be a documentation enhancement request - in the 'F7 and 'H7 reference manuals (but it wouldn't hurt to do it in *all* other families' manuals, too), both in the Memory and bus architecture and FMC chapters, please add a one-sentence comment with regard to executability and MPU, pointing to the respective chapters in Programmer Manual for the Cortex-M7-based products. Also, in the 'F7 and 'H7 manuals, where remap of FMC area(s) is there specifically to allow execution without changing the default MPU setting, please comment it so.

JW

thanks a lot. ​

Just now I modified the startup file and add a mpu configuration for 0xC000 000, then the user program can run. But it seems that the sdram(0xC000 0000) can not be read by byte(nothing can be read in byte),if the address is four bytes align, read operation is fine.

Now I am going to do the remap as you mentioned, Thanks.

I've tried the remap and it works too.But I encountered the same problem as running at 0xC000 0000 😅. Thanks a lot.=)