From b9940f0e0d7b5b4fae497cc80d14948a091d71c2 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 25 May 2017 16:54:31 -0400 Subject: build: Avoid linker magic in compile_time_request.c unique id generation Avoid generating unique ids via memory locations and linker scripts. Instead, generate them using code produced by buildcommands.py. Utilize gcc's ability to perform static string comparisons at compile time to produce a unique id for each unique string. This fixes a build failure on ARM introduced in 142b92b8. It also reduces the complexity of the build. Signed-off-by: Kevin O'Connor --- src/command.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/command.c') diff --git a/src/command.c b/src/command.c index 44de070d..f96cee62 100644 --- a/src/command.c +++ b/src/command.c @@ -112,7 +112,7 @@ static uint8_t in_sendf; // Encode a message and transmit it void -_sendf(uint8_t parserid, ...) +_sendf(const struct command_encoder *ce, ...) { if (readb(&in_sendf)) // This sendf call was made from an irq handler while the main @@ -120,8 +120,7 @@ _sendf(uint8_t parserid, ...) return; writeb(&in_sendf, 1); - const struct command_encoder *cp = &command_encoders[parserid]; - uint8_t max_size = READP(cp->max_size); + uint8_t max_size = READP(ce->max_size); char *buf = console_get_output(max_size + MESSAGE_MIN); if (!buf) goto done; @@ -129,10 +128,10 @@ _sendf(uint8_t parserid, ...) if (max_size) { char *maxend = &p[max_size]; va_list args; - va_start(args, parserid); - uint8_t num_params = READP(cp->num_params); - const uint8_t *param_types = READP(cp->param_types); - *p++ = READP(cp->msg_id); + va_start(args, ce); + uint8_t num_params = READP(ce->num_params); + const uint8_t *param_types = READP(ce->param_types); + *p++ = READP(ce->msg_id); while (num_params--) { if (p > maxend) goto error; -- cgit v1.2.3-70-g09d2