2011-09-16 08:55:54 -05:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2010 by Spencer Oliver *
|
|
|
|
* spen@spen-soft.co.uk *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2011 Øyvind Harboe *
|
|
|
|
* oyvind.harboe@zylin.com *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2011 Clement Burin des Roziers *
|
|
|
|
* clement.burin-des-roziers@hikob.com *
|
|
|
|
* *
|
2017-03-02 10:31:14 -06:00
|
|
|
* Copyright (C) 2017 Armin van der Togt *
|
|
|
|
* armin@otheruse.nl *
|
|
|
|
* *
|
2011-09-16 08:55:54 -05:00
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
2013-06-02 14:32:36 -05:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
|
2011-09-16 08:55:54 -05:00
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
// Build : arm-eabi-gcc -c stm32lx.S
|
|
|
|
.text
|
|
|
|
.syntax unified
|
2017-03-02 10:31:14 -06:00
|
|
|
.cpu cortex-m0
|
2011-09-16 08:55:54 -05:00
|
|
|
.thumb
|
|
|
|
.thumb_func
|
|
|
|
.global write
|
|
|
|
|
|
|
|
/*
|
|
|
|
r0 - destination address
|
|
|
|
r1 - source address
|
|
|
|
r2 - count
|
|
|
|
*/
|
|
|
|
|
2017-03-02 10:31:14 -06:00
|
|
|
// r2 = source + count * 4
|
|
|
|
lsls r2, r2, #2
|
|
|
|
adds r2, r1, r2
|
2011-09-16 08:55:54 -05:00
|
|
|
// Go to compare
|
2017-03-02 10:31:14 -06:00
|
|
|
b test_done
|
2011-09-16 08:55:54 -05:00
|
|
|
write_word:
|
2017-03-02 10:31:14 -06:00
|
|
|
// load word from address in r1 and increase r1 by 4
|
|
|
|
ldmia r1!, {r3}
|
|
|
|
// store word to address in r0 and increase r0 by 4
|
|
|
|
stmia r0!, {r3}
|
2011-09-16 08:55:54 -05:00
|
|
|
test_done:
|
2017-03-02 10:31:14 -06:00
|
|
|
// compare r1 and r2
|
|
|
|
cmp r1, r2
|
|
|
|
// loop if not equal
|
|
|
|
bne write_word
|
2011-09-16 08:55:54 -05:00
|
|
|
|
|
|
|
// Set breakpoint to exit
|
|
|
|
bkpt #0x00
|
|
|
|
|