ARM Support

DMON v2 integrates the Segger J Link debug link and adds proof of concept support for a single ARM target - STM32L152VB. The Segger J Link supports a huge number of processors, see https://www.segger.com/jlink_supported_devices.html . DMON2 customers can request support for additional ARM devices.
The following command line options must be passed to DMON for this mode:
:-arm Start DMON in ARM mode and load ARM specific commands
:-segger Use Segger J-Link
:-device STM32L152VB	specify the device for Segger 
:-swd Use the Serial Wire Debug interface (SWD). If not specified then Segger will use JTAG to communicate with the target. The use of SWD is optional but recommended.
When DMON is started with the appropriate ARM switches information about the link discovered is displayed (as below).
The device configuration for the ARM target is read from an ARM CSMIS SVD file which describes the peripheral devices and their registers. In this version this SVD file is included as part of the built DMON and only this file is loaded and used.
The output below shows device and peripheral information.
 
Name of the device STM32L152VB
Core id of the device 0x4BA00477
CPU core CORTEX_M3
Device manufacturer ST
Start address of flash area 0x08000000
Start address of RAM area 0x20000000
0=Little, 1=Big, 2=Both 0
Total flash size in bytes 132 KB
Total RAM size in bytes 16 KB
Flash regions :
 Start Address: 0x08000000 
 Size: 128 KB
 Start Address: 0x08080000 
 Size: 4 KB
RAM regions :
 Start Address : 0x20000000 
 Size : 16 KB
OEM : IAR
Target Voltage = 3.338 V
Connected with SWD
Identified ::: Cortex-M3 core
Target interface speed: 1000 kHz
Peripheral Devices:
C_ADC Common ADC registers N/A 
COMP Comparators N/A 
CRC CRC calculation unit N/A 
DAC Digital-to-analog converter N/A 
DMA1 Direct memory access controller N/A 
EXTI External interrupt/event controller N/A 
Flash Flash N/A 
GPIOA General-purpose I/Os N/A 
GPIOB General-purpose I/Os N/A 
GPIOC General-purpose I/Os N/A 
GPIOD General-purpose I/Os N/A 
GPIOE General-purpose I/Os N/A 
GPIOH General-purpose I/Os N/A 
I2C1 Inter-integrated circuit N/A 
I2C2 Inter-integrated circuit N/A 
IWDG Independent watchdog N/A 
LCD Liquid crystal display controller N/A 
PWR Power control N/A 
RCC Reset and clock control N/A 
RI Routing interface N/A 
RTC Real-time clock N/A 
SPI1 Serial peripheral interface N/A 
SPI2 Serial peripheral interface N/A 
SYSCFG System configuration controller N/A 
TIM10 General-purpose timers N/A 
TIM11 General-purpose timers N/A 
TIM2 General-purpose timers N/A 
TIM3 General-purpose timers N/A 
TIM4 General-purpose timers N/A 
TIM6 Basic timers N/A 
TIM7 Basic timers N/A 
TIM9 General-purpose timers N/A 
USART1 Universal synchronous asynchronous receiver transmitter N/A 
USART2 Universal synchronous asynchronous receiver transmitter N/A 
USART3 Universal synchronous asynchronous receiver transmitter N/A 
USB Universal serial bus full-speed device interface N/A 
USB_SRAM Universal serial bus full-speed device interface N/A 
WWDG Window watchdog N/A 
ADC Analog-to-digital converter N/A 
NVIC Nested Vectored Interrupt Controller N/A 
DBG Debug support N/A 
 
The SVD is used create objects for each peripheral device, to build a layout diagram for the SoC with the same functionality as for SPARC devices, and a widget with a drop down list of the registers for each peripheral.
There is also an object and widget for the CPU (see below).
On-chip IP blocks can be selected and their registers viewed and modified through the GUI.
== ARM supported DMON commands ==
When in ARM mode the console supports the following commands:
	Command		Description
		about		display information about DMON version
		breakh <addr|symbol>		display breakpoints or add hardware breakpoint
		breaks <addr|symbol>		display or add software breakpoint
		clear <num|address>		delete all breakpoints or breakpoint at number or address
		cls		clear console
		code <addr|PC> <length> <mode>		Disassemble <length> instructions starting at <address> or current PC using <mode> (ARM or Thumb).Default mode is the currently set mode, this will normally correctly recognise whether the instruction is ARM or Thumb.
		continue		continue execution
		datamon load [filename]		load a DataSet from an xml file
		datamon save [filename]		save the current DataSet to an xml file
		datamon start		Validate the current DataSet if successful, start monitoring
		datamon stop		stop monitoring
		datamon xsd [filename]		save schema for DataSet to the specified file
		devreg		list available devices
		devreg <name>		display registers in <name>
		devreg <name> <regname>		display register detail for <regname> in <name>
		devreg <name> <regname> <value>		Write <value> to <regname> in <name>
		devreg <name> list		list register names in <name>
		dmon		Use only DMON commands. Ignored if already in DMON mode
		echo [string]		display string in the console (and log file if active)
		examine [addr] <length>		display memory
		exec [command]		execute shell command in OS
		flash erase		erase flash device
		font		show current font
		font list		list system fonts
		font reset		reset the font to the default
		font set [value]		set font
		gb2312		Use GB2312 character set for displaying memory data
		getb [address] <count>		Returns a byte or array of <count> bytes in the command response (for scripting in Tcl)
		getstate		returns 1 if an application is running on the target, 0 otherwise. (for scripting in Tcl)
		getw [address] <count>		Returns a word or array of <count> words in the command response
		halt		stop program on board
		help <command>		display commands or command
		info dev		list devices available for info dev command
		info dev <name>		display information for device <name>
		info sys		display basic system information
		log [file_name]		open log file or create new and output some system information
		loglevel [level]		set internal logging to level. Possible levels [verbose|restore|info|warn|error]
		logoff		stop output to file
		lookup [hex value]		show the ELF symbol matching the hex address
		lookup [symbol or expression]		show the value of the symbol (internal or ELF)
		pause -1		pause script until processor stops
		pause [duration in ms]		pause script until duration has elapsed or processor stops
		precont [filename]		append a script to the user scripts executed before continuing/stepping a program
		precont insert [index] [filename]		insert a script at [index] in the user scripts executed before continuing/stepping a program
		precont list		list the user scripts executed before continuing/stepping a program
		precont remove [index|all]		remove the script at [index] in the user scripts or all scripts executed before continuing/stepping a program
		prerun [filename]		append a script to the user scripts executed before starting a program
		prerun insert [index] [filename]		insert a script at [index] in the user scripts executed before starting a program
		prerun list		list the user scripts executed before starting a program
		prerun remove [index|all]		remove the script at [index] in the user scripts or all scripts executed before starting a program
		printreg		display system registers
		python		Interpret command input as Python commands. Ignored if in Python mode
		quit		exit DMON
		reg		show values for all available CPU registers
		reg <name>		show register named
		reg <name> <value>		write value to register named
		reg show		show available register names
		run <pc>		start the CPU from <pc>
		runscript [filename]		set the user script executed during program execution
		runscript list		list the user script executed during program execution
		runscript remove		clear the user script executed during program execution
		save [addr] [addr] [file] <bin>		dump target memory to file in srecord (or binary) format
		script [file_name]		execute a batch file of DMON commands
		setv [label] [expression]		Sets a DMON label to have a 64 bit integer value
		shell		In a startup script activate the language specified by command line option. Otherwise, display the langauge in use.
		step <n>		single step one or <n> times
		stop		Invoked on CTRL-C. Abort DMON command,stop program on board
		symbols <file>		show/load symbols
		tcl		Interpret command input as Tcl commands. Ignored if in Tcl mode
		utf8		Use UTF-8 character set for displaying memory and UART data
		watch <addr|symbol>		display all breakpoint or add data watchpoint on read or write
		watchr <addr|symbol>		display all breakpoint or add data watchpoint on read
		watchw <addr|symbol>		display all breakpoint or add data watchpoint on write
		write [addr] [data] <number words>		write one word of data to "number words" starting from addr
== ARM specific commands ==
 
The devreg commands are specific to ARM peripherals, and display or modify the registers in a specified peripheral:
 
DMON > devreg
Available devices:
ADC COMP CRC C_ADC 
DAC DBG DMA1 EXTI 
FLASH GPIOA GPIOB GPIOC 
GPIOD GPIOE GPIOH I2C1 
I2C2 IWDG LCD NVIC 
PWR RCC RI RTC 
SPI1 SPI2 SYSCFG TIM10 
TIM11 TIM2 TIM3 TIM4 
TIM6 TIM7 TIM9 USART1 
USART2 USART3 USB USB_SRAM 
WWDG 
DMON > devreg gpioe
GPIOE
 0x40021000 GPIO port mode (MODER) 0x00500000 
 0x40021004 GPIO port output type (OTYPER) 0x00000000 
 0x40021008 GPIO port output speed (OSPEEDER) 0x00f00000 
 0x4002100c GPIO port pull-up/pull-down (PUPDR) 0x00000000 
 0x40021010 GPIO port input data (IDR) 0x00001000 
 0x40021014 GPIO port output data (ODR) 0x00000000 
 0x40021018 GPIO port bit set/reset (BSRR) 0x00000000 
 0x4002101c GPIO port configuration lock (LCKR) 0x00000000 
 0x40021020 AFRL (AFRL) 0x00000000 
 0x40021024 GPIO alternate function high (AFRH) 0x00000000 
DMON > devreg gpioe odr 0xffffffff
Wrote value 0xffffffff to odr
DMON > devreg gpioe
GPIOE
 0x40021000 GPIO port mode (MODER) 0x00500000 
 0x40021004 GPIO port output type (OTYPER) 0x00000000 
 0x40021008 GPIO port output speed (OSPEEDER) 0x00f00000 
 0x4002100c GPIO port pull-up/pull-down (PUPDR) 0x00000000 
 0x40021010 GPIO port input data (IDR) 0x00001c00 
 0x40021014 GPIO port output data (ODR) 0x0000ffff 
 0x40021018 GPIO port bit set/reset (BSRR) 0x00000000 
 0x4002101c GPIO port configuration lock (LCKR) 0x00000000 
 0x40021020 AFRL (AFRL) 0x00000000 
 0x40021024 GPIO alternate function high (AFRH) 0x00000000