The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

The New Hotness

  • Kicad-to-HAL: Annotation Stripping

    Kicad insists on annotating every component with a numeric suffix that can change depending on the sequence of components encountered during the annotation process. HAL, on the other hand, identifies multiple components using a numeric value as a suffix or embedded within the reference. HAL also has singleton components without a numeric value.

    A Moby Hack™ merges the two systems: Kicad will annotate each of its components, then Kicad-to-HAL can strip the annotation from the reference to form the HAL identifier.

    A Kicad component with a StripAnno field containing a “1” will trigger the stripping:

    Kicad Symbol Properties - HM2_5I25
    Kicad Symbol Properties – HM2_5I25

    The StripAnno digit (generally) appears to the right of the component name. A Kicad component without a StripAnno field or with the field containing anything other than “1” will pass its reference field directly into the HAL component.

    The Kicad reference for the HM2_5I25 component (center right) is hm2_5i25.0.0 and its stripped HAL reference is hm2_5i25.0:

    addf hm2_5i25.0.read		servo-thread
    

    The THREAD component (center bottom) is a singleton, because there will be only one component with a given thread name:

    Kicad symbol - THREAD
    Kicad symbol – THREAD

    The Kicad reference appends a zero to make servo-thread.0:

    Kicad-to-HAL Demo Schematic
    Kicad-to-HAL Demo Schematic

    The stripped HAL reference, as used in addf statements, is just servo-thread:

    addf and2.0		servo-thread
    addf constant.0		servo-thread
    addf constant.1		servo-thread
    addf not.0		servo-thread
    addf timedelay.0		servo-thread
    addf toggle.0		servo-thread
    

    Every Kicad symbol must have a reference ending with a period so Kicad-to-HAL can strip the trailing annotation value.