STR9 Flash pb, no restart after power cycle

damienhoyen wrote on Thursday, September 04, 2008:

Hi everybody,

I have some trouble to program my STR9 with my USB Olimix JTAG and OpenOCD (r717)

(dev board : E912 Olimex with STR912F44, JTAG : Olimex ARM-USB-OCD, i boot always from bank 0, bank1 is used for data only)

I have no problem for debug, everything works perfectly (including FreeRTOS :wink:

If I load an image, i can execute, do a reset and continue to use my device. But when i loose my power supply, the software CAN’T restart.

Is somebody who have successfully used OpenOCD - Olimex JTAG to burn a STR912 flash ?
Is somebody who have already experienced this kind of events.

Is it something wrong in my linker file ?

Any idea welcome.
Thanks in advance.

Damien

_HEAPSIZE = 40000;

MEMORY
{
    flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
    ram (rw)   : ORIGIN = 0x04000000, LENGTH = 96K
}

SECTIONS
{
    .text :
    {
        KEEP(*(.vectors))
        KEEP(*(.init))
        *(.text .text.*)
        *(.gnu.linkonce.t.*)
        *(.glue_7t .glue_7)
        KEEP(*(.fini))
        *(.gcc_except_table)
    } >flash =0
    . = ALIGN(4);

    /* .rodata section which is used for read-only data (constants) */

    .rodata :
    {
        *(.rodata .rodata.*)
        *(.gnu.linkonce.r.*)
    } >flash
    . = ALIGN(4);

    _etext = .;
    PROVIDE (etext = .);

    /* .data section which is used for initialized data */

    .data : AT (_etext)
    {
        __data_start = .;
        *(.data .data.*)
        *(.gnu.linkonce.d.*)
        . = ALIGN(4);
        *(.fastrun .fastrun.*)
    } >ram
    . = ALIGN(4);
   
    _edata = .;
    PROVIDE (edata = .);

    /* .bss section which is used for uninitialized data */

    .bss :
    {
        __bss_start = .;
        __bss_start__ = .;
        *(.bss .bss.*)
        *(.gnu.linkonce.b.*)
        *(COMMON)
        . = ALIGN(4);
    } >ram
    . = ALIGN(4);
    __bss_end__ = .;
   
    _end = .;
    PROVIDE(end = .);
   
    /*
    .heap (NOLOAD) :
    {
        __heap_start__ = .;
        _heap_start = .;
        *(.heap)
        . = MAX(__heap_start__ + _HEAPSIZE , .);
    } >ram
    __heap_end__     = __heap_start__ + SIZEOF(.heap);
    _heap_end         = __heap_start__ + SIZEOF(.heap);

*/

}
    . = ALIGN(32 / 8);
    _end = .;
    _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
    PROVIDE (end = .);

stf12 wrote on Thursday, September 04, 2008:

Hi Damien,

I had the same problem on STR912+Eclipse+OpenOCD. I use the same linker file, but I found that the problem was in the startup file - startup.s.

I added the following three code lines just before the _start assembly label:

---------------------------------------
.text
.arm
.section .init, "ax"

_start:
        ldr     pc, =NextInst
NextInst:
--------------------------------------

This solve my problem by placing the _start function in the right segment.

I hope this should help you.

Regards,
Stefano

damienhoyen wrote on Thursday, September 04, 2008:

Hi Stephano,

it’s clear, You have completely right…
Thank you very much for this help

Regards.