flash/nor/bl602: add bl602 flash driver

Initial release of Flash bank driver for Bouffalo chips.
The driver currently supports BL602, BL702, BL702L series of chips.
Similar SFlash core is inside of BL808, BL606P and BL616 series,
so those might be supported in future as well.

With adapter speed set to 8000, it can reach speed 140 KiB/s.

Since chips have eXecute In Place support, and they also require
boot config in Flash at offset 0x0, it's required to have properly
crafted linker script, so OpenOCD knows where to write firmware
through gdb.

There is required flash bank parameter, which specifies the chip type.
This is required because BL702 and BL702L have same TAP ID CODE, and
there are no usable indicators to use for automatic chip type
recognition in the chip.

Change-Id: Id57336d447be3c608b39ba3ed143527bfdc0af98
Signed-off-by: Marek Kraus <gamelaster@outlook.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8527
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marek Kraus
2024-10-21 20:22:08 +02:00
committed by Antonio Borneo
parent 3e86eaaf7d
commit df2eb07086
9 changed files with 807 additions and 1 deletions

View File

@@ -44,8 +44,17 @@ $_TARGETNAME configure -work-area-phys $_WORKAREAADDR -work-area-size $_WORKAREA
# Internal RC ticks on 32 MHz, so this speed should be safe to use.
adapter speed 8000
# Useful functions
if { [info exists FLASH_CHIP_TYPE] } {
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME bl602 0x23000000 0 0 0 $_TARGETNAME $FLASH_CHIP_TYPE
$_TARGETNAME configure -event reset-init {
# Probing of Flash is required to initialize SFlash from unknown state.
flash probe 0
}
}
# Useful functions
set dmcontrol 0x10
set dmcontrol_dmactive [expr {1 << 0}]
set dmcontrol_ndmreset [expr {1 << 1}]