<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I’m working with 4.12 for ARM (cortex M7)<div class=""><br class=""></div><div class="">I’m tracing down an issue and figured it smelled like a stack problem, so I got my command line interpreter to call rtems_stack_checker_report_usage().</div><div class=""><br class=""></div><div class="">The addresses that it is printing out are just wrong.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> STACK USAGE BY THREAD</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ID NAME LOW HIGH CURRENT AVAIL USED</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0x09010001 IDLE 0x536902024 0x536906119 0x536906024 4080 164</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0x0A010001 UI1 0x536906128 0x536910223 0x536910112 4080 404</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0x0A010002 CfgT 0x536910232 0x536914327 0x536914120 4080 288</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0x0A010003 LOGT 0x536914728 0x536918823 0x536918248 4080 648</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0x0A010004 MonT 0x536918832 0x536922927 0x536922592 4080 404</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0x0A010005 ADCT 0x536922936 0x536927031 0x536926712 4080 388</span></div><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0x0A010006 CSLT 0x536927040 0x536931135 0x536930512 4080 1236</span></div></div><div class=""><br class=""></div><div class="">So I started chasing the source code and I find that on line 408 of check.c in function Stack_check_Dump_threads_usage, in the line:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> rtems_printf(</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> printer,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> <span style="color: #3933ff" class="">"0x%08"</span> PRIx32 <span style="color: #3933ff" class="">" %-21s 0x%08"</span> PRIuPTR <span style="color: #3933ff" class="">" 0x%08"</span> PRIuPTR <span style="color: #3933ff" class="">" 0x%08"</span> PRIuPTR <span style="color: #3933ff" class="">" %6"</span> PRId32 <span style="color: #3933ff" class="">" "</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> id,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> name,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> (uintptr_t) stack->area,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> (uintptr_t) stack->area + (uintptr_t) stack->size - 1,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> (uintptr_t) current,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> size</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class=""> );</div></div><div class=""><br class=""></div><div class="">Stack->area has the value 0x20009998 and the value of stack->size is 4096 ( for process CfgT). Current has the value 0x2000a8c8.</div><div class=""><br class=""></div><div class="">AH, I get it, the values are being prepended with 0x and then printing out in decimal instead of hex.</div><div class=""><br class=""></div><div class="">Perhaps in the format, the PRIuPTRs should be PRIx32s instead???</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Andrei</div><div class=""><br class=""></div><div class=""><br class=""></div></div></body></html>