Hi
I have a board with external RAM and I'm using it quite well, except that I wrote my own malloc and free, which works fine, but I rather use the malloc and free that comes with standard library, I know that wheel will be more reliable than the one I made. Where is the linker script? I'm using uVision4 IDE and Keil as my compiler. Basically I want to define heap in a different segment other than the internal RAM of the MCU. If you can post me an example that will much appreciated.
Thanks Alejandro
Uncheck "Use Memory Layout from Target Dialog" Create a scatter file. Edit the default one
; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; ************************************************************* LR_IROM1 0x08000000 0x00040000 { ; load region size_region ER_IROM1 0x08000000 0x00040000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00018000 { ; RW data .ANY (+RW +ZI) } RW_IRAM2 0x20018000 0x00008000 { ; Secondary Memory startup_xxx.o (HEAP) ; Object/Section directive, park HEAP in here } }
startup_xxx.s, shouldn't need to change
.. ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit ..
Thanks much
This is my file, it worked great!!!
; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; *************************************************************
LR_IROM1 0x08000000 0x00100000 { ; load region size_region ER_IROM1 0x08000000 0x00100000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00020000 { ; RW data .ANY (+RW +ZI) } ; External RAM ; Used for mallocs, mainly for the file system/nand media driver RW_RAM1 0x60000000 0x00200000 { ; Secondary Memory .ANY (HEAP) ; Object/Section directive, park HEAP in here } }
Sorry about the formatting, fixed showing correct below.
; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; ************************************************************* LR_IROM1 0x08000000 0x00100000 { ; load region size_region ER_IROM1 0x08000000 0x00100000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00020000 { ; RW data .ANY (+RW +ZI) } ; External RAM ; Used for mallocs, mainly for the file system/nand media driver RW_RAM1 0x60000000 0x00200000 { ; Secondary Memory .ANY (HEAP) ; Object/Section directive, park HEAP in here } }