summaryrefslogtreecommitdiff
path: root/src/core/ao_cmd.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-03-10 21:02:59 -0700
committerKeith Packard <keithp@keithp.com>2013-03-10 21:02:59 -0700
commit8083aeb07167a1a68a168f16ac951b6de7b197ea (patch)
treee32ce77901c14cde263870298ab503af4a81fe4c /src/core/ao_cmd.c
parent5187bb4402874f654fcef5ffdf237edf97a26b8c (diff)
altos: Make stm-flash capable of switching to application
This shrinks the base OS load down a bit as well so that stm-flash fits comfortably in the first 8kB of memory. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/core/ao_cmd.c')
-rw-r--r--src/core/ao_cmd.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/ao_cmd.c b/src/core/ao_cmd.c
index 3d086a57..3182acb7 100644
--- a/src/core/ao_cmd.c
+++ b/src/core/ao_cmd.c
@@ -16,6 +16,7 @@
*/
#include "ao.h"
+#include "ao_task.h"
__pdata uint16_t ao_cmd_lex_i;
__pdata uint32_t ao_cmd_lex_u32;
@@ -262,6 +263,11 @@ ao_reboot(void)
ao_panic(AO_PANIC_REBOOT);
}
+#ifndef HAS_VERSION
+#define HAS_VERSION 1
+#endif
+
+#if HAS_VERSION
static void
version(void)
{
@@ -289,6 +295,7 @@ version(void)
#endif
printf("software-version %s\n", ao_version);
}
+#endif
#ifndef NUM_CMDS
#define NUM_CMDS 11
@@ -304,12 +311,20 @@ help(void)
__pdata uint8_t cmd;
__code struct ao_cmds * __pdata cs;
const char *h;
+ uint8_t e;
for (cmds = 0; cmds < ao_ncmds; cmds++) {
cs = ao_cmds[cmds];
for (cmd = 0; cs[cmd].func; cmd++) {
h = cs[cmd].help;
- printf("%-45s %s\n", h, h + 1 + strlen(h));
+ put_string(h);
+ e = strlen(h);
+ h += e + 1;
+ e = 45 - e;
+ while (e--)
+ putchar(' ');
+ put_string(h);
+ putchar('\n');
}
}
}
@@ -374,10 +389,14 @@ __xdata struct ao_task ao_cmd_task;
__code struct ao_cmds ao_base_cmds[] = {
{ help, "?\0Help" },
+#if HAS_TASK_INFO
{ ao_task_info, "T\0Tasks" },
+#endif
{ echo, "E <0 off, 1 on>\0Echo" },
{ ao_reboot, "r eboot\0Reboot" },
+#if HAS_VERSION
{ version, "v\0Version" },
+#endif
{ 0, NULL },
};