2020-02-27 03:57 AM
I started small project, where I use "db/plugins/clock" XML file(s) from CubeMX to visualize the state of the clock-tree in the running STM32.
Currently I face number of issues. Mybee you can direct me to other resources more suitable than CubeMX files or you can help me to clarify some of the issues below.
I was able to parse clock XML and draw clock-tree using graphviz, however I have a problem with connecting schematic elements with the register file (loaded from device's SVD). Examples are taken from STM32L0.xml.
The Idea is to parse register/fiels names (from anywhere) and connect it with the schematic elements (MUX, DIV, MULT).
What I need is to connect e.g. RTCClkSource MUX with the register containing MUX inputs to be able to decide which input is active. The same holds also for dividers and multipliers and their values. The problem is, that the name e.g. RTCClkSource (and also its refVals) are unique for CubeMX files. E.g. in the Low-Level drivers, the funcion name to get register values is "LL_RCC_GetRTCClockSource". Here Clk->Clock.
Similar confusion arises for many elements. Sometimes names are "very" different (e.g. PLLSource<->MainSource), while some names/references are equal (e.g. SysClkSource) - I observed no general rules - automatic extraction seems to be problematic. So i expect, that schematic description is generated from hand-written code (RTL?).
Is there any option to avoid hand-work when I want to obtain MUX/DIV/MULT register values (REG/Field symbolic names)?
Is there any resource along these CubeMX db files I missed?
Is there any plan to release other peripheral schematic description (e.g. UART, SPI) along the RCC in the future?
There are there are some problems with semantics and consistence:
<Input from="HSERTCDevisor" signalId="HSE_RTC"/>
<Input from="LSEOSC" refValue="RCC_RTCCLKSOURCE_LSE" signalId="LSE"/>
<Element id="I2C1Mult" refEnable="I2C1Enable" refParameter="I2c1ClockSelection" type="multiplexor" x="965" y="571">
<Condition Diagnostic="" Expression="!LPUART1_Exist"/>
<Input from="APB1Prescaler" refValue="RCC_I2C1CLKSOURCE_PCLK1" signalId="PCLK1"/>
<Input from="HSIRCDiv" refValue="RCC_I2C1CLKSOURCE_HSI" signalId="HSI"/>
<Input from="SysCLKOutput" refValue="RCC_I2C1CLKSOURCE_SYSCLK" signalId="SYSCLKOUT"/>
<Output signalId="I2C1CLK" to="I2C1Output"/>
</Element>
<Element id="I2C1Mult" refEnable="I2C1Enable" refParameter="I2c1ClockSelection" type="multiplexor" x="965" y="553">
<Input from="APB1Prescaler" refValue="RCC_I2C1CLKSOURCE_PCLK1" signalId="PCLK1"/>
<Input from="HSIRCDiv" refValue="RCC_I2C1CLKSOURCE_HSI" signalId="HSI"/>
<Input from="SysCLKOutput" refValue="RCC_I2C1CLKSOURCE_SYSCLK" signalId="SYSCLKOUT"/>
<Output signalId="I2C1CLK" to="I2C1Output"/>
</Element>
2020-02-27 04:15 AM
I parse these XML devices to get a list of PIN and DMA remap possibilities in http://svn.code.sf.net/p/ethernut/code/trunk/nut/tools/helpers/stm32/
2020-02-27 05:58 AM
Hello!
The list of PINS or Lst of possible values is not a problem.
The problem is (mainly) with mapping of MUX control input (or divider/multiplier value for RCC) with register names (or addresses) and register fields (or field offset+length) to be able to obtain these values automatically by GDB from running MCU.