mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-1477 - remove debug infos and add send some relevant informations using SYS message (firmware and board revision/info)
This commit is contained in:
parent
7e78194e12
commit
c772442723
@ -43,11 +43,7 @@
|
||||
#include "inc/gps9gpshandler.h"
|
||||
#include "inc/gps9flashhandler.h"
|
||||
#include "inc/gps9protocol.h"
|
||||
|
||||
// UAVOs
|
||||
#include <systemstats.h>
|
||||
|
||||
SystemStatsData systemStats;
|
||||
#include "pios_board_info.h"
|
||||
|
||||
extern uint32_t pios_com_main_id;
|
||||
|
||||
@ -55,11 +51,9 @@ extern uint32_t pios_com_main_id;
|
||||
#define SYSTEM_UPDATE_PERIOD_MS 1
|
||||
#define HB_LED_BLINK_ON_PERIOD_MS 100
|
||||
#define HB_LED_BLINK_OFF_PERIOD_MS 1900
|
||||
#define SYSTEM_UPDATE_PERIOD_MS 1
|
||||
|
||||
#define STACK_SIZE_BYTES 450
|
||||
#define STAT_RATE 1
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY + 2)
|
||||
#define STACK_SIZE_BYTES 450
|
||||
#define STAT_UPDATE_PERIOD_MS 5000
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY + 2)
|
||||
|
||||
// Private types
|
||||
|
||||
@ -67,12 +61,14 @@ extern uint32_t pios_com_main_id;
|
||||
static xTaskHandle systemTaskHandle;
|
||||
static enum { STACKOVERFLOW_NONE = 0, STACKOVERFLOW_WARNING = 1, STACKOVERFLOW_CRITICAL = 3 } stackOverflow;
|
||||
|
||||
// Private functions
|
||||
static bool mallocFailed;
|
||||
|
||||
static bool mallocFailed;
|
||||
static SysUbxPkt sysPkt;
|
||||
|
||||
// Private functions
|
||||
static void updateStats();
|
||||
static void gpspSystemTask(void *parameters);
|
||||
|
||||
static void readFirmwareInfo();
|
||||
/**
|
||||
* Create the module task.
|
||||
* \returns 0 on success or -1 if initialization failed
|
||||
@ -132,6 +128,9 @@ static void gpspSystemTask(__attribute__((unused)) void *parameters)
|
||||
static TickType_t lastUpdate;
|
||||
setupGPS();
|
||||
uint32_t ledTimer = 0;
|
||||
|
||||
readFirmwareInfo();
|
||||
|
||||
while (1) {
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM);
|
||||
@ -198,23 +197,31 @@ uint16_t GetFreeIrqStackSize(void)
|
||||
static void updateStats()
|
||||
{
|
||||
static uint32_t lastUpdate;
|
||||
static SysUbxPkt sysPkt;
|
||||
|
||||
if (PIOS_DELAY_DiffuS(lastUpdate) < 1000 * configTICK_RATE_HZ / STAT_RATE) {
|
||||
if (PIOS_DELAY_DiffuS(lastUpdate) < STAT_UPDATE_PERIOD_MS * configTICK_RATE_HZ / 1000) {
|
||||
return;
|
||||
}
|
||||
lastUpdate = PIOS_DELAY_GetRaw();
|
||||
// Get stats and update
|
||||
sysPkt.fragments.data.flightTime = xTaskGetTickCount() * portTICK_RATE_MS;
|
||||
sysPkt.fragments.data.HeapRemaining = xPortGetFreeHeapSize();
|
||||
sysPkt.fragments.data.IRQStackRemaining = GetFreeIrqStackSize();
|
||||
sysPkt.fragments.data.SystemModStackRemaining = uxTaskGetStackHighWaterMark(NULL) * 4;
|
||||
sysPkt.fragments.data.options = SYS_DATA_OPTIONS_MAG | (flash_available() ? SYS_DATA_OPTIONS_FLASH : 0);
|
||||
|
||||
// Get stats and update
|
||||
sysPkt.fragments.data.flightTime = xTaskGetTickCount() * portTICK_RATE_MS;
|
||||
sysPkt.fragments.data.options = SYS_DATA_OPTIONS_MAG | (flash_available() ? SYS_DATA_OPTIONS_FLASH : 0);
|
||||
ubx_buildPacket(&sysPkt.packet, UBX_OP_CUST_CLASS, UBX_OP_SYS, sizeof(SysData));
|
||||
PIOS_COM_SendBuffer(pios_com_main_id, sysPkt.packet.binarystream, sizeof(SysUbxPkt));
|
||||
}
|
||||
|
||||
// retrieve firmware info and fill syspkt
|
||||
static void readFirmwareInfo()
|
||||
{
|
||||
const struct pios_board_info *bdinfo = &pios_board_info_blob;
|
||||
|
||||
sysPkt.fragments.data.board_revision = bdinfo->board_rev;
|
||||
sysPkt.fragments.data.board_type = bdinfo->board_type;
|
||||
struct fw_version_info *fwinfo = (struct fw_version_info *)(bdinfo->fw_base + bdinfo->fw_size);
|
||||
|
||||
memcpy(&sysPkt.fragments.data.commit_tag_name, &fwinfo->commit_tag_name, sizeof(sysPkt.fragments.data.commit_tag_name));
|
||||
memcpy(&sysPkt.fragments.data.sha1sum, &fwinfo->commit_tag_name, sizeof(sysPkt.fragments.data.sha1sum));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the RTOS when the CPU is idle,
|
||||
|
@ -57,10 +57,11 @@ typedef union {
|
||||
|
||||
typedef struct {
|
||||
uint32_t flightTime;
|
||||
uint16_t HeapRemaining;
|
||||
uint16_t IRQStackRemaining;
|
||||
uint16_t SystemModStackRemaining;
|
||||
uint16_t options;
|
||||
uint8_t board_type;
|
||||
uint8_t board_revision;
|
||||
uint8_t commit_tag_name[26];
|
||||
uint8_t sha1sum[8];
|
||||
} __attribute__((packed)) SysData;
|
||||
|
||||
typedef union {
|
||||
|
@ -21,4 +21,16 @@ struct pios_board_info {
|
||||
|
||||
extern const struct pios_board_info pios_board_info_blob;
|
||||
|
||||
struct __attribute__((packed)) fw_version_info {
|
||||
uint8_t magic[4];
|
||||
uint32_t commit_hash_prefix;
|
||||
uint32_t timestamp;
|
||||
uint8_t board_type;
|
||||
uint8_t board_revision;
|
||||
uint8_t commit_tag_name[26];
|
||||
uint8_t sha1sum[20];
|
||||
uint8_t uavosha1[20];
|
||||
uint8_t pad[20];
|
||||
};
|
||||
|
||||
#endif /* PIOS_BOARD_INFO_H */
|
||||
|
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <pios_board_info.h>
|
||||
/**
|
||||
* We have 100 bytes for the whole description.
|
||||
*
|
||||
@ -42,18 +42,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
struct __attribute__((packed)) fw_version_info {
|
||||
uint8_t magic[4];
|
||||
uint32_t commit_hash_prefix;
|
||||
uint32_t timestamp;
|
||||
uint8_t board_type;
|
||||
uint8_t board_revision;
|
||||
uint8_t commit_tag_name[26];
|
||||
uint8_t sha1sum[20];
|
||||
uint8_t uavosha1[20];
|
||||
uint8_t pad[20];
|
||||
};
|
||||
|
||||
#if (defined(__MACH__) && defined(__APPLE__))
|
||||
const struct fw_version_info fw_version_blob __attribute__((used)) __attribute__((__section__("__TEXT,.fw_version_blob"))) = {
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user