tixml2svd 0.1.3

A utility that converts Texas-Instruments device descriptions to standard SVD files
Documentation

tixml2svd

This utility creates SVD files from the Texas-Instruments XML (called TIXML from now on) device and peripheral descriptor files.

Device descriptor files are generally found in the ccsv8/ccs_base/common/targetdb/devices directory of a TI Code Composer installation directory. They contain the names and base addresses of all of the device's peripherals, as well as a the relative path of each peripheral's descriptor file.

Peripheral descriptor files are generally found in the ccsv8/ccs_base/common/targetdb/Modules directory of a TI Code Composer installation directory. They contain the names and addresses of all of the registers belonging to a peripheral.

Usage

Note: tixml2svd requires you to first remove any byte-order-mark (BOM) from your device file. This is a sequence of invisible bytes that appears at the beginning of certain text files.

Here is an one way to copy the device and Module directories into a local work directory and convert the line endings of all files to your platform line endings, with a tool like dos2unix.

mkdir tmp
cp -r /media/sf_ti/ccsv8/ccs_base/common/targetdb/devices tmp
cp -r /media/sf_ti/ccsv8/ccs_base/common/targetdb/Modules tmp
find tmp -type f -exec dos2unix \{\} \;
cd tmp
find devices -name \*.xml -exec sed -i '1s/^\xEF\xBB\xBF//' \{\} \;

Now, process a device file with something like tixml2svd -z -i devices/cc2652r1f.xml > cc2652r1f.svd. If this does not work, try one of the device peripherals all by itself, with something like tixml2svd -p -i Modules/CC26xx/CC26x0R2F/IOC.xml > IOC.svd.

Caveats

I have tested this code on almost all Code Composer version 8 MSP430, MSP432, and CC* wireless devices. When provided with the -z option, it generates a sanitized SVD file that can be used by svd2rust to generate peripheral access code.

Some of the CCSv8 device files contain errors, ununique peripheral, register or field names, or ununique enumeration values. With the sanitize option, tixml2svd deals with most of these problems automatically, but there are a few exceptions. The following patch file makes it possible to apply tixml2svd to all 644 tixml device files on my machine (see below), and successfully generate rust code if rust warnings are permitted by your svd2rust library. Many rust code libraries generated by tixml2svd and svd2rust compile without warnings, but not all of them. The tixml files for some devices may contain mistakes that the compiler is warning you about.

For the moment, tixml2svd utility does not generate SVD device headers. By default, it adds a fake device header that you must modify by hand. This will require a little research on your part. Here is an example of the information you will need to dig up (the following header provides sufficient information for the Segger Ozone debugger, and svd2rust).

<?xml version="1.0" encoding="UTF-8"?>
<device xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.1" xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_0.xsd">
  <name>CC26x0</name>
  <version>2.3</version>
  <description>SimpleLink CC26xx Ultra-low power wireless MCU</description>
  <cpu>
    <name>CM3</name>
    <revision>r2p1</revision>
    <endian>little</endian>
    <mpuPresent>false</mpuPresent>
    <fpuPresent>false</fpuPresent>
    <nvicPrioBits>3</nvicPrioBits>
    <vendorSystickConfig>false</vendorSystickConfig>
  </cpu>
  <addressUnitBits>8</addressUnitBits>
  <width>32</width>
  <size>32</size>
  <access>read-write</access>
  <resetMask>0xFFFFFFFF</resetMask>

This is a list of devices that, after patching, can be converted to SVD:

cc1310f128.xml cc1310f32.xml cc1310f64.xml cc1312r1f3.xml cc1350f128.xml cc1352p1f3.xml cc1352r1f3.xml cc2538nf11.xml cc2538nf23.xml cc2538nf53.xml cc2538sf23.xml cc2538sf53.xml cc2620f128.xml cc2630f128.xml cc2640f128.xml cc2640r2f.xml cc2642r1f.xml cc2650f128.xml cc2652r1f.xml CC430F5123.xml CC430F5125.xml CC430F5133.xml CC430F5135.xml CC430F5137.xml CC430F5143.xml CC430F5145.xml CC430F5147.xml CC430F6125.xml CC430F6126.xml CC430F6127.xml CC430F6135.xml CC430F6137.xml CC430F6143.xml CC430F6145.xml CC430F6147.xml cm2538sf23.xml cm2538sf53.xml MSP430AFE221.xml MSP430AFE222.xml MSP430AFE223.xml MSP430AFE231.xml MSP430AFE232.xml MSP430AFE233.xml MSP430AFE251.xml MSP430AFE252.xml MSP430AFE253.xml MSP430BT5190.xml MSP430C091.xml MSP430C092.xml MSP430C1111.xml MSP430C111.xml MSP430C1121.xml MSP430C112.xml MSP430C1331.xml MSP430C1351.xml MSP430C311S.xml MSP430C312.xml MSP430C313.xml MSP430C314.xml MSP430C315.xml MSP430C323.xml MSP430C325.xml MSP430C336.xml MSP430C337.xml MSP430C412.xml MSP430C413.xml MSP430CG4616.xml MSP430CG4617.xml MSP430CG4618.xml MSP430CG4619.xml MSP430E112.xml MSP430E313.xml MSP430E315.xml MSP430E325.xml MSP430E337.xml MSP430F1101A.xml MSP430F1101.xml MSP430F110.xml MSP430F1111A.xml MSP430F1111.xml MSP430F1121A.xml MSP430F1121.xml MSP430F1122.xml MSP430F112.xml MSP430F1132.xml MSP430F1222.xml MSP430F122.xml MSP430F1232.xml MSP430F123.xml MSP430F133.xml MSP430F135.xml MSP430F1471.xml MSP430F147.xml MSP430F1481.xml MSP430F148.xml MSP430F1491.xml MSP430F149.xml MSP430F155.xml MSP430F156.xml MSP430F157.xml MSP430F1610.xml MSP430F1611.xml MSP430F1612.xml MSP430F167.xml MSP430F168.xml MSP430F169.xml MSP430F2001.xml MSP430F2002.xml MSP430F2003.xml MSP430F2011.xml MSP430F2012.xml MSP430F2013.xml MSP430F2101.xml MSP430F2111.xml MSP430F2112.xml MSP430F2121.xml MSP430F2122.xml MSP430F2131.xml MSP430F2132.xml MSP430F2232.xml MSP430F2234.xml MSP430F2252.xml MSP430F2254.xml MSP430F2272.xml MSP430F2274.xml MSP430F2330.xml MSP430F233.xml MSP430F2350.xml MSP430F235.xml MSP430F2370.xml MSP430F2410.xml MSP430F2416.xml MSP430F2417.xml MSP430F2418.xml MSP430F2419.xml MSP430F2471.xml MSP430F247.xml MSP430F2481.xml MSP430F248.xml MSP430F2491.xml MSP430F249.xml MSP430F2616.xml MSP430F2617.xml MSP430F2618.xml MSP430F2619.xml MSP430F412.xml MSP430F4132.xml MSP430F413.xml MSP430F4152.xml MSP430F415.xml MSP430F417.xml MSP430F423A.xml MSP430F423.xml MSP430F4250.xml MSP430F425A.xml MSP430F425.xml MSP430F4260.xml MSP430F4270.xml MSP430F427A.xml MSP430F427.xml MSP430F4351.xml MSP430F435.xml MSP430F4361.xml MSP430F436.xml MSP430F4371.xml MSP430F437.xml MSP430F438.xml MSP430F439.xml MSP430F447.xml MSP430F4481.xml MSP430F448.xml MSP430F4491.xml MSP430F449.xml MSP430F46161.xml MSP430F4616.xml MSP430F46171.xml MSP430F4617.xml MSP430F46181.xml MSP430F4618.xml MSP430F46191.xml MSP430F4619.xml MSP430F47126.xml MSP430F47127.xml MSP430F47163.xml MSP430F47166.xml MSP430F47167.xml MSP430F47173.xml MSP430F47176.xml MSP430F47177.xml MSP430F47183.xml MSP430F47186.xml MSP430F47187.xml MSP430F47193.xml MSP430F47196.xml MSP430F47197.xml MSP430F477.xml MSP430F4783.xml MSP430F4784.xml MSP430F478.xml MSP430F4793.xml MSP430F4794.xml MSP430F479.xml MSP430F5131.xml MSP430F5132.xml MSP430F5151.xml MSP430F5152.xml MSP430F5171.xml MSP430F5172.xml MSP430F5212.xml MSP430F5213.xml MSP430F5214.xml MSP430F5217.xml MSP430F5218.xml MSP430F5219.xml MSP430F5222.xml MSP430F5223.xml MSP430F5224.xml MSP430F5227.xml MSP430F5228.xml MSP430F5229.xml MSP430F5232.xml MSP430F5234.xml MSP430F5237.xml MSP430F5239.xml MSP430F5242.xml MSP430F5244.xml MSP430F5247.xml MSP430F5249.xml MSP430F5252.xml MSP430F5253.xml MSP430F5254.xml MSP430F5255.xml MSP430F5256.xml MSP430F5257.xml MSP430F5258.xml MSP430F5259.xml MSP430F5304.xml MSP430F5308.xml MSP430F5309.xml MSP430F5310.xml MSP430F5324.xml MSP430F5325.xml MSP430F5326.xml MSP430F5327.xml MSP430F5328.xml MSP430F5329.xml MSP430F5333.xml MSP430F5335.xml MSP430F5336.xml MSP430F5338.xml MSP430F5340.xml MSP430F5341.xml MSP430F5342.xml MSP430F5358.xml MSP430F5359.xml MSP430F5418A.xml MSP430F5418.xml MSP430F5419A.xml MSP430F5419.xml MSP430F5435A.xml MSP430F5435.xml MSP430F5436A.xml MSP430F5436.xml MSP430F5437A.xml MSP430F5437.xml MSP430F5438A.xml MSP430F5438.xml MSP430F5500.xml MSP430F5501.xml MSP430F5502.xml MSP430F5503.xml MSP430F5504.xml MSP430F5505.xml MSP430F5506.xml MSP430F5507.xml MSP430F5508.xml MSP430F5509.xml MSP430F5510.xml MSP430F5513.xml MSP430F5514.xml MSP430F5515.xml MSP430F5517.xml MSP430F5519.xml MSP430F5521.xml MSP430F5522.xml MSP430F5524.xml MSP430F5525.xml MSP430F5526.xml MSP430F5527.xml MSP430F5528.xml MSP430F5529.xml MSP430F5630.xml MSP430F5631.xml MSP430F5632.xml MSP430F5633.xml MSP430F5634.xml MSP430F5635.xml MSP430F5636.xml MSP430F5637.xml MSP430F5638.xml MSP430F5658.xml MSP430F5659.xml MSP430F6433.xml MSP430F6435.xml MSP430F6436.xml MSP430F6438.xml MSP430F6458.xml MSP430F6459.xml MSP430F6630.xml MSP430F6631.xml MSP430F6632.xml MSP430F6633.xml MSP430F6634.xml MSP430F6635.xml MSP430F6636.xml MSP430F6637.xml MSP430F6638.xml MSP430F6658.xml MSP430F6659.xml MSP430F6720A.xml MSP430F6720.xml MSP430F6721A.xml MSP430F6721.xml MSP430F6723A.xml MSP430F6723.xml MSP430F6724A.xml MSP430F6724.xml MSP430F6725A.xml MSP430F6725.xml MSP430F6726A.xml MSP430F6726.xml MSP430F6730A.xml MSP430F6730.xml MSP430F6731A.xml MSP430F6731.xml MSP430F6733A.xml MSP430F6733.xml MSP430F6734A.xml MSP430F6734.xml MSP430F6735A.xml MSP430F6735.xml MSP430F6736A.xml MSP430F6736.xml MSP430F67451A.xml MSP430F67451.xml MSP430F6745A.xml MSP430F6745.xml MSP430F67461A.xml MSP430F67461.xml MSP430F6746A.xml MSP430F6746.xml MSP430F67471A.xml MSP430F67471.xml MSP430F6747A.xml MSP430F6747.xml MSP430F67481A.xml MSP430F67481.xml MSP430F6748A.xml MSP430F6748.xml MSP430F67491A.xml MSP430F67491.xml MSP430F6749A.xml MSP430F6749.xml MSP430F67621A.xml MSP430F67621.xml MSP430F67641A.xml MSP430F67641.xml MSP430F67651A.xml MSP430F67651.xml MSP430F6765A.xml MSP430F6765.xml MSP430F67661A.xml MSP430F67661.xml MSP430F6766A.xml MSP430F6766.xml MSP430F67671A.xml MSP430F67671.xml MSP430F6767A.xml MSP430F6767.xml MSP430F67681A.xml MSP430F67681.xml MSP430F6768A.xml MSP430F6768.xml MSP430F67691A.xml MSP430F67691.xml MSP430F6769A.xml MSP430F6769.xml MSP430F67751A.xml MSP430F67751.xml MSP430F6775A.xml MSP430F6775.xml MSP430F67761A.xml MSP430F67761.xml MSP430F6776A.xml MSP430F6776.xml MSP430F67771A.xml MSP430F67771.xml MSP430F6777A.xml MSP430F6777.xml MSP430F67781A.xml MSP430F67781.xml MSP430F6778A.xml MSP430F6778.xml MSP430F67791A.xml MSP430F67791.xml MSP430F6779A.xml MSP430F6779.xml MSP430FE4232.xml MSP430FE423A.xml MSP430FE423.xml MSP430FE4242.xml MSP430FE4252.xml MSP430FE425A.xml MSP430FE425.xml MSP430FE4272.xml MSP430FE427A.xml MSP430FE427.xml MSP430FG4250.xml MSP430FG4260.xml MSP430FG4270.xml MSP430FG437.xml MSP430FG438.xml MSP430FG439.xml MSP430FG4616.xml MSP430FG4617.xml MSP430FG4618.xml MSP430FG4619.xml MSP430FG477.xml MSP430FG478.xml MSP430FG479.xml MSP430FG6425.xml MSP430FG6426.xml MSP430FG6625.xml MSP430FG6626.xml MSP430FR2000.xml MSP430FR2032.xml MSP430FR2033.xml MSP430FR2100.xml MSP430FR2110.xml MSP430FR2111.xml msp430fr2310.xml msp430fr2311.xml MSP430FR2422.xml MSP430FR2433.xml MSP430FR2512.xml MSP430FR2522.xml MSP430FR2532.xml MSP430FR2533.xml MSP430FR2632.xml MSP430FR2633.xml MSP430FR4131.xml MSP430FR4132.xml MSP430FR4133.xml MSP430FR5041.xml MSP430FR50431.xml MSP430FR5043.xml MSP430FR5720.xml MSP430FR5721.xml MSP430FR5722.xml MSP430FR5723.xml MSP430FR5724.xml MSP430FR5725.xml MSP430FR5726.xml MSP430FR5727.xml MSP430FR5728.xml MSP430FR5729.xml MSP430FR5730.xml MSP430FR5731.xml MSP430FR5732.xml MSP430FR5733.xml MSP430FR5734.xml MSP430FR5735.xml MSP430FR5736.xml MSP430FR5737.xml MSP430FR5738.xml MSP430FR5739.xml MSP430FR58471.xml MSP430FR5847.xml MSP430FR5848.xml MSP430FR5849.xml MSP430FR5857.xml MSP430FR5858.xml MSP430FR5859.xml MSP430FR58671.xml MSP430FR5867.xml MSP430FR5868.xml MSP430FR5869.xml MSP430FR5870.xml MSP430FR58721.xml MSP430FR5872.xml MSP430FR5887.xml MSP430FR5888.xml MSP430FR58891.xml MSP430FR5889.xml MSP430FR59221.xml MSP430FR5922.xml MSP430FR59471.xml MSP430FR5947.xml MSP430FR5948.xml MSP430FR5949.xml MSP430FR5957.xml MSP430FR5958.xml MSP430FR5959.xml msp430fr5962.xml msp430fr5964.xml MSP430FR5967.xml MSP430FR5968.xml MSP430FR59691.xml MSP430FR5969.xml MSP430FR5970.xml MSP430FR59721.xml MSP430FR5972.xml MSP430FR5986.xml MSP430FR5987.xml MSP430FR5988.xml MSP430FR59891.xml MSP430FR5989.xml msp430fr5992.xml MSP430FR59941.xml msp430fr5994.xml MSP430FR6035.xml MSP430FR60371.xml MSP430FR6037.xml MSP430FR6041.xml MSP430FR60431.xml MSP430FR6043.xml MSP430FR6045.xml MSP430FR60471.xml MSP430FR6047.xml MSP430FR6820.xml MSP430FR68221.xml MSP430FR6822.xml MSP430FR6870.xml MSP430FR68721.xml MSP430FR6872.xml MSP430FR6877.xml MSP430FR68791.xml MSP430FR6879.xml MSP430FR6887.xml MSP430FR6888.xml MSP430FR68891.xml MSP430FR6889.xml MSP430FR6920.xml MSP430FR69221.xml MSP430FR6922.xml MSP430FR69271.xml MSP430FR6927.xml MSP430FR6928.xml MSP430FR6970.xml MSP430FR69721.xml MSP430FR6972.xml MSP430FR6977.xml MSP430FR69791.xml MSP430FR6979.xml MSP430FR6987.xml MSP430FR6988.xml MSP430FR69891.xml MSP430FR6989.xml MSP430FW423.xml MSP430FW425.xml MSP430FW427.xml MSP430FW428.xml MSP430FW429.xml MSP430G2001.xml MSP430G2101.xml MSP430G2102.xml MSP430G2111.xml MSP430G2112.xml MSP430G2113.xml MSP430G2121.xml MSP430G2131.xml MSP430G2132.xml MSP430G2152.xml MSP430G2153.xml MSP430G2201.xml MSP430G2202.xml MSP430G2203.xml MSP430G2210.xml MSP430G2211.xml MSP430G2212.xml MSP430G2213.xml MSP430G2221.xml MSP430G2230.xml MSP430G2231.xml MSP430G2232.xml MSP430G2233.xml MSP430G2252.xml MSP430G2253.xml MSP430G2302.xml MSP430G2303.xml MSP430G2312.xml MSP430G2313.xml MSP430G2332.xml MSP430G2333.xml MSP430G2352.xml MSP430G2353.xml MSP430G2402.xml MSP430G2403.xml MSP430G2412.xml MSP430G2413.xml MSP430G2432.xml MSP430G2433.xml MSP430G2444.xml MSP430G2452.xml MSP430G2453.xml MSP430G2513.xml MSP430G2533.xml MSP430G2544.xml MSP430G2553.xml MSP430G2744.xml MSP430G2755.xml MSP430G2855.xml MSP430G2955.xml MSP430i2020.xml MSP430i2021.xml MSP430i2030.xml MSP430i2031.xml MSP430i2040.xml MSP430i2041.xml MSP430L092.xml MSP430P112.xml MSP430P313.xml MSP430P315S.xml MSP430P315.xml MSP430P325.xml MSP430P337.xml MSP430SL5438A.xml MSP430TCH5E.xml msp432e401y.xml msp432e411y.xml msp432p4011.xml msp432p401m.xml msp432p401r.xml msp432p401v.xml msp432p401y.xml msp432p4111.xml msp432p411v.xml msp432p411y.xml RF430F5144.xml RF430F5155.xml RF430F5175.xml RF430FRL152H.xml RF430FRL153H.xml RF430FRL154H.xml