We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi On projects that have different data memory regions - how do you force the stack and heap into a specific region.
I am using the STM32F4xxx and there are two (default)memory regions IRAM1 and IRAM2. In the asm startup file there is:
Stack_Size EQU 0x00004000 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp Heap_Size EQU 0x00008000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB
By default the linker is putting the stack and heap in IRAM2 and I want it in IRAM1. Not really clued up on the assembler directives. :(
While on the subject of allocation - I have tried various combinations to get 2x __attribute directives into 1X statement but the only way I can get it to work is with 2x:
SerialChannel_Typedef __attribute__((aligned)) sSerialCh1; sSerialChannel_Typedef __attribute__((section("IRAM1"))) sSerialCh1; // This works // I tried this SerialChannel_Typedef __attribute__((aligned)(section("IRAM1")))) sSerialCh1; // and this SerialChannel_Typedef __attribute__((aligned))((section("IRAM1"))) sSerialCh1; // both don't work - compiler gives errors
Any ideas?
Thanks Peter
Perhaps this article might be helpful for you:
http://www.keil.com/support/docs/3480.htm
I needed quite a time to figure out, how to use uninitialized data in C++ for STM32F4 - there are some "misguiding" articles in Internet - but the above works perfect.
... so I handled only uninitialized static global memory data - but not stack data or dynamic alloc data - but maybe it is a help for you anyway ...