[PATCH rtems-lwip 3/3] rtemslwip/xil_shims: Improve error messages

Kinsey Moore kinsey.moore at oarcorp.com
Thu Feb 2 21:42:14 UTC 2023


The error message produced in the case of MMU mapping failures was
insufficient to track down the cause. This improves the out to assist
the user in tracking down the issue.
---
 rtemslwip/zynqmp/xil_shims.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/rtemslwip/zynqmp/xil_shims.c b/rtemslwip/zynqmp/xil_shims.c
index 5284ded..f0b1b9b 100644
--- a/rtemslwip/zynqmp/xil_shims.c
+++ b/rtemslwip/zynqmp/xil_shims.c
@@ -28,6 +28,7 @@
 #include <rtems/rtems/cache.h>
 #include <rtems/rtems/intr.h>
 #include <libcpu/mmu-vmsav8-64.h>
+#include <stdio.h>
 
 #define TWO_MB (2*1024*1024)
 #define ONE_GB (1024*1024*1024)
@@ -45,8 +46,12 @@ void Xil_SetTlbAttributes( UINTPTR Addr, u64 attrib )
     Addr < 0x100000000 ? TWO_MB : ONE_GB,
     attrib
   );
-  if ( sc != RTEMS_SUCCESSFUL ) {
-    printf("Failed setting TLB attribs on ptr %p: 0x%lx\n", Addr, attrib);
+  if ( sc == RTEMS_NO_MEMORY ) {
+    printf("Out of memory setting MMU attributes on ptr %p: 0x%lx\n", (void*)Addr, attrib);
+  } else if ( sc == RTEMS_INVALID_ADDRESS ) {
+    printf("Attempted to set MMU attributes on invalid ptr %p: 0x%lx\n", (void*)Addr, attrib);
+  } else if ( sc != RTEMS_SUCCESSFUL ) {
+    printf("Failed setting MMU attributes on ptr %p: 0x%lx\n", (void*)Addr, attrib);
   }
 }
 
-- 
2.30.2



More information about the devel mailing list