LibrePCB / stm-db

Collection of STM(8|32) pinout description files in JSON format, exported from STM(8|32)CubeMX.
MIT License
2 stars 0 forks source link

Parse cube-finder-db.db and include MPNs in output #6

Open ubruhin opened 1 year ago

ubruhin commented 1 year ago

I saw that in the STM32 database directory there's also an SQLite database including the exact MPNs for all MCUs. Since the MPNs are now useful for LibrePCB (to export accurate BOMs), I extended the script to also extract that data from this database and include it in the generated JSON files.

Example output (new node parts):

{
  "names": {
    "name": "STM32C011D6Yx",
    "ref": "STM32C011D6Yx",
    "family": "STM32C0",
    "line": "STM32C0x1",
    "rpn": "STM32C011D6"
  },
  "package": "WLCSP12",
  "silicon": {
    "core": "ARM Cortex-M0+",
    "die": "DIE443"
  },
  "info": {
    "flash": 32,
    "ram": 6,
    "io": 10,
    "frequency": 48,
    "voltage": {
      "min": 2.0,
      "max": 3.6
    },
    "temperature": {
      "min": -40.0,
      "max": 85.0
    }
  },
  "parts": [
    {
      "mpn": "STM32C011D6Y6TR",
      "temperature_min": -40.0,
      "temperature_max": 85.0,
      "packing_type": "Tape and Reel",
      "status": "Active"
    },
    {
      "mpn": "STM32C011D6Y3TR",
      "temperature_min": -40.0,
      "temperature_max": 125.0,
      "packing_type": "Tape and Reel",
      "status": "Coming soon"
    }
  ],
  "gpio_version": "STM32C0xx_gpio_v1_0",
  /* ... */
}

Note that the temperature min/max are now redundant in the output files, but it makes sense to have them in the parts section because they may be different for the different MPNs. We might consider removing them from the outer node now...

In addition, there are actually many more attributes stored in the database but for now I extracted only 5 of them which are most useful for LibrePCB. One might argue that we should include all existing data into the JSON files(?)

Regarding license, probably it doesn't make a difference whether we fetch data from an XML file or from an SQLite database so I suspect this change does not affect the license situation of our generated parts.

TODO:

/cc @dbrgn