This one for symbol <-> footprint.  (Original was for
lib footprint <-> board footprint.)

Also fixes a major bug in DRC where we bail out of parity
checking if DRCE_MISSING_FOOTPRINT is set to ignore (or
overflows).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16671
This commit is contained in:
Jeff Young 2024-01-20 18:41:11 +00:00
parent d854de9d68
commit 13935399a5
7 changed files with 51 additions and 12 deletions

View File

@ -176,6 +176,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_DRCSeverities[ DRCE_DUPLICATE_FOOTPRINT ] = RPT_SEVERITY_WARNING;
m_DRCSeverities[ DRCE_EXTRA_FOOTPRINT ] = RPT_SEVERITY_WARNING;
m_DRCSeverities[ DRCE_NET_CONFLICT ] = RPT_SEVERITY_WARNING;
m_DRCSeverities[ DRCE_SCHEMATIC_PARITY_ISSUES ] = RPT_SEVERITY_WARNING;
m_DRCSeverities[ DRCE_OVERLAPPING_SILK ] = RPT_SEVERITY_WARNING;
m_DRCSeverities[ DRCE_SILK_CLEARANCE ] = RPT_SEVERITY_WARNING;

View File

@ -1192,7 +1192,8 @@ void DIALOG_DRC::updateDisplayedCounts()
else if( ii == DRCE_MISSING_FOOTPRINT
|| ii == DRCE_DUPLICATE_FOOTPRINT
|| ii == DRCE_EXTRA_FOOTPRINT
|| ii == DRCE_NET_CONFLICT )
|| ii == DRCE_NET_CONFLICT
|| ii == DRCE_SCHEMATIC_PARITY_ISSUES )
{
if( showWarnings && bds.GetSeverity( ii ) == RPT_SEVERITY_WARNING )
footprintsOverflowed = true;

View File

@ -181,6 +181,10 @@ DRC_ITEM DRC_ITEM::netConflict( DRCE_NET_CONFLICT,
_( "Pad net doesn't match schematic" ),
wxT( "net_conflict" ) );
DRC_ITEM DRC_ITEM::schematicParityIssues( DRCE_SCHEMATIC_PARITY_ISSUES,
_( "Footprint attributes don't match symbol" ),
wxT( "footprint_symbol_mismatch" ) );
DRC_ITEM DRC_ITEM::libFootprintIssues( DRCE_LIB_FOOTPRINT_ISSUES,
_( "Footprint not found in libraries" ),
wxT( "lib_footprint_issues" ) );
@ -287,6 +291,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
DRC_ITEM::duplicateFootprints,
DRC_ITEM::missingFootprint,
DRC_ITEM::extraFootprint,
DRC_ITEM::schematicParityIssues,
DRC_ITEM::netConflict,
DRC_ITEM::unconnectedItems,
@ -359,6 +364,7 @@ std::shared_ptr<DRC_ITEM> DRC_ITEM::Create( int aErrorCode )
case DRCE_DUPLICATE_FOOTPRINT: return std::make_shared<DRC_ITEM>( duplicateFootprints );
case DRCE_NET_CONFLICT: return std::make_shared<DRC_ITEM>( netConflict );
case DRCE_EXTRA_FOOTPRINT: return std::make_shared<DRC_ITEM>( extraFootprint );
case DRCE_SCHEMATIC_PARITY_ISSUES: return std::make_shared<DRC_ITEM>( schematicParityIssues );
case DRCE_LIB_FOOTPRINT_ISSUES: return std::make_shared<DRC_ITEM>( libFootprintIssues );
case DRCE_LIB_FOOTPRINT_MISMATCH: return std::make_shared<DRC_ITEM>( libFootprintMismatch );
case DRCE_UNRESOLVED_VARIABLE: return std::make_shared<DRC_ITEM>( unresolvedVariable );

View File

@ -71,6 +71,7 @@ enum PCB_DRC_CODE {
DRCE_DUPLICATE_FOOTPRINT, // more than one footprints found for netlist item
DRCE_EXTRA_FOOTPRINT, // netlist item not found for footprint
DRCE_NET_CONFLICT, // pad net doesn't match netlist
DRCE_SCHEMATIC_PARITY_ISSUES, // footprint attributes don't match symbol attributes
DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
DRCE_LIB_FOOTPRINT_ISSUES, // footprint not found in active libraries
@ -187,6 +188,7 @@ private:
static DRC_ITEM missingFootprint;
static DRC_ITEM extraFootprint;
static DRC_ITEM netConflict;
static DRC_ITEM schematicParityIssues;
static DRC_ITEM libFootprintIssues;
static DRC_ITEM libFootprintMismatch;
static DRC_ITEM unresolvedVariable;

View File

@ -38,6 +38,7 @@
- DRCE_MISSING_FOOTPRINT
- DRCE_DUPLICATE_FOOTPRINT
- DRCE_EXTRA_FOOTPRINT
- DRCE_SCHEMATIC_PARITY_ISSUES
TODO:
- cross-check PCB netlist against SCH netlist
@ -109,21 +110,47 @@ void DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist( NETLIST& aNetlist )
if( footprint == nullptr )
{
if( m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_FOOTPRINT ) )
break;
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_FOOTPRINT ) )
{
wxString msg;
msg.Printf( _( "Missing footprint %s (%s)" ),
component->GetReference(),
component->GetValue() );
wxString msg;
msg.Printf( _( "Missing footprint %s (%s)" ),
component->GetReference(),
component->GetValue() );
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_FOOTPRINT );
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_FOOTPRINT );
drcItem->SetErrorMessage( msg );
reportViolation( drcItem, VECTOR2I(), UNDEFINED_LAYER );
drcItem->SetErrorMessage( msg );
reportViolation( drcItem, VECTOR2I(), UNDEFINED_LAYER );
}
}
else
{
if( ( component->GetProperties().count( "dnp" ) > 0 )
!= ( ( footprint->GetAttributes() & FP_DNP ) > 0 )
&& !m_drcEngine->IsErrorLimitExceeded( DRCE_SCHEMATIC_PARITY_ISSUES ) )
{
wxString msg;
msg.Printf( _( "'%s' settings differ." ), _( "Do not populate" ) );
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_SCHEMATIC_PARITY_ISSUES );
drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS( ": " ) + msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
if( ( component->GetProperties().count( "exclude_from_bom" ) > 0 )
!= ( (footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM ) > 0 )
&& !m_drcEngine->IsErrorLimitExceeded( DRCE_SCHEMATIC_PARITY_ISSUES ) )
{
wxString msg;
msg.Printf( _( "'%s' settings differ." ), _( "Exclude from bill of materials" ) );
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_SCHEMATIC_PARITY_ISSUES );
drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS( ": " ) + msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
}
for( PAD* pad : footprint->Pads() )
{
if( m_drcEngine->IsErrorLimitExceeded( DRCE_NET_CONFLICT ) )

View File

@ -68,6 +68,7 @@ PCB_MARKER::PCB_MARKER( std::shared_ptr<RC_ITEM> aItem, const VECTOR2I& aPositio
case DRCE_DUPLICATE_FOOTPRINT:
case DRCE_EXTRA_FOOTPRINT:
case DRCE_NET_CONFLICT:
case DRCE_SCHEMATIC_PARITY_ISSUES:
SetMarkerType( MARKER_BASE::MARKER_PARITY );
break;

View File

@ -571,7 +571,8 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
if( aItem->GetErrorCode() == DRCE_MISSING_FOOTPRINT
|| aItem->GetErrorCode() == DRCE_DUPLICATE_FOOTPRINT
|| aItem->GetErrorCode() == DRCE_EXTRA_FOOTPRINT
|| aItem->GetErrorCode() == DRCE_NET_CONFLICT )
|| aItem->GetErrorCode() == DRCE_NET_CONFLICT
|| aItem->GetErrorCode() == DRCE_SCHEMATIC_PARITY_ISSUES )
{
footprints.push_back( aItem );
}