cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 can I join SRAM and SRAM2 memories?

JBond.1
Senior

Hi, I have STM32F407VET6 which has such memory layout.
0693W00000YA0E4QAL.png

Can I join SRAM (0x2000 0000 - 0x2001 BFFF) and SRAM2 (0x2001 C000 - 0x2001 FFFF) memories to one?
0693W00000Y8qzIQAR.png
Or do I must to manage them separately?
0693W00000Y8qzDQAR.png

1 ACCEPTED SOLUTION

Accepted Solutions

I've just tried unaligned writes and reads across the 0x2001C000 boundary on an STM32F407, and it works as expected.

In other words, you can fully treat the two SRAMs as one.

JW

View solution in original post

5 REPLIES 5

> Can I join SRAM (0x2000 0000 - 0x2001 BFFF) and SRAM2 (0x2001 C000 - 0x2001 FFFF) memories to one?

Yes.

JW

 

Just to be more specific: there wont be any issues/errors if the same object or DMA buffer overlaps combined SRAM and SRAM2?

This area on the F2/F4 parts can be described to linker as a single linear region of 128KB in size.

As I recall there was perhaps a usage as a USB related buffer for the upper 16KB

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

> there wont be any issues/errors if the same object or DMA buffer overlaps combined SRAM and SRAM2?

Maybe unaligned access from processor across the boundary would be problematic, so avoid using unaligned objects (packed structs or data accessed through type punning) at that area. DMA can't make unaligned accesses.

The reason why are there two separate SRAM areas is, that two busmasters (processor, DMA, OTG_HS, ETH) can access the two separate memories at the same time with no timing penalty. Only in very extreme cases would this make noticeable difference.

JW

 

I've just tried unaligned writes and reads across the 0x2001C000 boundary on an STM32F407, and it works as expected.

In other words, you can fully treat the two SRAMs as one.

JW