Added support for ARMv7-M in arm io.
[openocd.git] / contrib / loaders / flash / armv7m_io.s
1 /***************************************************************************
2  *   Copyright (C) 2013 by Henrik Nilsson                                  *
3  *   henrik.nilsson@bytequest.se                                           *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21         .text
22         .syntax unified
23         .arch armv7-m
24         .thumb
25         .thumb_func
26
27         .align 4
28
29 /* Inputs:
30  *  r0  buffer address
31  *  r1  NAND data address (byte wide)
32  *  r2  buffer length
33  */
34 read:
35         ldrb    r3, [r1]
36         strb    r3, [r0], #1
37         subs    r2, r2, #1
38         bne             read
39
40 done_read:
41         bkpt #0
42
43         .align 4
44
45 /* Inputs:
46  *  r0  NAND data address (byte wide)
47  *  r1  buffer address
48  *  r2  buffer length
49  */
50 write:
51         ldrb    r3, [r1], #1
52         strb    r3, [r0]
53         subs    r2, r2, #1
54         bne             write
55
56 done_write:
57         bkpt #0
58
59         .end
60