|
| 1 | +/* |
| 2 | + * This file is part of INAV. |
| 3 | + * |
| 4 | + * INAV is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * INAV is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with INAV. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +#pragma once |
| 19 | + |
| 20 | +#include <stdint.h> |
| 21 | + |
| 22 | +/* |
| 23 | + * mavlink_helpers.h defines mavlink_get_msg_entry() with the message table as a |
| 24 | + * function-local static, and protocol.h compiles the helpers as MAVLINK_HELPER |
| 25 | + * = static. Every translation unit that calls it therefore gets a private copy |
| 26 | + * of that table, and the linker cannot merge them. With two callers - routing |
| 27 | + * and runtime - the firmware carried the table twice: 8088 bytes on a full |
| 28 | + * build, of which 4044 was pure duplicate. |
| 29 | + * |
| 30 | + * Defining MAVLINK_GET_MSG_ENTRY suppresses the header's definition, and |
| 31 | + * mavlink_msg_entry.c supplies a single out-of-line one instead. Only this |
| 32 | + * function moves out of line; the rest of the helpers keep their inlining, so |
| 33 | + * the frame parsing hot path is unchanged. |
| 34 | + * |
| 35 | + * This must be included before storm32/mavlink.h, because mavlink_helpers.h |
| 36 | + * calls mavlink_get_msg_entry() internally and needs the declaration first. |
| 37 | + */ |
| 38 | +#define MAVLINK_GET_MSG_ENTRY |
| 39 | + |
| 40 | +struct __mavlink_msg_entry; |
| 41 | +const struct __mavlink_msg_entry *mavlink_get_msg_entry(uint32_t msgid); |
0 commit comments