From: Keith Packard Date: Sat, 7 Jun 2014 17:05:21 +0000 (-0700) Subject: altos: Allow AO_CONFIG_MAX_SIZE to be configured. Validate it. X-Git-Tag: 1.3.2.3~16 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=b8a29d65ec605a995de1d1ec8b110d620d2f7a87 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 --- 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;