CMSIS-SVD environment and scripts

Revision as of 11:07, 9 January 2019 by imported>Frq08988
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:ArticleMainWriter

Template:ArticleFirstDraftVersion



Under construction.png Coming soon

This article provides information for using CMSIS-SVD file through GDB for accessing STM32MPU Internal peripherals registers for reading and/or writing.

1. Information about CMSIS-SVD files[edit source]

Extracted from Arm Keil web page[1]:

The CMSIS System View Description format(CMSIS-SVD) formalizes the description of the system contained in Arm Cortex-M processor-based microcontrollers, in particular, the memory mapped registers of peripherals. The detail contained in system view descriptions is comparable to the data in device reference manuals. The information ranges from high level functional descriptions of a peripheral all the way down to the definition and purpose of an individual bit field in a memory mapped register.

Arm also precise in an other web page about CMSIS-SVD[2] that this is not only for Cortex-M:

For every supported microcontroller, debuggers can provide detailed views to the device peripherals that display the current register state.

2. Python scripts environment for GDB[edit source]

2.1. CMSIS-SVD file parser[edit source]

A CMSIS-SVD file parser is proposed and shared by Paul Osborne on github: https://github.com/posborne/cmsis-svd.

This package can be reused as it is, and by adding the CMSIS-SVD files for STM32MPU microprocessor if missing.

About License, following information is provided:
In general, the following rules apply:

  • Under data, the license from each Vendor is provided along with the SVDs from that vendor. Please review this license before use of the SVDs contained therein. Look for files named the following for license information.
  • All other code is licensed under the terms of the Apache License v2.0 (See LICENSE-APACHE).

In our case, we will only add new files in data/STMicro sub-directory, so STMicroelectronics license is applied.


This package is part of the OpenSTLinux Developer Package.


2.2. Python scripts for GDB[edit source]

ST proposes a package containing a set of scripts for providing usable macro to GDB for reading and/or writing internal peripheral registers, and which then use the script from CMSIS-SVD file parser.


This package is part of the OpenSTLinux Developer Package.


2.3. Setting environment[edit source]


3. Python scripts usage for GDB[edit source]

3.1. Running CMSIS-SVD setup[edit source]

(gdb) source <CMSIS-SVD_scripts_path>/cmsis-svd-4gdb/stm32-gdb.py
(gdb) svd_load STMicro STM32MP1.svd

3.2. Reading register value[edit source]

Please refer to the following examples.

  • Getting an entire peripheral:
(gdb) svd_get DLYBSD1
 DLYBSD1 @ 0x58006000
 DLYB_CR
         DEN=0 SEN=0
 DLYB_CFGR
         SEL=0 UNIT=0 LNG=0 LNGF=1
 DLYB_VERR
         MINREV=0 MAJREV=0
 DLYB_IPIDR
         ID=0
 DLYB_SIDR
         SID=0
  • Getting just one register:
(gdb) svd_get DLYBSD1 DLYB_CFGR
 DLYB_CFGR
         SEL=0 UNIT=0 LNG=0 LNGF=1
  • Getting field values in hex:
(gdb) svd_get/x DLYBSD1 DLYB_CFGR
 DLYB_CFGR
         SEL=0 UNIT=00 LNG=000 LNGF=1
  • Getting field values in binary:
(gdb) svd_get/b DLYBSD1 DLYB_CFGR
 DLYB_CFGR
         SEL=0000 UNIT=0000000 LNG=000000000000 LNGF=1
  • Get whole register value in binary:
(gdb) svd_get/i DLYBSD1 DLYB_CFGR
 DLYB_CFGR 10000000000000000000000000000000
         SEL=0 UNIT=0 LNG=0 LNGF=1
  • Getting register offsets:
(gdb) svd_get/f DLYBSD1 DLYB_CFGR
 DLYB_CFGR 0x0004
         SEL=0 UNIT=0 LNG=0 LNGF=1

3.3. Writing register value[edit source]

Please refer to the following examples.

  • Set register values:
(gdb) svd_set QUADSPI QUADSPI_LPTR 0x50
  • Set field values:
(gdb) svd_set QUADSPI QUADSPI_LPTR TIMEOUT 0x10

3.4. Loading from an external SVD file[edit source]

This is possible to load an external SVD file:

 (gdb) svd_load_file </path/to/your_file.svd>

4. References[edit source]