2015-08-24 04:51 AM
Hi all,
I have a question about the different memory sections. I use a modified version of the demonstration project.There are 4 memory sections:SRAMSDRAMFlashNOR (QSPI)This code save the variable to NOR:#if defined ( __ICCARM__ ) #pragma location=''ExtQSPIFlashSection''#else __attribute__((section(''.ExtQSPIFlashSection'')))#endifSo now my Questions. 1) How do i know where everything else is stored? I think const variables are stored in Flash and everything else in SRAM. But the SRAM-HAL-Header isn't used in this project. So my variables are stored in SDRAM?2) And what happen if i create a new variable with malloc?3) There is a function to get the free size of memory?Thanks everyone!For ST:I have 2 wishes for a new Rev. of the STM32F7 DISCO.- place a empty (header-) connection with a solder bridge to connect a battery for the RTC- some more empty connections for another ADC (now i can only use ADC 3 over Arduino Pins)But it's still a great board!2016-11-24 03:28 AM
Finally I get it working. It was realy easy with the help of the new ''Mastering the FreeRTOS Real Time Kernel - A Hands-On Tutorial Guide''.
I don't need to change anything in the startup- or linker-files. Here is what you need to change:Step 1: File: LCDconf.cChange the following two lines:#define LCD_LAYER0_FRAME_BUFFER ((int)0xC0200000)#define LCD_LAYER1_FRAME_BUFFER ((int)0xC0400000)to:#define LCD_LAYER0_FRAME_BUFFER ((int)0xC0000000)#define LCD_LAYER1_FRAME_BUFFER ((int)0xC0200000)This moves the framebuffer to the first 4 MB of the SDRAM.Step 2:File: main.cAdd these two defines:#define SDRAM_HEAP_START_ADDRESS ((uint8_t *) 0x0xC0400000)#define SDRAM_HEAP_SIZE (4 * 1024 * 1024) // Size is 4 MBThe ucHeap should defined in a normal way or in an extra RAM-section like in the demonstration project:uint8_t ucHeap[configTOTAL_HEAP_SIZE];or (e.g.):uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__((section(''.Heap'')));Now you need to define the heap sections:const HeapRegion_t xHeapRegions[] ={ { ucHeap, configTOTAL_HEAP_SIZE }, { SDRAM_HEAP_START_ADDRESS, SDRAM_HEAP_SIZE }, { NULL, 0 } // end mark};In your main-function you should initialize the MPU,Cache,HAL,SysCLK first:(The next example use function names from the domenstartion project)int main(void) { MPU_Config(); CPU_CACHE_Enable(); HAL_Init(); SystemClock_Config(); k_BspInit(); // SDRAM is initialized here vPortDefineHeapRegions(xHeapRegions); // Tell FreeRTOS which memory to use for the Heap // now any user code or FreeRTOS-related code can start}Step 3:Use heap_5.c from the FreeRTOS!Finished!Everything will work fine.The Linker will check if the Heap fits inside the RAM, but the Linker just use the size which is defined with configTOTAL_HEAP_SIZE. If the heap is getting to large (maybe from malloc()) the FreeRTOS will use the next section which is placed in SDRAM.I tested pvPortMalloc(), arithmetic operations, string-functions and pointer arithmetic. Everything is okay.I hope this will help someone :)