AnsweredAssumed Answered

STM32F215VGT split memory problem

Question asked by donev.georgi on Feb 21, 2013
Latest reply on Feb 21, 2013 by donev.georgi
Hi all, I’m working on a project using CrossWorks IDE Release 2.2.0.2012022100.14129, processor STM32F215VGT and ST-LINK/V2.I'm working on IAP (in application programing) and I needed a place where to put IAP functions. First I made two new memory segments FLASH_POINTERS and FLASH_CODE and placed them at the end of the Flash memory

</MemorySegment>
<MemorySegment size="0xFE000" access="ReadOnly" name="FLASH" start="0x08000000"/>
<MemorySegment name="FLASH_POINTERS" size="0x44" start="0x80FE000">
<ProgramSection name=".StaticPointers" alignment="0x4" inputsections="*(.StaticPointers)" load="Yes" size="0x44" start="0x80FE000"/>
</MemorySegment>
<MemorySegment name="FLASH_CODE" size="0x1fbc" start="0x80FE044">
<ProgramSection name=".StaticCode" size="0x1fbc" start="0x80FE044" inputsections="*(.StaticCode)" load="Yes" alignment="0x4"/>
</MemorySegment>

then I placed the IAP fuctions in these two memory segments: for example: DWORD StaticCode IAP_ERASEBYSECTOR(DWORD start_sector, DWORD end_sector) { ....}

After that I tried to start the application program and it works in both modes, Reselase and Debud.

But because the last segment of flash memory is 128KB, and I need only 8KB for FLASH_POINTERS and FLASH_POINTERS, I decided to move FLASH_POINTERS and FLASH_POINTERS in the first segment of memory which is only 16 KB. So I placed them in the first sector (Sector 0) and expand them to 16KB to occupy the whole sector.

<MemorySegment name="FLASH_POINTERS" size="0x88" access="ReadOnly" start="0x08000000">
<ProgramSection name=".StaticPointers" alignment="0x4" inputsections="*(.StaticPointers)" load="Yes" size="0x88" start="0x08000000"/>
</MemorySegment>
<MemorySegment name="FLASH_CODE" size="0x3F78" access="ReadOnly" start="0x08000088">
<ProgramSection name=".StaticCode" size="0x3F78" start="0x08000088" inputsections="*(.StaticCode)" load="Yes" alignment="0x4"/>
</MemorySegment>
<MemorySegment size="0xFC000" access="ReadOnly" name="FLASH" start="0x08004000"/>

Then I reallocated the vector table using Vector Table Offset Register: SCB->VTOR = FLASH_BASE | 0x4000; /* Vector Table Relocation in Internal FLASH */

Now the application program starts in Debug mode but when I program processor in Release, detach the JTAG and turn on the power supply, the application program doesn't start.
When I program processor in Release and without detaching  the JTAG, start program using CrossStudio, the program starts, but only if I start it(in Release) by CrossStudio.
Can somebody help, to solve the problem? Thanks!

Outcomes