cancel
Showing results for 
Search instead for 
Did you mean: 

Declaring variables in SRAM1-3 areas of H7 devices in STM32CubeIDE

MikeDB
Lead

I've searched in all the obvious places but can't find any directive to tell the compiler to place some large arrays I have in the SRAM1, SRAM2 and SRAM3 memory segments. As these are not contiguous with the AXI memory I would assume I need to place arrays there manually.

Any hints most welcome.

11 REPLIES 11

Actually a makefile approach sounds possible - I'll give it some thought. For now I've just declared all the small variables as members of a struct and allocated that to one of the SRAMs, but moving the stack to DTCM memory (where surely it should belong by default ?) without modifying the linker file seems to be impossible.

I originally looked at actually compiling and linking on the H750s themselves - they are each more powerful than early 1990s PCs we happily did this on all the time - but can't seem to find a suitable base to start with.

Garnett.Robert
Senior III

So,

ST Make chips with a large number of memory segments then forget to tell the people they have working on STM32CubeIDE that they need to provide a reasonable way to allocate the heap, stack, DMA buffers etc to the available memory blocks. So C/C++ programmers don't have to play around with internal files like the linker script. There seems to be some notion that you can't be a real C programmer unless you understand all the intricate details of the compilation process. If everyone needs to understand all the details of the compilers why have an IDE at all? Surely Notepad++ would suffice. All of the make files, linker scripts and the rest of it could all be created using notepad.

Given enough time we could all learn this stuff, but that's time we aren't producing useful custom code.

Keil uVision uses scatter files. A bit tedious, but available from, within the IDE, and quite simple and very flexible.