well, as you said the current cfg file do support the STM32L5 devices using non 
HLA adapters
since secure debugging requires changing the AP CSW when changing from secure 
to non-secure and vice versa

but nothing prevent us from modifying the cfg to work with STM32L5 with HLA 
adapters but only when the device is non-secure

IDK if ST-Link clones do support non-hla mode aka dapdirect using the 
"interface/stlink-dap.cfg"

I would be interested if you can give it a try
meanwhile I will try to adapt the cfg to work with HLA adapters


---

** [tickets:#317] STM32L5 wrong page size**

**Status:** new
**Milestone:** 0.11.0
**Labels:** stm32lx flash 
**Created:** Wed Aug 25, 2021 02:33 PM UTC by Patrik Bachan
**Last Updated:** Sat Sep 04, 2021 09:37 AM UTC
**Owner:** nobody


Hi,
I have issue with OpenOCD and STM32L552 (256 kiB FLASH).
STM32L5x has 2 option bytes telling what dual-bank config is used: DBANK and 
DB256K.
Issues it, that page size depends only on DBANK, even for devices with 256kiB.
Tested with STM32CUbeProgrammer and STM32L552. Also tested with OpenOCD which 
erases only 2kiB, even though OpenOCD reports 4kiB pages.
In commit 
[092cfe16fb9cf6d6a308d62246fb648b0709ecd3](https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff;h=092cfe16fb9cf6d6a308d62246fb648b0709ecd3)
 introducing support of L5 devices, there seems to be the culprit of issue.

```
if ((use_dbank_bit && (options & BIT(22))) ||
                      (!use_dbank_bit && (options & BIT(21)))) {
```

STM32 flash driver code for these MCUs decides by DBANK for 512 kiB and by 
DB256K for 256 kiB and this is  not correct.

>From my understanding and observations:
for 512 kiB devices, DBANK affects page size and single-bank/dual-bank selection
for 256 kiB devices, DBANK affects page size and DB256K affects 
single-bank/dual-bank selection (probably, not tested)

This issue causes flash programming fail when there is already something in 
flash and page needs to be erased at first. I assume, that problem is wrong 
page erasure.

On which devices was this code tested?


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to