diff --git a/flight/PiOS/STM32F4xx/pios_bl_helper.c b/flight/PiOS/STM32F4xx/pios_bl_helper.c index 967c3c7e6..039a9791a 100644 --- a/flight/PiOS/STM32F4xx/pios_bl_helper.c +++ b/flight/PiOS/STM32F4xx/pios_bl_helper.c @@ -32,7 +32,7 @@ #include "pios.h" #if defined(PIOS_INCLUDE_BL_HELPER) #include -#include "stm32f10x_flash.h" +#include "stm32f4xx_flash.h" uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress) { @@ -97,6 +97,5 @@ void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size) void PIOS_BL_HELPER_CRC_Ini() { - RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE); } #endif diff --git a/flight/PiOS/STM32F4xx/pios_sys.c b/flight/PiOS/STM32F4xx/pios_sys.c index 416ec5667..1944be7b9 100644 --- a/flight/PiOS/STM32F4xx/pios_sys.c +++ b/flight/PiOS/STM32F4xx/pios_sys.c @@ -35,6 +35,8 @@ #if defined(PIOS_INCLUDE_SYS) +#define MEM8(addr) (*((volatile uint8_t *)(addr))) + /* Private Function Prototypes */ static void NVIC_Configuration(void); @@ -224,6 +226,27 @@ uint32_t PIOS_SYS_getCPUFlashSize(void) return ((uint32_t) MEM_SIZE); // it might be possible to locate in the OTP area, but haven't looked and not documented } +/** + * Returns the serial number as a string + * param[out] str pointer to a string which can store at least 32 digits + zero terminator! + * (24 digits returned for STM32) + * return < 0 if feature not supported + */ +int32_t PIOS_SYS_SerialNumberGetBinary(uint8_t *array) +{ + int i; + + /* Stored in the so called "electronic signature" */ + for (i = 0; i < 12; ++i) { + uint8_t b = MEM8(0x1ffff7e8 + i); + + array[i] = b; + } + + /* No error */ + return 0; +} + /** * Returns the serial number as a string * param[out] str pointer to a string which can store at least 32 digits + zero terminator! diff --git a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj index d435e3d14..70312417e 100644 --- a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj +++ b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj @@ -115,6 +115,7 @@ 657CEEBB121DBC63007A1FBE /* WorldMagModel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WorldMagModel.c; sourceTree = ""; }; 657CF024121F49CD007A1FBE /* WMMInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMMInternal.h; sourceTree = ""; }; 657FF86A12EA8BFB00801617 /* pios_pwm_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_pwm_priv.h; sourceTree = ""; }; + 6581785414A65B9B0007885F /* pios_bl_helper.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_bl_helper.c; sourceTree = ""; }; 6589A972131DDE93006BD67C /* FreeRTOSConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FreeRTOSConfig.h; sourceTree = ""; }; 6589A983131DE24F006BD67C /* taskmonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = taskmonitor.c; sourceTree = ""; }; 6589A9DB131DEE76006BD67C /* pios_rtc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_rtc.c; sourceTree = ""; }; @@ -3901,6 +3902,7 @@ 65904EC314613B6100FD9482 /* link_STM32F4xx_OP_memory.ld */, 65904EC414613B6100FD9482 /* link_STM32F4xx_sections.ld */, 65904EC514613B6100FD9482 /* pios_adc.c */, + 6581785414A65B9B0007885F /* pios_bl_helper.c */, 65904EC614613B6100FD9482 /* pios_bma180.c */, 65904EC714613B6100FD9482 /* pios_bmp085.c */, 65904EC814613B6100FD9482 /* pios_debug.c */, diff --git a/flight/Revolution/Makefile b/flight/Revolution/Makefile index 201c60a92..e74d22971 100644 --- a/flight/Revolution/Makefile +++ b/flight/Revolution/Makefile @@ -49,7 +49,7 @@ endif FLASH_TOOL = OPENOCD # List of modules to include -MODULES = Sensors Attitude/revolution ManualControl Stabilization Altitude/revolution Actuator GPS Telemetry +MODULES = Sensors Attitude/revolution ManualControl Stabilization Altitude/revolution Actuator GPS Telemetry FirmwareIAP PYMODULES = #FlightPlan