https://github.com/cmsis-svd/cmsis-svd
"What is CMSIS-SVD
ARM provides the following description of CMSIS-SVD (System View Description)
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.
How Can the CMSIS-SVD Be Used
The generic description of each MCUs CPU and hardware registers is very valuable when generating code that can be used for talking to specific target hardware. In fact, much of the code in parts of CMSIS itself are generated based on the SVD. ARM distributes an executable that does this transformation (SVDConvert.exe).
The information can also be used for building debug tooling, test infrastructure, or whatever else."
For example (ESPRESSIF Boards):
https://github.com/cmsis-svd/cmsis-svd- ... /Espressif
It's amazing how much easier it is to access and manipulate registers, using SVD with TinyGo.
https://github.com/tinygo-org/tinygo
ESP32 - all models - Does anyone use SVD files?
- jgustavoam
- Posts: 173
- Joined: Thu Feb 01, 2018 2:43 pm
- Location: Belo Horizonte , Brazil
- Contact:
- jgustavoam
- Posts: 173
- Joined: Thu Feb 01, 2018 2:43 pm
- Location: Belo Horizonte , Brazil
- Contact:
Re: ESP32 - all models - Does anyone use SVD files?
Compiling gen-dev-svd tool :
https://github.com/tinygo-org/tinygo/tr ... device-svd
mkdir out
go build gen-device-svd.go
Generating esp32.go and esp32.s:
https://github.com/cmsis-svd/cmsis-svd- ... /Espressif
gen-device-svd ./ ./out
https://github.com/tinygo-org/tinygo/tr ... device-svd
mkdir out
go build gen-device-svd.go
Code: Select all
C:\Users\jgust\tinygo\programas\esp32\gen-device-svd>go build gen-device-svd.go
C:\Users\jgust\tinygo\programas\esp32\gen-device-svd>dir
O volume na unidade C não tem nome.
O Número de Série do Volume é DAAF-F4A4
Pasta de C:\Users\jgust\tinygo\programas\esp32\gen-device-svd
28/07/2025 12:44 <DIR> .
28/07/2025 12:43 <DIR> ..
05/01/2025 08:08 1.726.633 esp32.svd
28/07/2025 12:42 5.019.648 gen-device-svd.exe
28/07/2025 12:18 44.948 gen-device-svd.go
28/07/2025 12:22 <DIR> out
3 arquivo(s) 6.791.229 bytes
3 pasta(s) 111.886.942.208 bytes disponíveisGenerating esp32.go and esp32.s:
https://github.com/cmsis-svd/cmsis-svd- ... /Espressif
gen-device-svd ./ ./out
Code: Select all
C:\Users\jgust\tinygo\programas\esp32\gen-device-svd>gen-device-svd ./ ./out
esp32.svd
C:\Users\jgust\tinygo\programas\esp32\gen-device-svd>cd out
C:\Users\jgust\tinygo\programas\esp32\gen-device-svd\out>dir
O volume na unidade C não tem nome.
O Número de Série do Volume é DAAF-F4A4
Pasta de C:\Users\jgust\tinygo\programas\esp32\gen-device-svd\out
28/07/2025 12:47 <DIR> .
28/07/2025 12:44 <DIR> ..
28/07/2025 12:47 3.383.829 esp32.go
28/07/2025 12:47 6.342 esp32.s
2 arquivo(s) 3.390.171 bytes
2 pasta(s) 111.636.013.056 bytes disponíveisRetired IBM Brasil
Electronic hobbyist since 1976.
Electronic hobbyist since 1976.
- jgustavoam
- Posts: 173
- Joined: Thu Feb 01, 2018 2:43 pm
- Location: Belo Horizonte , Brazil
- Contact:
Re: ESP32 - all models - Does anyone use SVD files?
Some code of esp32.go :
Code: Select all
// SPI (Serial Peripheral Interface) Controller 0
SPI0 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff43000)))
// Timer Group 0
TIMG0 = (*TIMG_Type)(unsafe.Pointer(uintptr(0x3ff5f000)))
// Two-Wire Automotive Interface
TWAI0 = (*TWAI_Type)(unsafe.Pointer(uintptr(0x3ff6b000)))
// UART (Universal Asynchronous Receiver-Transmitter) Controller 0
UART0 = (*UART_Type)(unsafe.Pointer(uintptr(0x3ff40000)))
// Universal Host Controller Interface 0
UHCI0 = (*UHCI_Type)(unsafe.Pointer(uintptr(0x3ff54000)))
// I2C (Inter-Integrated Circuit) Controller 1
I2C1 = (*I2C_Type)(unsafe.Pointer(uintptr(0x3ff67000)))
// I2S (Inter-IC Sound) Controller 1
I2S1 = (*I2S_Type)(unsafe.Pointer(uintptr(0x3ff6d000)))
// Motor Control Pulse-Width Modulation 1
MCPWM1 = (*MCPWM_Type)(unsafe.Pointer(uintptr(0x3ff6c000)))
// SPI (Serial Peripheral Interface) Controller 1
SPI1 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff42000)))
// SPI (Serial Peripheral Interface) Controller 2
SPI2 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff64000)))
// SPI (Serial Peripheral Interface) Controller 3
SPI3 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff65000)))
// Timer Group 1
TIMG1 = (*TIMG_Type)(unsafe.Pointer(uintptr(0x3ff60000)))
// UART (Universal Asynchronous Receiver-Transmitter) Controller 1
UART1 = (*UART_Type)(unsafe.Pointer(uintptr(0x3ff50000)))
// UART (Universal Asynchronous Receiver-Transmitter) Controller 2
UART2 = (*UART_Type)(unsafe.Pointer(uintptr(0x3ff6e000)))
// Universal Host Controller Interface 1
UHCI1 = (*UHCI_Type)(unsafe.Pointer(uintptr(0x3ff4c000)))Code: Select all
func (o *DPORT_Type) SetPERIP_CLK_EN_UART1_CLK_EN( value uint32) {
volatile.StoreUint32(&o.PERIP_CLK_EN.Reg, volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&^(0x20)|value<<5)
}
func (o *DPORT_Type) GetPERIP_CLK_EN_UART1_CLK_EN() uint32 {
return (volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&0x20) >> 5
}
func (o *DPORT_Type) SetPERIP_CLK_EN_SPI2_CLK_EN( value uint32) {
volatile.StoreUint32(&o.PERIP_CLK_EN.Reg, volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&^(0x40)|value<<6)
}
func (o *DPORT_Type) GetPERIP_CLK_EN_SPI2_CLK_EN() uint32 {
return (volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&0x40) >> 6
}
func (o *DPORT_Type) SetPERIP_CLK_EN_I2C0_EXT0_CLK_EN( value uint32) {
volatile.StoreUint32(&o.PERIP_CLK_EN.Reg, volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&^(0x80)|value<<7)
}
func (o *DPORT_Type) GetPERIP_CLK_EN_I2C0_EXT0_CLK_EN() uint32 {
return (volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&0x80) >> 7
}Retired IBM Brasil
Electronic hobbyist since 1976.
Electronic hobbyist since 1976.
- jgustavoam
- Posts: 173
- Joined: Thu Feb 01, 2018 2:43 pm
- Location: Belo Horizonte , Brazil
- Contact:
Re: ESP32 - all models - Does anyone use SVD files?
Some code of esp32.go :
Code: Select all
// SPI (Serial Peripheral Interface) Controller 0
SPI0 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff43000)))
// Timer Group 0
TIMG0 = (*TIMG_Type)(unsafe.Pointer(uintptr(0x3ff5f000)))
// Two-Wire Automotive Interface
TWAI0 = (*TWAI_Type)(unsafe.Pointer(uintptr(0x3ff6b000)))
// UART (Universal Asynchronous Receiver-Transmitter) Controller 0
UART0 = (*UART_Type)(unsafe.Pointer(uintptr(0x3ff40000)))
// Universal Host Controller Interface 0
UHCI0 = (*UHCI_Type)(unsafe.Pointer(uintptr(0x3ff54000)))
// I2C (Inter-Integrated Circuit) Controller 1
I2C1 = (*I2C_Type)(unsafe.Pointer(uintptr(0x3ff67000)))
// I2S (Inter-IC Sound) Controller 1
I2S1 = (*I2S_Type)(unsafe.Pointer(uintptr(0x3ff6d000)))
// Motor Control Pulse-Width Modulation 1
MCPWM1 = (*MCPWM_Type)(unsafe.Pointer(uintptr(0x3ff6c000)))
// SPI (Serial Peripheral Interface) Controller 1
SPI1 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff42000)))
// SPI (Serial Peripheral Interface) Controller 2
SPI2 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff64000)))
// SPI (Serial Peripheral Interface) Controller 3
SPI3 = (*SPI_Type)(unsafe.Pointer(uintptr(0x3ff65000)))
// Timer Group 1
TIMG1 = (*TIMG_Type)(unsafe.Pointer(uintptr(0x3ff60000)))
// UART (Universal Asynchronous Receiver-Transmitter) Controller 1
UART1 = (*UART_Type)(unsafe.Pointer(uintptr(0x3ff50000)))
// UART (Universal Asynchronous Receiver-Transmitter) Controller 2
UART2 = (*UART_Type)(unsafe.Pointer(uintptr(0x3ff6e000)))
// Universal Host Controller Interface 1
UHCI1 = (*UHCI_Type)(unsafe.Pointer(uintptr(0x3ff4c000)))Code: Select all
func (o *DPORT_Type) SetPERIP_CLK_EN_UART1_CLK_EN( value uint32) {
volatile.StoreUint32(&o.PERIP_CLK_EN.Reg, volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&^(0x20)|value<<5)
}
func (o *DPORT_Type) GetPERIP_CLK_EN_UART1_CLK_EN() uint32 {
return (volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&0x20) >> 5
}
func (o *DPORT_Type) SetPERIP_CLK_EN_SPI2_CLK_EN( value uint32) {
volatile.StoreUint32(&o.PERIP_CLK_EN.Reg, volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&^(0x40)|value<<6)
}
func (o *DPORT_Type) GetPERIP_CLK_EN_SPI2_CLK_EN() uint32 {
return (volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&0x40) >> 6
}
func (o *DPORT_Type) SetPERIP_CLK_EN_I2C0_EXT0_CLK_EN( value uint32) {
volatile.StoreUint32(&o.PERIP_CLK_EN.Reg, volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&^(0x80)|value<<7)
}
func (o *DPORT_Type) GetPERIP_CLK_EN_I2C0_EXT0_CLK_EN() uint32 {
return (volatile.LoadUint32(&o.PERIP_CLK_EN.Reg)&0x80) >> 7
}Retired IBM Brasil
Electronic hobbyist since 1976.
Electronic hobbyist since 1976.
Who is online
Users browsing this forum: ChatGPT-User and 5 guests