Added support for ARMv7-M in arm io.
[openocd.git] / contrib / loaders / flash / armv7m_io.s
blob3bd90ca642d4a12ae654d831c06430d2ce5060a1
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 ***************************************************************************/
21 .text
22 .syntax unified
23 .arch armv7-m
24 .thumb
25 .thumb_func
27 .align 4
29 /* Inputs:
30 * r0 buffer address
31 * r1 NAND data address (byte wide)
32 * r2 buffer length
34 read:
35 ldrb r3, [r1]
36 strb r3, [r0], #1
37 subs r2, r2, #1
38 bne read
40 done_read:
41 bkpt #0
43 .align 4
45 /* Inputs:
46 * r0 NAND data address (byte wide)
47 * r1 buffer address
48 * r2 buffer length
50 write:
51 ldrb r3, [r1], #1
52 strb r3, [r0]
53 subs r2, r2, #1
54 bne write
56 done_write:
57 bkpt #0
59 .end