diff options
author | Ake Rehnman <ake.rehnman@gmail.com> | 2017-11-06 19:56:28 +0100 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2017-12-07 07:53:13 +0000 |
commit | 020cb12077cb15be1700bf7733178acfb2b26428 (patch) | |
tree | 3d40047dad41518d264264862bd1f3a193933577 /contrib | |
parent | 6090a5b158ad212a54510f061226ca58155b51fe (diff) |
stm8 : new target
New STM8 target based mostly on mips4k. Target communication
through STLINK/SWIM. No flash driver yet but it is still possible
to program flash through load_image command. The usual target debug
methods are implemented.
Change-Id: I7216f231d3ac7c70cae20f1cd8463c2ed864a329
Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com>
Reviewed-on: http://openocd.zylin.com/3953
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/loaders/Makefile | 5 | ||||
-rw-r--r-- | contrib/loaders/erase_check/Makefile | 17 | ||||
-rw-r--r-- | contrib/loaders/erase_check/stm8_erase_check.inc | 5 | ||||
-rw-r--r-- | contrib/loaders/erase_check/stm8_erase_check.s | 69 |
4 files changed, 95 insertions, 1 deletions
diff --git a/contrib/loaders/Makefile b/contrib/loaders/Makefile index 31cccb5f..a9a27706 100644 --- a/contrib/loaders/Makefile +++ b/contrib/loaders/Makefile @@ -1,6 +1,6 @@ .PHONY: arm clean-arm -all: arm +all: arm stm8 common_dirs = \ checksum \ @@ -32,3 +32,6 @@ clean: clean-arm for d in $(common_dirs); do \ $(MAKE) -C $$d clean; \ done + +stm8: + $(MAKE) -C erase_check stm8 diff --git a/contrib/loaders/erase_check/Makefile b/contrib/loaders/erase_check/Makefile index 01e62dea..427fa0c0 100644 --- a/contrib/loaders/erase_check/Makefile +++ b/contrib/loaders/erase_check/Makefile @@ -6,6 +6,12 @@ ARM_OBJCOPY ?= $(ARM_CROSS_COMPILE)objcopy ARM_AFLAGS = -EL +STM8_CROSS_COMPILE ?= stm8- +STM8_AS ?= $(STM8_CROSS_COMPILE)as +STM8_OBJCOPY ?= $(STM8_CROSS_COMPILE)objcopy + +STM8_AFLAGS = + arm: armv4_5_erase_check.inc armv7m_erase_check.inc armv7m_0_erase_check.inc armv4_5_%.elf: armv4_5_%.s @@ -26,5 +32,16 @@ armv7m_%.bin: armv7m_%.elf armv7m_%.inc: armv7m_%.bin $(BIN2C) < $< > $@ +stm8: stm8_erase_check.inc + +stm8_%.elf: stm8_%.s + $(STM8_AS) $(STM8_AFLAGS) $< -o $@ + +stm8_%.bin: stm8_%.elf + $(STM8_OBJCOPY) -Obinary $< $@ + +stm8_%.inc: stm8_%.bin + $(BIN2C) < $< > $@ + clean: -rm -f *.elf *.bin *.inc diff --git a/contrib/loaders/erase_check/stm8_erase_check.inc b/contrib/loaders/erase_check/stm8_erase_check.inc new file mode 100644 index 00000000..66b4ec7f --- /dev/null +++ b/contrib/loaders/erase_check/stm8_erase_check.inc @@ -0,0 +1,5 @@ +/* Autogenerated with ../../../src/helper/bin2char.sh */ +0x00,0x80,0x00,0x00,0x80,0x00,0x96,0xcf,0x00,0x22,0x1e,0x01,0x16,0x04,0xa6,0xff, +0x90,0x5d,0x26,0x04,0x0d,0x03,0x27,0x17,0x90,0x5d,0x26,0x02,0x0a,0x03,0x90,0x5a, +0x92,0xbc,0x00,0x00,0xa1,0xff,0x26,0x07,0x5c,0x26,0xe5,0x0c,0x00,0x20,0xe1,0x1f, +0x01,0x17,0x04,0x8b, diff --git a/contrib/loaders/erase_check/stm8_erase_check.s b/contrib/loaders/erase_check/stm8_erase_check.s new file mode 100644 index 00000000..62694006 --- /dev/null +++ b/contrib/loaders/erase_check/stm8_erase_check.s @@ -0,0 +1,69 @@ +/* + Copyright (C) 2017 Ake Rehnman + ake.rehnman(at)gmail.com + + 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 3 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, see <http://www.gnu.org/licenses/>. +*/ +;; +;; erase check memory code +;; + .org 0x0 +;; start address + start_addr: .byte 0x00 + .word 0x8000 +;; byte count + byte_cnt: .byte 0x00 + .word 0x8000 +; +; SP must point to start_addr on entry +; first relocate start_addr to the location +; we are running at +start: + ldw X,SP + ldw .cont+2,X + ldw X,(start_addr+1,SP) ;start addr + ldw Y,(byte_cnt+1,SP) ;count + ld A,#0xff +; +; if count == 0 return +.L1: + tnzw Y + jrne .decrcnt ;continue if low word != 0 + tnz (byte_cnt,SP) ;high byte + jreq .exit ;goto exit +; +; decrement count (byte_cnt) +.decrcnt: + tnzw Y ;low word count + jrne .decr1 + dec (byte_cnt,SP) ;high byte +.decr1: + decw Y; decr low word +; +; first check if [start_addr] is 0xff +.cont: + ldf A, [start_addr.e] + cp A,#0xff + jrne .exit ;exit if not 0xff +; +; increment start_addr (addr) + incw X + jrne .L1 + inc (start_addr,SP) ;increment high byte + jra .L1 +; +.exit: + ldw (start_addr+1,SP),X ;start addr + ldw (byte_cnt+1,SP),Y ;count + break |