STM32H7x option_write reads incorrect address in flash
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- c
- Ambito
- devtools, embedded-iot
Direzione di ricerca
Start in src/flash/nor/stm32h7x.c and compare stm32h7_read_flash_reg_by_index, used by option_write, with stm32x_read_flash_reg, used by option_read. Reproduce with the STM32H757BIT6 configuration, then run the documented stm32h7x option_read and option_write commands across the referenced commits. Done means option_write reads the correct flash address and updates the option byte as expected.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A recently added support for STM32H7R/H7Sx MCUs (https://github.com/STMicroelectronics/OpenOCD/commit/aa109db19ffd22eb05e18b010140fb562934533b) broke stm32h7x option_write command on STM32H757BIT6. I tested stm32h7x option_write command with 3 different commits:
- Most recent commit - https://github.com/STMicroelectronics/OpenOCD/commit/0a084c29345576911fb8d10fcbd158d0361b6186
- Added support for STM32H7R/H7Sx - https://github.com/STMicroelectronics/OpenOCD/commit/aa109db19ffd22eb05e18b010140fb562934533b
- One commit prior to adding support for STM32H7R/H7Sx - https://github.com/STMicroelectronics/OpenOCD/commit/b62cbc2e853189e730fd94e6d9c0a1d3ceb2661f
Hardware
- STM32H757BIT6 - dual core
- STLINK-V3MINIE
Software
OpenOCD is running in a Docker container:
RUN git clone https://github.com/STMicroelectronics/OpenOCD.git && \
cd OpenOCD && \
git checkout insert_git_commit_here && \
./bootstrap && \
./configure --enable-stlink && \
make -j$(nproc) && \
make install && \
cd .. && \
rm -rf OpenOCD
I am running OpenOCD with the following command
openocd -f openocd_stm32h757.cfg
I am connecting to the OpenOCD with telnet
telnet 127.0.0.1 4444
Configuration file:
# openocd_stm32h757.cfg
source [find interface/stlink-dap.cfg]
transport select dapdirect_swd
source [find target/stm32h7x_dual_bank.cfg]
reset_config srst_only
Test results
I tried disabling booting of CM4 by changing option byte FLASH_OPTSR_PRG and also tried stm32h7x option_write example in the OpenOCD documentation section 12.5.2. The output of the commands tested with different commits are shown in a table below. Only commit b62cbc2 produced expected results and wrote the option byte.
| Command | Most recent https://github.com/STMicroelectronics/OpenOCD/commit/0a084c29345576911fb8d10fcbd158d0361b6186 | STM32H7R/H7Sx support https://github.com/STMicroelectronics/OpenOCD/commit/aa109db19ffd22eb05e18b010140fb562934533b | Prior to adding support https://github.com/STMicroelectronics/OpenOCD/commit/b62cbc2e853189e730fd94e6d9c0a1d3ceb2661f |
|---|---|---|---|
| reset | - | - | - |
| stm32h7x option_read 0 0x1c | Option Register: <0x5200201c> = 0x1bc6aaf0 | Option Register: <0x5200201c> = 0x1bc6aaf0 | Option Register: <0x5200201c> = 0x1bc6aaf0 |
| stm32h7x option_write 0 0x20 0x00000000 0x00400000 | Failed to read memory at 0x51e3be78 error while reading from address 0x51e3be78 |
Failed to read memory at 0xe000edf4 error while reading from address 0x856d9473 |
- |
| stm32h7x option_read 0 0x1c | Option Register: <0x5200201c> = 0x1bc6aaf0 | Option Register: <0x5200201c> = 0x1bc6aaf0 | Option Register: <0x5200201c> = 0x1b86aaf0 |
| stm32h7x option_write 0 0x20 0x8000000 0x8000000 | Failed to read memory at 0x51e3be78 error while reading from address 0x51e3be78 |
Failed to read memory at 0xe000edf4 error while reading from address 0x856d9473 |
- |
| stm32h7x option_read 0 0x1c | Option Register: <0x5200201c> = 0x1bc6aaf0 | Option Register: <0x5200201c> = 0x1bc6aaf0 | Option Register: <0x5200201c> = 0x1b86aaf0 |
Observations
Different functions are used in src/flash/nor/stm32h7x.c for reading values for commands option_read and option_write.
| commit | OpenOCD command | function in stm32h7x.c |
|---|---|---|
| aa109db | stm32h7x option_read | stm32x_read_flash_reg |
| aa109db | stm32h7x option_write | stm32h7_read_flash_reg_by_index |
| b310b3b | stm32h7x option_read | stm32x_read_flash_reg |
| b310b3b | stm32h7x option_write | stm32x_read_flash_reg |
Conclusion
It seems function stm32h7_read_flash_reg_by_index in src/flash/nor/stm32h7x.c used in option_write command reads incorrect address from flash.
Thanks in advance!
- Lingua principale
- C
- Stelle
- 205
- Fork
- 59
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di STMicroelectronics/OpenOCD
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
STM32N647: OpenOCD halt/debug fails with UNDEFINED while CubeIDE worksForse di nuovo libera @tarek-bochkati l’ha presa 269 giorni fa e non c’è nessuna pull request aperta. Apertabug
STMicroelectronics/OpenOCD#44 · 1 commento · 1 assegnatario ·
-
Request to upstream STM32 support (e.g. STM32H5) or provide pre-built binaries of the ST forkAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
STMicroelectronics/OpenOCD#42 · 9 commenti · 5 reazioni ·
Tutte le issue di STMicroelectronics/OpenOCD
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
BasedHardware/omi#20401 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
php/frankenphp#2688 ·
I maintainer di solito rispondono entro 1 giorno
-
area/ysql kind/bug priority/medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
yugabyte/yugabyte-db#34584 ·
I maintainer di solito rispondono entro 1 giorno