diff --git a/AdvLoggerPkg/AdvLoggerPkg.dec b/AdvLoggerPkg/AdvLoggerPkg.dec index eff3b13d29..1bbef21d03 100644 --- a/AdvLoggerPkg/AdvLoggerPkg.dec +++ b/AdvLoggerPkg/AdvLoggerPkg.dec @@ -131,6 +131,12 @@ # gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerHdwPortDebugPrintErrorLevel|0xFFFFFFFF|UINT32|0x00010180 + ## Always Print Assert Message to Serial Port + # + # Enable AssertLib to print ASSERT message to serial port in addition of AdvLogger + # + gAdvLoggerPkgTokenSpaceGuid.PcdAlwaysPrintAssertMsgToSerialPort|FALSE|BOOLEAN|0x00010199 + [UserExtensions.TianoCore."ExtraFiles"] AdvLoggerPkgExtra.uni diff --git a/AdvLoggerPkg/Library/AssertLib/AssertLib.c b/AdvLoggerPkg/Library/AssertLib/AssertLib.c index 640e6ec9ae..f84d9b5b03 100644 --- a/AdvLoggerPkg/Library/AssertLib/AssertLib.c +++ b/AdvLoggerPkg/Library/AssertLib/AssertLib.c @@ -18,6 +18,7 @@ #include #include #include +#include // // Define the maximum debug and assert message length that this library supports @@ -65,6 +66,10 @@ DebugAssert ( // AdvancedLoggerWrite (DEBUG_ERROR, Buffer, AsciiStrnLenS (Buffer, sizeof (Buffer))); + if (PcdGetBool(PcdAlwaysPrintAssertMsgToSerialPort)) { + SerialPortWrite(Buffer, AsciiStrnLenS (Buffer, sizeof (Buffer))); + } + if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { CpuBreakpoint (); } diff --git a/AdvLoggerPkg/Library/AssertLib/AssertLib.inf b/AdvLoggerPkg/Library/AssertLib/AssertLib.inf index 7cc690ddf9..8169d90c77 100644 --- a/AdvLoggerPkg/Library/AssertLib/AssertLib.inf +++ b/AdvLoggerPkg/Library/AssertLib/AssertLib.inf @@ -34,6 +34,8 @@ BaseLib PcdLib PrintLib + SerialPortLib [Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES + gAdvLoggerPkgTokenSpaceGuid.PcdAlwaysPrintAssertMsgToSerialPort ## CONSUMES