Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Possibly outdated Assembly code in STM32.GPIO#Lock_The_Pin

Aperta
#482 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Ambito
embedded-iot

Direzione di ricerca

Inizia da STM32.GPIO#Lock_The_Pin e ispeziona la sequenza Assembly insieme alla dichiarazione di GPIO_Peripheral. Confronta l’implementazione con i requisiti citati di RM0090 per GPIOx_LCKR e con il comportamento della compilazione di Cortex-M0+; il lavoro è completato quando si determina se l’approccio attuale è valido o necessita di una modifica documentata e compilabile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Greetings!

I was working on my project that uses STM32.GPIO package and faced a compilation error. Assembly code in STM32.GPIO#Lock_The_Pin works well for Cortex-M3 and up, but fails compilation on my Cortex-M0+. The comment in Lock_The_Pin justifies use of Assembly by the fact that setting pin's lock bit requires an exact write sequence, which is confirmed by the documentation:

RM0090 Rev 22
8.4.8 GPIO port configuration lock register (GPIOx_LCKR)
(x = A..I/J/K)
This register is used to lock the configuration of the port bits when a correct write sequence
is applied to bit 16 (LCKK). The value of bits [15:0] is used to lock the configuration of the
GPIO. During the write sequence, the value of LCKR[15:0] must not change. When the
LOCK sequence has been applied on a port bit, the value of this port bit can no longer be
modified until the next MCU or peripheral reset.
Note: A specific write sequence is used to write to the GPIOx_LCKR register. Only word access
(32-bit long) is allowed during this write sequence.
Each lock bit freezes a specific configuration register (control and alternate function
registers).
Address offset: 0x1C
Reset value: 0x0000 0000
Access: 32-bit word only, read/write register

But isn't the write sequence guaranteed by the fact that GPIO_Peripheral is declared with Volatile? I understood it so that Volatile tells the compiler not to optimize and truly execute all reads and writes, in the order they are written in the source code. Is my reasoning correct or am i missing something? I am somewhat new to Ada and embedded and thus ignorant about many things.

Lingua principale
Ada
Stelle
286
Fork
165
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AdaCore/Ada_Drivers_Library

Tutte le issue di AdaCore/Ada_Drivers_Library

Issue simili

Altre issue su Embedded & IoT

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.