cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F215VGT split memory problem

donev_g
Associate II
Posted on February 21, 2013 at 08:17

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!
4 REPLIES 4
frankmeyer9
Associate II
Posted on February 21, 2013 at 11:17

A long and detailed description of your problem...

But I guess the reason is something different. For ease of debugging (i.e. catching faulty code when starting up with a debug pod) Rowley uses by default a endless loop to catch the debugger in the startup code.

If you are confident it works, add the define STARTUP_FROM_RESET to your project settings. This skips this loop.

See here:

https://rowley.zendesk.com/entries/50337-Application-not-starting-up-from-reset

donev_g
Associate II
Posted on February 21, 2013 at 11:55

Thanks fm! I forgot to say that there is definition STARTUP_FROM_RESET in Release configuration. From your link https://rowley.zendesk.com/entries/50337-Application-not-starting-up-from-reset I tried this: ''If you don't think the cause is any of the above then you can see what the CPU is doing by carrying out the following actions:

Manually power-cycle or reset the target.

Attach the debugger by selecing Target > Attach Debugger.

Break the execution by selecting Debug > Break. The debugger should locate to the current instruction being executed. ''

and saw that the processor goes to ISR_HANDLER HardFault_Handler, please see the attach file.

Before I move the sectors FLASH_POINTERS and FLASH_CODE at the end of the flash memory the program started in Release, without using CrossStudio. I suppose that except Vector Table Relocation some additional setting have to be done, but I have to idea what.

________________

Attachments :

error.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0pp&d=%2Fa%2F0X0000000beE%2FEwsOYmg39KW5YvPjM5EY90lp3CDErqxJyv6t.baM8Xw&asPdf=false
frankmeyer9
Associate II
Posted on February 21, 2013 at 12:15

Ah, ok.

By the way, here are several helpful forum threads in regard to investigate a HardFault and the associated stack frame. They mostly point to Joseph Yiu's code from his ''Definitive Guide to the ARM Cortex Mx'' book.

At least before the last recent website update ...

donev_g
Associate II
Posted on February 21, 2013 at 13:05

Ok, Thanks fm!