From a5604320418a13472940f4bdf11e56a9c197ff12 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 30 Oct 2020 00:23:04 -0400 Subject: command: Fix handling of buffer passing in args[] on 64bit mcu If the buffer pointer can't fit in a uint32_t then pass a relative buffer offset instead. This fixes buffer handling on 64bit linux mcus. Signed-off-by: Kevin O'Connor --- src/command.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/command.c') diff --git a/src/command.c b/src/command.c index e3167baf..015cdb8e 100644 --- a/src/command.c +++ b/src/command.c @@ -18,12 +18,16 @@ static uint8_t next_sequence = MESSAGE_DEST; static uint32_t command_encode_ptr(void *p) { + if (sizeof(size_t) > sizeof(uint32_t)) + return p - console_receive_buffer(); return (size_t)p; } void * command_decode_ptr(uint32_t v) { + if (sizeof(size_t) > sizeof(uint32_t)) + return console_receive_buffer() + v; return (void*)(size_t)v; } -- cgit v1.2.3-70-g09d2