This is an automated email from Gerrit.

"Name of user not set <r.nooteb...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7984

-- gerrit

commit d0f257a1bc03b91854b18b5318375345223be846
Author: RolfNoot <r.nooteb...@gmail.com>
Date:   Sun Dec 10 21:27:10 2023 +0100

    update PSoC6 flash driver
    
    95% based on latest Infineon branch (5.0.0)
    
    removed exotic silicons and ballast
    
    original sources are scattered over multiple files
    
    converted in one solid driver for PSoC6
    
    creditss to Bohdan Tymkiv
    
    Change-Id: I7075e44629a7b3c0e1c51638f30b513afe97a82c
    Signed-off-by: RolfNoot <r.nooteb...@gmail.com>

diff --git a/contrib/loaders/flash/psoc6/Makefile 
b/contrib/loaders/flash/psoc6/Makefile
new file mode 100644
index 0000000000..5ce3523909
--- /dev/null
+++ b/contrib/loaders/flash/psoc6/Makefile
@@ -0,0 +1,33 @@
+BIN2C = ../../../../src/helper/bin2char.sh
+
+CROSS_COMPILE ?= arm-none-eabi-
+
+CC=$(CROSS_COMPILE)gcc
+OBJCOPY=$(CROSS_COMPILE)objcopy
+OBJDUMP=$(CROSS_COMPILE)objdump
+
+CFLAGS =  -c -mthumb -mcpu=cortex-m0plus -Os
+
+all: psoc6_write.inc psoc62m_write.inc tv2_write.inc
+
+.PHONY: clean
+
+.INTERMEDIATE: psoc6_write.o psoc62m_write.o tv2_write.o
+
+tv2_write.o: psoc6_write.c
+       $(CC) $(CFLAGS) -DMXS40_VARIANT=MXS40_VARIANT_TRAVEO_II -Wall -Wextra 
-Wa,-adhln=$*.lst $< -o $@
+
+psoc6_write.o: psoc6_write.c
+       $(CC) $(CFLAGS) -DMXS40_VARIANT=MXS40_VARIANT_PSOC6A_BLE -Wall -Wextra 
-Wa,-adhln=$*.lst $< -o $@
+
+psoc62m_write.o: psoc6_write.c
+       $(CC) $(CFLAGS) -DMXS40_VARIANT=MXS40_VARIANT_PSOC6A_2M -Wall -Wextra 
-Wa,-adhln=$*.lst $< -o $@
+
+%.bin: %.o
+       $(OBJCOPY) -Obinary $< $@
+
+%.inc: %.bin
+       $(BIN2C) < $< > $@
+
+clean:
+       -rm -f *.o *.lst *.bin *.inc
diff --git a/contrib/loaders/flash/psoc6/psoc62m_erase.inc 
b/contrib/loaders/flash/psoc6/psoc62m_erase.inc
new file mode 100644
index 0000000000..a1d588c159
--- /dev/null
+++ b/contrib/loaders/flash/psoc6/psoc62m_erase.inc
@@ -0,0 +1,13 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0xf0,0xb5,0x85,0xb0,0x62,0xb6,0xf0,0x27,0x26,0x4c,0x3f,0x01,0x23,0x68,0x26,0x4e,
+0x3b,0x40,0x5f,0x1e,0xbb,0x41,0x01,0x27,0x10,0x33,0x9f,0x40,0x35,0x68,0x01,0x94,
+0x2f,0x42,0x01,0xd1,0x3d,0x43,0x35,0x60,0xf0,0x26,0xa0,0x27,0x01,0x25,0x36,0x01,
+0x3f,0x06,0x00,0x2a,0x01,0xd1,0x00,0xbe,0xfd,0xe7,0x43,0x68,0x9c,0x46,0x03,0x68,
+0x9c,0x45,0xfa,0xd0,0x43,0x68,0x19,0x4c,0x1b,0x68,0x9c,0x46,0x2b,0x40,0x5b,0x42,
+0xdb,0x06,0x1b,0x19,0x02,0x93,0x63,0x46,0xab,0x43,0x03,0x93,0x01,0x9b,0x1b,0x68,
+0x33,0x40,0x5c,0x1e,0xa3,0x41,0x12,0x4c,0x1b,0x19,0x5b,0x01,0x1c,0x68,0x00,0x2c,
+0xfc,0xda,0x02,0xac,0xdc,0x60,0x9d,0x60,0xdc,0x69,0x00,0x2c,0xfc,0xdb,0x02,0x9b,
+0x9c,0x46,0x1b,0x0f,0x1b,0x07,0xbb,0x42,0x03,0xd0,0x00,0x23,0x43,0x60,0x60,0x46,
+0x00,0xbe,0x43,0x68,0x04,0x33,0x8b,0x42,0x01,0xd3,0x03,0x00,0x08,0x33,0x43,0x60,
+0x01,0x3a,0xc6,0xe7,0x00,0x00,0x20,0x40,0x08,0x10,0x22,0x40,0x00,0x01,0x00,0x1c,
+0x00,0x10,0x01,0x02,
diff --git a/contrib/loaders/flash/psoc6/psoc62m_write.inc 
b/contrib/loaders/flash/psoc6/psoc62m_write.inc
new file mode 100644
index 0000000000..669c4441d9
--- /dev/null
+++ b/contrib/loaders/flash/psoc6/psoc62m_write.inc
@@ -0,0 +1,11 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0xf0,0xb5,0x85,0xb0,0x62,0xb6,0x01,0x26,0x00,0x2b,0x01,0xd1,0x00,0xbe,0xfd,0xe7,
+0x45,0x68,0x04,0x68,0xa5,0x42,0xfb,0xd0,0x1b,0x4d,0x44,0x68,0x00,0x95,0x0a,0x25,
+0xff,0x35,0x01,0x95,0xf0,0x25,0x03,0x94,0x18,0x4c,0x02,0x92,0x24,0x68,0x2d,0x01,
+0x2c,0x40,0x65,0x1e,0xac,0x41,0x16,0x4d,0xe4,0xb2,0x65,0x19,0x6d,0x01,0x2f,0x68,
+0x00,0x2f,0xfc,0xda,0x6f,0x46,0xef,0x60,0x37,0x00,0x10,0x34,0xa7,0x40,0x11,0x4c,
+0x27,0x60,0xae,0x60,0xec,0x69,0x00,0x2c,0xfc,0xdb,0xa0,0x27,0x00,0x9d,0x3f,0x06,
+0x2c,0x0f,0x24,0x07,0xbc,0x42,0x03,0xd0,0x00,0x24,0x44,0x60,0x28,0x1c,0x00,0xbe,
+0x80,0x25,0x44,0x68,0xad,0x00,0x64,0x19,0x52,0x19,0x8c,0x42,0x01,0xd3,0x04,0x00,
+0x08,0x34,0x44,0x60,0x01,0x3b,0xbf,0xe7,0x00,0x01,0x00,0x06,0x00,0x00,0x20,0x40,
+0x00,0x10,0x01,0x02,0x08,0x10,0x22,0x40,
diff --git a/contrib/loaders/flash/psoc6/psoc6_erase.inc 
b/contrib/loaders/flash/psoc6/psoc6_erase.inc
new file mode 100644
index 0000000000..a532d7b2c7
--- /dev/null
+++ b/contrib/loaders/flash/psoc6/psoc6_erase.inc
@@ -0,0 +1,13 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0xf0,0xb5,0x85,0xb0,0x62,0xb6,0xf0,0x27,0x26,0x4c,0x3f,0x01,0x23,0x68,0x26,0x4e,
+0x3b,0x40,0x5f,0x1e,0xbb,0x41,0x01,0x27,0x10,0x33,0x9f,0x40,0x35,0x68,0x01,0x94,
+0x2f,0x42,0x01,0xd1,0x3d,0x43,0x35,0x60,0xf0,0x26,0xa0,0x27,0x01,0x25,0x36,0x01,
+0x3f,0x06,0x00,0x2a,0x01,0xd1,0x00,0xbe,0xfd,0xe7,0x43,0x68,0x9c,0x46,0x03,0x68,
+0x9c,0x45,0xfa,0xd0,0x43,0x68,0x19,0x4c,0x1b,0x68,0x9c,0x46,0x2b,0x40,0x5b,0x42,
+0xdb,0x06,0x1b,0x19,0x02,0x93,0x63,0x46,0xab,0x43,0x03,0x93,0x01,0x9b,0x1b,0x68,
+0x33,0x40,0x5c,0x1e,0xa3,0x41,0x12,0x4c,0x1b,0x19,0x5b,0x01,0x1c,0x68,0x00,0x2c,
+0xfc,0xda,0x02,0xac,0xdc,0x60,0x9d,0x60,0x1c,0x69,0x00,0x2c,0xfc,0xdb,0x02,0x9b,
+0x9c,0x46,0x1b,0x0f,0x1b,0x07,0xbb,0x42,0x03,0xd0,0x00,0x23,0x43,0x60,0x60,0x46,
+0x00,0xbe,0x43,0x68,0x04,0x33,0x8b,0x42,0x01,0xd3,0x03,0x00,0x08,0x33,0x43,0x60,
+0x01,0x3a,0xc6,0xe7,0x00,0x04,0x21,0x40,0x08,0x10,0x23,0x40,0x00,0x01,0x00,0x1c,
+0x00,0x18,0x01,0x02,
diff --git a/contrib/loaders/flash/psoc6/psoc6_write.inc 
b/contrib/loaders/flash/psoc6/psoc6_write.inc
new file mode 100644
index 0000000000..85cebf705b
--- /dev/null
+++ b/contrib/loaders/flash/psoc6/psoc6_write.inc
@@ -0,0 +1,11 @@
+/* Autogenerated with ../../../../src/helper/bin2char.sh */
+0xf0,0xb5,0x85,0xb0,0x62,0xb6,0x01,0x26,0x00,0x2b,0x01,0xd1,0x00,0xbe,0xfd,0xe7,
+0x45,0x68,0x04,0x68,0xa5,0x42,0xfb,0xd0,0x1b,0x4d,0x44,0x68,0x00,0x95,0x0a,0x25,
+0xff,0x35,0x01,0x95,0xf0,0x25,0x03,0x94,0x18,0x4c,0x02,0x92,0x24,0x68,0x2d,0x01,
+0x2c,0x40,0x65,0x1e,0xac,0x41,0x16,0x4d,0xe4,0xb2,0x65,0x19,0x6d,0x01,0x2f,0x68,
+0x00,0x2f,0xfc,0xda,0x6f,0x46,0xef,0x60,0x37,0x00,0x10,0x34,0xa7,0x40,0x11,0x4c,
+0x27,0x60,0xae,0x60,0x2c,0x69,0x00,0x2c,0xfc,0xdb,0xa0,0x27,0x00,0x9d,0x3f,0x06,
+0x2c,0x0f,0x24,0x07,0xbc,0x42,0x03,0xd0,0x00,0x24,0x44,0x60,0x28,0x1c,0x00,0xbe,
+0x80,0x25,0x44,0x68,0xad,0x00,0x64,0x19,0x52,0x19,0x8c,0x42,0x01,0xd3,0x04,0x00,
+0x08,0x34,0x44,0x60,0x01,0x3b,0xbf,0xe7,0x00,0x01,0x00,0x06,0x00,0x04,0x21,0x40,
+0x00,0x18,0x01,0x02,0x08,0x10,0x23,0x40,
diff --git a/tcl/board/otx18.cfg b/tcl/board/otx18.cfg
new file mode 100644
index 0000000000..e90be3e558
--- /dev/null
+++ b/tcl/board/otx18.cfg
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Onethinx LoRaWAN Core module OTX-18 
+# https://www.onethinx.com/module
+# The OTX-18 is a dual-core device with a locked CM0+ core and an accessible 
CM4 core. 
+
+source [find target/swj-dp.tcl]
+
+adapter speed 1000
+
+global TARGET
+set TARGET psoc6.cpu
+
+swj_newdap psoc6 cpu -irlen 4 -ircapture 0x1 -irmask 0xf
+dap create psoc6.dap -chain-position psoc6.cpu
+
+proc init_reset { mode } {
+       global RESET_MODE
+       set RESET_MODE $mode
+
+       if {[using_jtag]} {
+               jtag arp_init-reset
+       }
+}
+
+# Utility to make 'reset halt' work as reset;halt on a target
+# It does not prevent running code after reset
+proc psoc6_deassert_post { target } {
+       # PSoC6 cleared AP registers including TAR during reset
+       # Force examine to synchronize OpenOCD target status
+       $target arp_examine
+
+       global RESET_MODE
+       global TARGET
+
+       if { $RESET_MODE ne "run" } {
+               $target arp_poll
+               $target arp_poll
+               set st [$target curstate]
+
+               if { $st eq "reset" } {
+                       # we assume running state follows
+                       # if reset accidentally halts, waiting is useless
+                       catch { $target arp_waitstate running 100 }
+                       set st [$target curstate]
+               }
+
+               if { $st eq "running" } {
+                       echo "$target: Ran after reset and before halt..."
+                       if { $target eq "psoc6.cpu.cm0" } {
+                               # Try to cleanly reset whole system
+                               # and halt the CM0 at entry point
+                               psoc6 reset_halt
+                               $target arp_waitstate halted 100
+                       } else {
+                               $target arp_halt
+                       }
+               }
+       }
+}
+
+target create psoc6.cm4 cortex_m -dap psoc6.dap -ap-num 2 -coreid 1
+psoc6.cm4 configure -work-area-phys 0x08000000 -work-area-size 0x4000 
-work-area-backup 0
+
+flash bank main_flash_cm4              psoc6 0x10000000 0 0 0 psoc6.cm4
+flash bank work_flash_cm4              psoc6 0x14000000 0 0 0 psoc6.cm4
+
+psoc6.cm4 cortex_m reset_config sysresetreq
+psoc6.cm4 configure -event reset-deassert-post "psoc6_deassert_post psoc6.cm4"
+
+if {[using_jtag]} {
+       jtag newtap psoc6 bs -irlen 18 -expected-id 0x2e200069
+}

-- 

Reply via email to