HI all,

I try my best to get the asm file work with the M0. I have modified the
stm32f2x.S becaus eit look simpler than the on from the stm32f1x.S

Here how it's look. 

// Build : arm-eabi-gcc -c stm32f2xxx.S
        .text
        .syntax unified
        .cpu cortex-m0
        .thumb
        .thumb_func
        .global write

/*
        r0 - source address
        r1 - target address
        r2 - count (halfword-16bit)
        r3 - result out
        r4 - flash base
*/

#define STM32_FLASH_CR_OFFSET   0x10                    /* offset of CR
register in FLASH struct */
#define STM32_FLASH_SR_OFFSET   0x0c                    /* offset of CR
register in FLASH struct */

write:

write_half_word:
        ldr             r3, STM32_PG
        str             r3, [r4, #STM32_FLASH_CR_OFFSET]
        ldrh    r3, [r0]
/* read one half-word from src */
        strh    r3, [r1]
/* write one half-word from src*/
        adds            r0, r0, #2
/*  increment ptr */
        adds            r1, r1, #2
/*  increment ptr  */
busy:
        ldrb    r3, [r4, #STM32_FLASH_SR_OFFSET]
        cmp             r3, #0x1
/* BSY (bit0) == 1 => operation in progress */
        beq     busy
/* wait more... */
        cmp             r3, #0x24
/* PGPERR | WRPERR */
        beq             exit
/* fail... */
        subs    r2, r2, #0x01                                           /*
decrement counter */
        bne             write_half_word
/* write next half-word if anything left */
exit:
        bkpt    #0x00


STM32_PG: .word 0x001                                                   /*
PG */

Is it possible to have a small review on this. I'm really poor in assembly
language !

Regards

Jonathan


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to