1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-556 Allow DiscoveryF4Bare to spoof own board id through FirmwareIAPObj.

This commit is contained in:
Vladimir Zidar 2017-10-23 23:00:45 +02:00
parent 4c9c3c202c
commit 51923bb67f
5 changed files with 47 additions and 2 deletions

View File

@ -96,10 +96,12 @@ int32_t FirmwareIAPInitialize()
FirmwareIAPObjData data; FirmwareIAPObjData data;
FirmwareIAPObjGet(&data); FirmwareIAPObjGet(&data);
data.BoardType = bdinfo->board_type;
PIOS_BL_HELPER_FLASH_Read_Description(data.Description, FIRMWAREIAPOBJ_DESCRIPTION_NUMELEM); PIOS_BL_HELPER_FLASH_Read_Description(data.Description, FIRMWAREIAPOBJ_DESCRIPTION_NUMELEM);
PIOS_SYS_SerialNumberGetBinary(data.CPUSerial); PIOS_SYS_SerialNumberGetBinary(data.CPUSerial);
data.BoardRevision = bdinfo->board_rev; if (data.BoardRevision == 0 && data.BoardType == 0) {
data.BoardRevision = bdinfo->board_rev;
data.BoardType = bdinfo->board_type;
}
data.BootloaderRevision = bdinfo->bl_rev; data.BootloaderRevision = bdinfo->bl_rev;
data.ArmReset = 0; data.ArmReset = 0;
data.crc = 0; data.crc = 0;

View File

@ -106,6 +106,11 @@ UAVOBJSRCFILENAMES += velocitydesired
UAVOBJSRCFILENAMES += watchdogstatus UAVOBJSRCFILENAMES += watchdogstatus
UAVOBJSRCFILENAMES += flightstatus UAVOBJSRCFILENAMES += flightstatus
UAVOBJSRCFILENAMES += hwsettings UAVOBJSRCFILENAMES += hwsettings
UAVOBJSRCFILENAMES += hwdiscoveryf4baresettings
UAVOBJSRCFILENAMES += hwpikoblxsettings
UAVOBJSRCFILENAMES += hwspracingf3evosettings
UAVOBJSRCFILENAMES += hwspracingf3settings
UAVOBJSRCFILENAMES += hwtinyfishsettings
UAVOBJSRCFILENAMES += receiveractivity UAVOBJSRCFILENAMES += receiveractivity
UAVOBJSRCFILENAMES += receiverstatus UAVOBJSRCFILENAMES += receiverstatus
UAVOBJSRCFILENAMES += cameradesired UAVOBJSRCFILENAMES += cameradesired

View File

@ -32,6 +32,13 @@
#include <hwsettings.h> #include <hwsettings.h>
#include <taskinfo.h> #include <taskinfo.h>
#include <pios_ws2811.h> #include <pios_ws2811.h>
#include "hwdiscoveryf4baresettings.h"
#include "firmwareiapobj.h"
#include "hwpikoblxsettings.h"
#include "hwspracingf3evosettings.h"
#include "hwspracingf3settings.h"
#include "hwtinyfishsettings.h"
#ifdef PIOS_INCLUDE_INSTRUMENTATION #ifdef PIOS_INCLUDE_INSTRUMENTATION
@ -189,6 +196,26 @@ void PIOS_Board_Init(void)
UAVObjInitialize(); UAVObjInitialize();
SETTINGS_INITIALISE_ALL; SETTINGS_INITIALISE_ALL;
HwPikoBLXSettingsInitialize();
HwSPRacingF3EVOSettingsInitialize();
HwSPRacingF3SettingsInitialize();
HwTinyFISHSettingsInitialize();
HwDiscoveryF4BareSettingsInitialize();
uint16_t boardId;
HwDiscoveryF4BareSettingsBoardIdGet(&boardId);
FirmwareIAPObjInitialize();
FirmwareIAPObjData iap;
FirmwareIAPObjGet(&iap);
iap.BoardType = boardId >> 8;
iap.BoardRevision = boardId & 0xff;
FirmwareIAPObjSet(&iap);
/* Initialize the alarms library */ /* Initialize the alarms library */
AlarmsInitialize(); AlarmsInitialize();

View File

@ -101,6 +101,7 @@ UAVOBJS = \
$${UAVOBJ_XML_DIR}/hwspracingf3evosettings.xml \ $${UAVOBJ_XML_DIR}/hwspracingf3evosettings.xml \
$${UAVOBJ_XML_DIR}/hwpikoblxsettings.xml \ $${UAVOBJ_XML_DIR}/hwpikoblxsettings.xml \
$${UAVOBJ_XML_DIR}/hwtinyfishsettings.xml \ $${UAVOBJ_XML_DIR}/hwtinyfishsettings.xml \
$${UAVOBJ_XML_DIR}/hwdiscoveryf4baresettings.xml \
$${UAVOBJ_XML_DIR}/i2cstats.xml \ $${UAVOBJ_XML_DIR}/i2cstats.xml \
$${UAVOBJ_XML_DIR}/magsensor.xml \ $${UAVOBJ_XML_DIR}/magsensor.xml \
$${UAVOBJ_XML_DIR}/magstate.xml \ $${UAVOBJ_XML_DIR}/magstate.xml \

View File

@ -0,0 +1,10 @@
<xml>
<object name="HwDiscoveryF4BareSettings" singleinstance="true" settings="true" category="System">
<description>DiscoveryF4 Bare hardware configuration</description>
<field name="BoardId" units="" type="uint16" elements="1" defaultvalue="0x0904" />
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>
<logging updatemode="manual" period="0"/>
</object>
</xml>