summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-06-07 10:05:21 -0700
committerKeith Packard <keithp@keithp.com>2014-06-07 10:05:21 -0700
commitb8a29d65ec605a995de1d1ec8b110d620d2f7a87 (patch)
tree20efcc2cbf36da92cb52409b0951ac6a6536aea5
parent1873d539a8f1a0e1e8ad539af5d49a77a129b928 (diff)
altos: Allow AO_CONFIG_MAX_SIZE to be configured. Validate it.
TeleMega config is 200 bytes. AO_CONFIG_MAX_SIZE was 128. That didn't work out well when logging erased flight information. Allow TeleMega to use a larger value (1k), and then do a compiler hack to make sure the defined value is at least as large as the ao_config structure. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/kernel/ao_config.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/kernel/ao_config.h b/src/kernel/ao_config.h
index 85673764..7ad221c6 100644
--- a/src/kernel/ao_config.h
+++ b/src/kernel/ao_config.h
@@ -112,7 +112,12 @@ struct ao_config {
#define AO_PAD_ORIENTATION_ANTENNA_UP 0
#define AO_PAD_ORIENTATION_ANTENNA_DOWN 1
+#ifndef AO_CONFIG_MAX_SIZE
#define AO_CONFIG_MAX_SIZE 128
+#endif
+
+/* Make sure AO_CONFIG_MAX_SIZE is big enough */
+typedef uint8_t config_check_space[(int) (AO_CONFIG_MAX_SIZE - sizeof (struct ao_config))];
extern __xdata struct ao_config ao_config;
extern __pdata uint8_t ao_config_loaded;