Recent enhancements to cmd_ps trips a floating point exception if LIBC_FLOATINGPOINT is not defined (at least on Cortex M4 w/ hardfloat). I’m using a buildroot gcc configured to support Cortex-M4F and the hard float ABI, target files are compiles with: -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard. I’m not sure the best way to address this, but the attached patch file is the first that comes to mind. Note, I added the float qualifier ‘F’ after a few constants to prevent the compiler from promoting the multiplication and division to double (expensive on M4F) then demoting to single float for the store. (sorry, it’s one of my many pet peeves ;)

`
This commit is contained in:
David Alessio 2016-07-10 17:49:58 -06:00 committed by Gregory Nutt
parent 8997e5849d
commit f553fd1316

View File

@ -455,17 +455,22 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
nsh_output(vtbl, "%6.6d ", stack_size);
nsh_output(vtbl, "%6.6d ", stack_used);
stack_filled = 0.0;
stack_filled = 0.0F;
if (stack_size && stack_used)
{
stack_filled = (100.0 / stack_size * stack_used);
stack_filled = 100.0F * stack_used / stack_size;
}
/* Additionally print a "!" if the stack is filled more than 80% */
#ifndef LIBC_FLOATINGPOINT
nsh_output(vtbl, "%5d%%%s ", (int)stack_filled, (stack_filled >= 80 ? "!" : " "));
#else
nsh_output(vtbl, "%5.1f%%%s ", (double)stack_filled, (stack_filled >= 80 ? "!" : " "));
#endif
#endif
#ifdef NSH_HAVE_CPULOAD
/* Get the CPU load */