Requires OpenOCD git. Config is from here https://github.com/ali1234/openocd/commit/4f7d462db204f786971bb95de78137074764fe39, modified to work with the merged QUADSPI patch.
Created
December 7, 2020 23:26
-
-
Save Daft-Freak/6662102321ee02260fc4634a63249c08 to your computer and use it in GitHub Desktop.
32Blit OpenOCD VS Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 32blit configuration - modified from nucleo-h743zi.cfg | |
source [find interface/stlink.cfg] | |
transport select hla_swd | |
set CHIPNAME stm32h750vbz | |
# enable stmqspi | |
if {![info exists QUADSPI]} { | |
set QUADSPI 1 | |
} | |
source [find target/stm32h7x.cfg] | |
#reset_config srst_only srst_nogate connect_assert_srst | |
# QUADSPI initialization | |
# qpi: 4-line mode | |
proc qspi_init {} { | |
# Clock set up | |
mmw 0x580244E0 0x000007FF 0 ;# RCC_AHB4ENR |= GPIOA-GPIOK (enable clocks) | |
mmw 0x580244D4 0x00004000 0 ;# RCC_AHB3ENR |= QSPIEN (enable clock) | |
sleep 1 ;# Wait for clock startup | |
# Pin muxing set up for 32blit | |
# See https://github.com/pimoroni/32blit-beta/blob/e2d2705ba7ccaf257b3f5cdfc2b42f8e2ab8a173/32blit-stm32/Src/gpio.cpp#L38 | |
# PB02: CLK, PC11: BK2_NCS, PE07: BK2_IO0, PE08: BK2_IO1, PE09: BK2_IO2, PE10: BK2_IO3 | |
# Note: The HAL initializes all QSPI pin speeds as GPIO_SPEED_FREQ_LOW (this is the minimum speed). OpenOCD likes to make | |
# them GPIO_SPEED_FREQ_VERY_HIGH which is the maximum. I am not sure why. This is the only change from HAL init. | |
# Port B: PB02:AF09:V | |
mmw 0x58020400 0x00000020 0x00000010 ;# GPIOB_MODER: MODER2=2 (GPIO_MODE_AF_PP) | |
mmw 0x58020408 0x00000030 0x00000000 ;# GPIOB_OSPEEDR: OSPEED2=3 (GPIO_SPEED_FREQ_VERY_HIGH) | |
mmw 0x5802040C 0x00000000 0x00000030 ;# GPIOB_PUPDR: PUPDR2=0 (NOPULL) | |
mmw 0x58020420 0x00000900 0x00000600 ;# GPIOB_AFRL: AFSEL2=9 | |
# Port C: PC11:AF09:V | |
mmw 0x58020800 0x00800000 0x00400000 ;# GPIOC_MODER: MODER11=2 (GPIO_MODE_AF_PP) | |
mmw 0x58020808 0x00C00000 0x00000000 ;# GPIOC_OSPEEDR: OSPEED11=3 (GPIO_SPEED_FREQ_VERY_HIGH) | |
mmw 0x5802080C 0x00000000 0x00C00000 ;# GPIOC_PUPDR: PUPDR11=0 (NOPULL) | |
mmw 0x58020824 0x00009000 0x00006000 ;# GPIOC_AFRH: AFSEL11=9 | |
# Port E: PE10:AF10:V, PE09:AF10:V, PE08:AF10:V, PE07:AF10:V | |
mmw 0x58021000 0x002A8000 0x00154000 ;# GPIOE_MODER: MODER7=2, MODER8=2, MODER9=2, MODER10=2 (GPIO_MODE_AF_PP) | |
mmw 0x58021008 0x003FC000 0x00000000 ;# GPIOC_OSPEEDR: OSPEED7=3, OSPEED8=3, OSPEED9=3, OSPEED10=3 (GPIO_SPEED_FREQ_VERY_HIGH) | |
mmw 0x5802100C 0x00000000 0x003FC000 ;# GPIOE_PUPDR: PUPDR7=0, PUPDR8=0, PUPDR9=0, PUPDR10=0 (NOPULL) | |
mmw 0x58021020 0xA0000000 0x50000000 ;# GPIOE_AFRL: AFSEL7=10 | |
mmw 0x58021024 0x00000AAA 0x00000555 ;# GPIOE_AFRH: AFSEL8=10, AFSEL9=10, AFSEL10=10 | |
# Flash set up - 32blit uses flash 2 only | |
# flash2 'micron n25q256 3v' id = 0x19ba20 size = 32768kbytes | |
# Full part number is: MT25QL256ABA1EW7 | |
# correct FSIZE is 0x18 or 0x19, however, this causes trouble when | |
# reading the last word at end of bank in *memory mapped* mode | |
mww 0x52005000 0x05500090 ;# QUADSPI_CR: PRESCALER=5, APMS=1, FTHRES=0, FSEL=1, DFM=0, SSHIFT=0, TCEN=1 | |
mww 0x52005004 0x00180100 ;# QUADSPI_DCR: FSIZE=0x18, CSHT=0x01, CKMODE=0 | |
mww 0x52005030 0x00001000 ;# QUADSPI_LPTR: deactivate CS after 4096 clocks when FIFO is full | |
mww 0x52005014 0x0D002503 ;# QUADSPI_CCR: FMODE=0x3, DMODE=0x1, DCYC=0x0, ADSIZE=0x3, ADMODE=0x1, IMODE=0x1 | |
mmw 0x52005000 0x00000001 0 ;# QUADSPI_CR: EN=1 | |
# Exit QPI mode | |
mww 0x52005014 0x000003FF ;# QUADSPI_CCR: FMODE=0x0, DMODE=0x0, DCYC=0x0, ADSIZE=0x0, ADMODE=0x0, IMODE=0x3, INSTR=Exit QPI | |
sleep 1 | |
# Enter 4-byte mode | |
mww 0x52005014 0x000001B7 ;# QUADSPI_CCR: FMODE=0x0, DMODE=0x0, DCYC=0x0, ADSIZE=0x0, ADMODE=0x0, IMODE=0x1, INSTR=Enter 4-byte | |
sleep 1 | |
# 32blit only works in this mode | |
# memory-mapped read mode with 4-byte addresses | |
mww 0x52005014 0x0D003503 ;# QUADSPI_CCR: FMODE=0x3, DMODE=0x1, DCYC=0x0, ADSIZE=0x3, ADMODE=0x1, IMODE=0x1, INSTR=READ | |
} | |
$_CHIPNAME.cpu0 configure -event reset-init { | |
global QUADSPI | |
if { $QUADSPI } { | |
qspi_init | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "(arm gdb) Launch", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "${command:cmake.launchTargetPath}", | |
"args": [], | |
"stopAtEntry": false, | |
"cwd": "${workspaceFolder}", | |
"environment": [], | |
"externalConsole": false, | |
"MIMode": "gdb", | |
"miDebuggerPath": "/usr/bin/gdb-multiarch", | |
"debugServerPath": "/home/daftfreak/.local/bin/openocd", | |
"debugServerArgs": "-f board/32blit.cfg -c init -c \"reset init\"", | |
"filterStderr": true, | |
"serverStarted": "target halted due to debug-request, current mode: Thread ", | |
"setupCommands": [ | |
{ "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false }, | |
{ "text": "-file-exec-and-symbols ${command:cmake.launchTargetPath}", "description": "load file", "ignoreFailures": false}, | |
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false }, | |
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false }, | |
{ "text": "-target-download", "description": "flash target", "ignoreFailures": false }, | |
//{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false }, //? | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment