AP_Bootloader: support CAN multicast server

allows for fw update of network peripheral devices
This commit is contained in:
Andrew Tridgell committed 2024-09-17 10:02:29 +10:00
1 parent f065548866
commit ef4fce80fb
5 files changed
+48 -5

No files matched your search

+25 -5
View File
@@ -50,7 +50,7 @@ static CANConfig cancfg = {
// pipelining is not faster when using ChibiOS CAN driver
#define FW_UPDATE_PIPELINE_LEN 1
#else
static ChibiOS::CANIface can_iface[HAL_NUM_CAN_IFACES];
ChibiOS::CANIface can_iface[HAL_NUM_CAN_IFACES];
#endif
#ifndef CAN_APP_VERSION_MAJOR
@@ -863,16 +863,13 @@ void can_update()
}
// printf to CAN LogMessage for debugging
void can_printf(const char *fmt, ...)
void can_vprintf(const char *fmt, va_list ap)
{
// only on H7 for now, where we have plenty of flash
#if defined(STM32H7)
uavcan_protocol_debug_LogMessage pkt {};
uint8_t buffer[UAVCAN_PROTOCOL_DEBUG_LOGMESSAGE_MAX_SIZE];
va_list ap;
va_start(ap, fmt);
uint32_t n = vsnprintf((char*)pkt.text.data, sizeof(pkt.text.data), fmt, ap);
va_end(ap);
pkt.text.len = MIN(n, sizeof(pkt.text.data));
uint32_t len = uavcan_protocol_debug_LogMessage_encode(&pkt, buffer, true);
@@ -887,5 +884,28 @@ void can_printf(const char *fmt, ...)
#endif // defined(STM32H7)
}
// printf to CAN LogMessage for debugging
void can_printf(const char *fmt, ...)
{
// only on H7 for now, where we have plenty of flash
#if defined(STM32H7)
va_list ap;
va_start(ap, fmt);
can_vprintf(fmt, ap);
va_end(ap);
#endif // defined(STM32H7)
}
void can_printf_severity(uint8_t severity, const char *fmt, ...)
{
// only on H7 for now, where we have plenty of flash
#if defined(STM32H7)
va_list ap;
va_start(ap, fmt);
can_vprintf(fmt, ap);
va_end(ap);
#endif
}
#endif // HAL_USE_CAN