aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/loaders/erase_check/Makefile2
-rw-r--r--contrib/loaders/erase_check/armv7m_0_erase_check.inc2
-rw-r--r--contrib/loaders/erase_check/armv7m_0_erase_check.s45
-rw-r--r--contrib/loaders/erase_check/armv7m_erase_check.inc4
-rw-r--r--contrib/loaders/erase_check/armv7m_erase_check.s53
-rw-r--r--contrib/loaders/flash/stm32/Makefile28
-rw-r--r--contrib/loaders/flash/stm32/stm32f1x.S (renamed from contrib/loaders/flash/stm32f1x.S)10
-rw-r--r--contrib/loaders/flash/stm32/stm32f1x.inc5
-rw-r--r--contrib/loaders/flash/stm32/stm32f2x.S (renamed from contrib/loaders/flash/stm32f2x.S)15
-rw-r--r--contrib/loaders/flash/stm32/stm32f2x.inc6
-rw-r--r--contrib/loaders/flash/stm32/stm32h7x.S (renamed from contrib/loaders/flash/stm32h7x.S)25
-rw-r--r--contrib/loaders/flash/stm32/stm32h7x.inc7
-rw-r--r--contrib/loaders/flash/stm32/stm32l4x.S (renamed from contrib/loaders/flash/stm32l4x.S)24
-rw-r--r--contrib/loaders/flash/stm32/stm32l4x.inc7
-rw-r--r--contrib/loaders/flash/stm32/stm32lx.S (renamed from contrib/loaders/flash/stm32lx.S)11
-rw-r--r--contrib/loaders/flash/stm32/stm32lx.inc2
16 files changed, 124 insertions, 122 deletions
diff --git a/contrib/loaders/erase_check/Makefile b/contrib/loaders/erase_check/Makefile
index 427fa0c..1a0fd9e 100644
--- a/contrib/loaders/erase_check/Makefile
+++ b/contrib/loaders/erase_check/Makefile
@@ -12,7 +12,7 @@ STM8_OBJCOPY ?= $(STM8_CROSS_COMPILE)objcopy
STM8_AFLAGS =
-arm: armv4_5_erase_check.inc armv7m_erase_check.inc armv7m_0_erase_check.inc
+arm: armv4_5_erase_check.inc armv7m_erase_check.inc
armv4_5_%.elf: armv4_5_%.s
$(ARM_AS) $(ARM_AFLAGS) $< -o $@
diff --git a/contrib/loaders/erase_check/armv7m_0_erase_check.inc b/contrib/loaders/erase_check/armv7m_0_erase_check.inc
deleted file mode 100644
index 76115ec..0000000
--- a/contrib/loaders/erase_check/armv7m_0_erase_check.inc
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Autogenerated with ../../../src/helper/bin2char.sh */
-0x03,0x78,0x01,0x30,0x1a,0x43,0x01,0x39,0xfa,0xd1,0x00,0xbe,
diff --git a/contrib/loaders/erase_check/armv7m_0_erase_check.s b/contrib/loaders/erase_check/armv7m_0_erase_check.s
deleted file mode 100644
index 6b1e92a..0000000
--- a/contrib/loaders/erase_check/armv7m_0_erase_check.s
+++ /dev/null
@@ -1,45 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2014 by Jeff Ciesielski *
- * jeffciesielski@gmail.com *
- * *
- * Based on the armv7m erase checker by: *
- * Copyright (C) 2010 by Spencer Oliver *
- * spen@spen-soft.co.uk *
- * *
- * 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. *
- * *
- ***************************************************************************/
-
-/*
- parameters:
- r0 - address in
- r1 - byte count
- r2 - mask - result out
-*/
-
- .text
- .syntax unified
- .cpu cortex-m0
- .thumb
- .thumb_func
-
- .align 2
-
-loop:
- ldrb r3, [r0]
- adds r0, #1
- orrs r2, r2, r3
- subs r1, r1, #1
- bne loop
-end:
- bkpt #0
-
- .end
diff --git a/contrib/loaders/erase_check/armv7m_erase_check.inc b/contrib/loaders/erase_check/armv7m_erase_check.inc
index 1fe25cd..4ee96e1 100644
--- a/contrib/loaders/erase_check/armv7m_erase_check.inc
+++ b/contrib/loaders/erase_check/armv7m_erase_check.inc
@@ -1,2 +1,4 @@
/* Autogenerated with ../../../src/helper/bin2char.sh */
-0x03,0x78,0x01,0x30,0x1a,0x40,0x01,0x39,0xfa,0xd1,0x00,0xbe,
+0x02,0x68,0x12,0x42,0x0d,0xd0,0x43,0x68,0x1c,0x68,0x04,0x33,0x8c,0x42,0x05,0xd1,
+0x01,0x3a,0xf9,0xd1,0x01,0x24,0x04,0x60,0x08,0x30,0xf1,0xe7,0x00,0x24,0xfa,0xe7,
+0x00,0x00,0x00,0xbe,
diff --git a/contrib/loaders/erase_check/armv7m_erase_check.s b/contrib/loaders/erase_check/armv7m_erase_check.s
index 886e3e2..163fa8c 100644
--- a/contrib/loaders/erase_check/armv7m_erase_check.s
+++ b/contrib/loaders/erase_check/armv7m_erase_check.s
@@ -11,18 +11,12 @@
* 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., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
/*
parameters:
- r0 - address in
- r1 - byte count
- r2 - mask - result out
+ r0 - pointer to struct { uint32_t size_in_result_out, uint32_t addr }
+ r1 - value to check
*/
.text
@@ -33,13 +27,42 @@
.align 2
-loop:
- ldrb r3, [r0]
- adds r0, #1
- ands r2, r2, r3
- subs r1, r1, #1
- bne loop
-end:
+BLOCK_SIZE_RESULT = 0
+BLOCK_ADDRESS = 4
+SIZEOF_STRUCT_BLOCK = 8
+
+start:
+block_loop:
+ ldr r2, [r0, #BLOCK_SIZE_RESULT] /* get size */
+ tst r2, r2
+ beq done
+
+ ldr r3, [r0, #BLOCK_ADDRESS] /* get address */
+
+word_loop:
+ ldr r4, [r3] /* read word */
+ adds r3, #4
+
+ cmp r4, r1
+ bne not_erased
+
+ subs r2, #1
+ bne word_loop
+
+ movs r4, #1 /* block is erased */
+save_result:
+ str r4, [r0, #BLOCK_SIZE_RESULT]
+ adds r0, #SIZEOF_STRUCT_BLOCK
+ b block_loop
+
+not_erased:
+ movs r4, #0
+ b save_result
+
+/* Avoid padding at .text segment end. Otherwise exit point check fails. */
+ .skip ( . - start + 2) & 2, 0
+
+done:
bkpt #0
.end
diff --git a/contrib/loaders/flash/stm32/Makefile b/contrib/loaders/flash/stm32/Makefile
new file mode 100644
index 0000000..b58b412
--- /dev/null
+++ b/contrib/loaders/flash/stm32/Makefile
@@ -0,0 +1,28 @@
+BIN2C = ../../../../src/helper/bin2char.sh
+
+CROSS_COMPILE ?= arm-none-eabi-
+
+CC=$(CROSS_COMPILE)gcc
+OBJCOPY=$(CROSS_COMPILE)objcopy
+OBJDUMP=$(CROSS_COMPILE)objdump
+
+CFLAGS = -static -nostartfiles -mlittle-endian -Wa,-EL
+
+all: stm32f1x.inc stm32f2x.inc stm32h7x.inc stm32l4x.inc stm32lx.inc
+
+.PHONY: clean
+
+%.elf: %.S
+ $(CC) $(CFLAGS) $< -o $@
+
+%.lst: %.elf
+ $(OBJDUMP) -S $< > $@
+
+%.bin: %.elf
+ $(OBJCOPY) -Obinary $< $@
+
+%.inc: %.bin
+ $(BIN2C) < $< > $@
+
+clean:
+ -rm -f *.elf *.lst *.bin *.inc
diff --git a/contrib/loaders/flash/stm32f1x.S b/contrib/loaders/flash/stm32/stm32f1x.S
index 5ce463d..a1c4135 100644
--- a/contrib/loaders/flash/stm32f1x.S
+++ b/contrib/loaders/flash/stm32/stm32f1x.S
@@ -11,19 +11,12 @@
* 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., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
.text
.syntax unified
.cpu cortex-m0
.thumb
- .thumb_func
- .global write
/* Params:
* r0 - flash base (in), status (out)
@@ -39,6 +32,9 @@
#define STM32_FLASH_SR_OFFSET 0x0c /* offset of SR register from flash reg base */
+ .thumb_func
+ .global _start
+_start:
wait_fifo:
ldr r6, [r2, #0] /* read wp */
cmp r6, #0 /* abort if wp == 0 */
diff --git a/contrib/loaders/flash/stm32/stm32f1x.inc b/contrib/loaders/flash/stm32/stm32f1x.inc
new file mode 100644
index 0000000..7f9454b
--- /dev/null
+++ b/contrib/loaders/flash/stm32/stm32f1x.inc
@@ -0,0 +1,5 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0x16,0x68,0x00,0x2e,0x18,0xd0,0x55,0x68,0xb5,0x42,0xf9,0xd0,0x2e,0x88,0x26,0x80,
+0x02,0x35,0x02,0x34,0xc6,0x68,0x01,0x27,0x3e,0x42,0xfb,0xd1,0x14,0x27,0x3e,0x42,
+0x08,0xd1,0x9d,0x42,0x01,0xd3,0x15,0x46,0x08,0x35,0x55,0x60,0x01,0x39,0x00,0x29,
+0x02,0xd0,0xe5,0xe7,0x00,0x20,0x50,0x60,0x30,0x46,0x00,0xbe,
diff --git a/contrib/loaders/flash/stm32f2x.S b/contrib/loaders/flash/stm32/stm32f2x.S
index 0dd1223..8caf5ba 100644
--- a/contrib/loaders/flash/stm32f2x.S
+++ b/contrib/loaders/flash/stm32/stm32f2x.S
@@ -14,18 +14,12 @@
* 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., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
.text
.syntax unified
.cpu cortex-m3
.thumb
- .thumb_func
/*
* Params :
@@ -44,6 +38,11 @@
#define STM32_FLASH_CR_OFFSET 0x10 /* offset of CR register in FLASH struct */
#define STM32_FLASH_SR_OFFSET 0x0c /* offset of SR register in FLASH struct */
+#define STM32_PROG16 0x101 /* PG | PSIZE_16*/
+
+ .thumb_func
+ .global _start
+_start:
wait_fifo:
ldr r8, [r0, #0] /* read wp */
cmp r8, #0 /* abort if wp == 0 */
@@ -52,7 +51,7 @@ wait_fifo:
cmp r7, r8 /* wait until rp != wp */
beq wait_fifo
- ldr r6, STM32_PROG16
+ ldr r6, =STM32_PROG16
str r6, [r4, #STM32_FLASH_CR_OFFSET]
ldrh r6, [r7], #0x02 /* read one half-word from src, increment ptr */
strh r6, [r2], #0x02 /* write one half-word from src, increment ptr */
@@ -78,4 +77,4 @@ exit:
mov r0, r6 /* return status in r0 */
bkpt #0x00
-STM32_PROG16: .word 0x101 /* PG | PSIZE_16*/
+ .pool
diff --git a/contrib/loaders/flash/stm32/stm32f2x.inc b/contrib/loaders/flash/stm32/stm32f2x.inc
new file mode 100644
index 0000000..3da2940
--- /dev/null
+++ b/contrib/loaders/flash/stm32/stm32f2x.inc
@@ -0,0 +1,6 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0xd0,0xf8,0x00,0x80,0xb8,0xf1,0x00,0x0f,0x1b,0xd0,0x47,0x68,0x47,0x45,0xf7,0xd0,
+0x0d,0x4e,0x26,0x61,0x37,0xf8,0x02,0x6b,0x22,0xf8,0x02,0x6b,0xbf,0xf3,0x4f,0x8f,
+0xe6,0x68,0x16,0xf4,0x80,0x3f,0xfb,0xd1,0x16,0xf0,0xf0,0x0f,0x07,0xd1,0x8f,0x42,
+0x28,0xbf,0x00,0xf1,0x08,0x07,0x47,0x60,0x01,0x3b,0x13,0xb1,0xe0,0xe7,0x00,0x21,
+0x41,0x60,0x30,0x46,0x00,0xbe,0x00,0x00,0x01,0x01,0x00,0x00,
diff --git a/contrib/loaders/flash/stm32h7x.S b/contrib/loaders/flash/stm32/stm32h7x.S
index 0f5ea99..f910bfb 100644
--- a/contrib/loaders/flash/stm32h7x.S
+++ b/contrib/loaders/flash/stm32/stm32h7x.S
@@ -20,21 +20,6 @@
.syntax unified
.cpu cortex-m7
.thumb
- .thumb_func
-
-/*
- * To assemble:
- * arm-none-eabi-gcc -c stm32h7x.S
- *
- * To disassemble:
- * arm-none-eabi-objdump -d stm32h7x.o
- *
- * To generate binary file:
- * arm-none-eabi-objcopy -O binary stm32h7x.o stm32h7_flash_write_code.bin
- *
- * To generate include file:
- * xxd -i stm32h7_flash_write_code.bin
- */
/*
* Code limitations:
@@ -67,7 +52,9 @@
#define STM32_SR_ERROR_MASK 0x03ee0000 /* DBECCERR | SNECCERR | RDSERR | RDPERR | OPERR
| INCERR | STRBERR | PGSERR | WRPERR */
-code:
+ .thumb_func
+ .global _start
+_start:
ldr r5, [r0, #4] /* read rp */
wait_fifo:
@@ -100,7 +87,7 @@ busy:
tst r6, #STM32_SR_BUSY_MASK
bne busy /* operation in progress, wait ... */
- ldr r7, stm32_sr_error_mask
+ ldr r7, =STM32_SR_ERROR_MASK
tst r6, r7
bne error /* fail... */
@@ -117,5 +104,5 @@ exit:
mov r0, r6 /* return status in r0 */
bkpt #0x00
-stm32_sr_error_mask:
- .word STM32_SR_ERROR_MASK
+ .pool
+
diff --git a/contrib/loaders/flash/stm32/stm32h7x.inc b/contrib/loaders/flash/stm32/stm32h7x.inc
new file mode 100644
index 0000000..174354c
--- /dev/null
+++ b/contrib/loaders/flash/stm32/stm32h7x.inc
@@ -0,0 +1,7 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0x45,0x68,0x06,0x68,0x26,0xb3,0x76,0x1b,0x42,0xbf,0x76,0x18,0x36,0x1a,0x08,0x3e,
+0x20,0x2e,0xf6,0xd3,0x4f,0xf0,0x32,0x06,0xe6,0x60,0x4f,0xf0,0x08,0x07,0x55,0xf8,
+0x04,0x6b,0x42,0xf8,0x04,0x6b,0xbf,0xf3,0x4f,0x8f,0x8d,0x42,0x28,0xbf,0x00,0xf1,
+0x08,0x05,0x01,0x3f,0xf3,0xd1,0x26,0x69,0x16,0xf0,0x01,0x0f,0xfb,0xd1,0x05,0x4f,
+0x3e,0x42,0x03,0xd1,0x45,0x60,0x01,0x3b,0xdb,0xd1,0x01,0xe0,0x00,0x27,0x47,0x60,
+0x30,0x46,0x00,0xbe,0x00,0x00,0xee,0x03,
diff --git a/contrib/loaders/flash/stm32l4x.S b/contrib/loaders/flash/stm32/stm32l4x.S
index 799dec5..9c49016 100644
--- a/contrib/loaders/flash/stm32l4x.S
+++ b/contrib/loaders/flash/stm32/stm32l4x.S
@@ -27,20 +27,6 @@
.syntax unified
.cpu cortex-m4
.thumb
- .thumb_func
-
-/* To assemble:
- * arm-none-eabi-gcc -c stm32l4x.S
- *
- * To disassemble:
- * arm-none-eabi-objdump -o stm32l4x.o
- *
- * To generate binary file:
- * arm-none-eabi-objcopy -O binary stm32l4x.o stm32l4_flash_write_code.bin
- *
- * To generate include file:
- * xxd -i stm32l4_flash_write_code.bin
- */
/*
* Params :
@@ -59,6 +45,11 @@
#define STM32_FLASH_CR_OFFSET 0x14 /* offset of CR register in FLASH struct */
#define STM32_FLASH_SR_OFFSET 0x10 /* offset of SR register in FLASH struct */
+#define STM32_PROG 0x1 /* PG */
+
+ .thumb_func
+ .global _start
+_start:
wait_fifo:
ldr r8, [r0, #0] /* read wp */
cmp r8, #0 /* abort if wp == 0 */
@@ -71,7 +62,7 @@ wait_fifo:
cmp r6, #8 /* wait until 8 bytes are available */
bcc wait_fifo
- ldr r6, STM32_PROG
+ ldr r6, =STM32_PROG
str r6, [r4, #STM32_FLASH_CR_OFFSET]
ldrd r6, [r5], #0x08 /* read one word from src, increment ptr */
strd r6, [r2], #0x08 /* write one word to dst, increment ptr */
@@ -97,4 +88,5 @@ exit:
mov r0, r6 /* return status in r0 */
bkpt #0x00
-STM32_PROG: .word 0x1 /* PG */
+ .pool
+
diff --git a/contrib/loaders/flash/stm32/stm32l4x.inc b/contrib/loaders/flash/stm32/stm32l4x.inc
new file mode 100644
index 0000000..4065d14
--- /dev/null
+++ b/contrib/loaders/flash/stm32/stm32l4x.inc
@@ -0,0 +1,7 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0xd0,0xf8,0x00,0x80,0xb8,0xf1,0x00,0x0f,0x20,0xd0,0x45,0x68,0xb8,0xeb,0x05,0x06,
+0x44,0xbf,0x76,0x18,0x36,0x1a,0x08,0x2e,0xf2,0xd3,0x0d,0x4e,0x66,0x61,0xf5,0xe8,
+0x02,0x67,0xe2,0xe8,0x02,0x67,0xbf,0xf3,0x4f,0x8f,0x26,0x69,0x16,0xf4,0x80,0x3f,
+0xfb,0xd1,0x16,0xf0,0xfa,0x0f,0x07,0xd1,0x8d,0x42,0x28,0xbf,0x00,0xf1,0x08,0x05,
+0x45,0x60,0x01,0x3b,0x13,0xb1,0xdb,0xe7,0x00,0x21,0x41,0x60,0x30,0x46,0x00,0xbe,
+0x01,0x00,0x00,0x00,
diff --git a/contrib/loaders/flash/stm32lx.S b/contrib/loaders/flash/stm32/stm32lx.S
index 8f9fd0b..399be8b 100644
--- a/contrib/loaders/flash/stm32lx.S
+++ b/contrib/loaders/flash/stm32/stm32lx.S
@@ -20,21 +20,13 @@
* 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., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
-// Build : arm-eabi-gcc -c stm32lx.S
.text
.syntax unified
.cpu cortex-m0
.thumb
- .thumb_func
- .global write
/*
r0 - destination address
@@ -42,6 +34,9 @@
r2 - count
*/
+ .thumb_func
+ .global _start
+_start:
// r2 = source + count * 4
lsls r2, r2, #2
adds r2, r1, r2
diff --git a/contrib/loaders/flash/stm32/stm32lx.inc b/contrib/loaders/flash/stm32/stm32lx.inc
new file mode 100644
index 0000000..eaaf184
--- /dev/null
+++ b/contrib/loaders/flash/stm32/stm32lx.inc
@@ -0,0 +1,2 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0x92,0x00,0x8a,0x18,0x01,0xe0,0x08,0xc9,0x08,0xc0,0x91,0x42,0xfb,0xd1,0x00,0xbe,