Commit Graph

151 Commits

Author SHA1 Message Date
Dominic Clifton 8a1a75e2ef [H7] USB Middlewares change: Fix memory corruption 2019-05-12 22:09:09 +09:00
jflyper 1861c6d957 [H7] Modify USB Middleware library for composite device support 2019-05-09 13:56:29 +09:00
jflyper e62cc6552d [F7] Move non-library CDC-HID code out of lib tree 2019-05-08 11:59:23 +09:00
Michael Keller 35270099c0
Removed non-library header from 'lib/'. (#8115)
Removed non-library header from 'lib/'.
2019-05-07 12:12:14 +12:00
mikeller 2d958f8d8a Removed non-library header from 'lib/'. 2019-04-28 14:58:53 +12:00
jflyper 0c5540228f Simple fixes to library files
- stm32h7xx_hal_rcc.c: Prevent signed-unsigned comparison warning

- [USBLIB] Take care of unused parameters

- [LIB] Stop signed-unsigned comparison warning (rcc_ex)

- Modify HAL SPI driver for const-ness to match call from current bus_spi driver

- [LIB] Handle unused in stm32h7xx_hal_flash.c

- UNUSED care for stm32h7xx_hal_rtc_ex.c

- UNUSED care for stm32h7xx_hal_pwr.c

- UNUSED care for stm32h7xx_hal_pcd.c

- UNUSED care for stm32h7xx_hal_flash.c

- UNUSED care for stm32h7xx_hal_adc_ex.c
2019-04-28 05:55:01 +09:00
jflyper 7a0d3e73f5 Use union to access access size sensitive registers
As described in RM0433 section 49.4.13 "Data packing", STM32H7's SPI data register supports data packing and it is sensitive to actual access width.

The original code used pointer casting to obtain a code to access the register in a desired size.
However, these operation results in strict aliasing warnings (deferencing punned pointer) and are not desirable.

Here, we declare a union that allow access to a 32-bit register in 8, 16 or 32-bit width and cast pointer to the original RXDR and TXDR data registers and then access the portion of the register through an appropriate union member.

XXX FIXME Only handled 16-bit access case, as 32-bit (original declaration) and 8-bit (allowed) cases do not generate warnings, but these should be handled similarly for correctness and consistency of the code.
2019-04-28 05:55:01 +09:00
jflyper 8670c05068 SPI HAL library bug (referencing RX side handle from TX only DMA) 2019-04-28 05:55:01 +09:00
Dominic Clifton 844683279a STM32H750 - Apply workaround to the SDMMC Errata 2.11.4
Issue: "Consecutive multiple block transfers can induce incorrect data length"
Workaround: "8 SDMMC clock cycles must elapse before DTEN can be set."
2019-04-28 05:55:01 +09:00
Dominic Clifton adcf556ea5 STM32H750 - Fix for H750 Errata 2.11.5. 2019-04-28 05:55:00 +09:00
Dominic Clifton a545abc511 Fix compilation error in H7 HAL library when enabling QSPI. 2019-04-28 05:55:00 +09:00
jflyper 99ea236bc2 Take care of "FLASH_SIZE" constant for stm32h750xx.h in lib 2019-04-28 05:54:36 +09:00
jflyper 0bb34cdd09 usbd_def: disable insane defs of MIN and MAX 2019-04-25 12:01:42 +09:00
jflyper e124693d48 [LIB] stm32h7xx_hal_def.h : Include <stddef.h> instead of <stdio.h>
Inclusion of <stdio.h> produces poisoned function alert for sprintf and
variants.
F7 use <stddef.h> instead of <stdio.h>
2019-04-25 12:01:42 +09:00
jflyper 22dd78f247 [CMSIS] stm32h743xx.h: FLASH_SIZE def collide with Betaflight 2019-04-25 12:01:42 +09:00
jflyper 5f15f58aa6 Import STM32Cube_FW_H7_V1.3.0 2019-04-21 18:39:03 +09:00
Dominic Clifton 705a2c565b Fix memory corruption in USB code.
Crash occurs on my machine shortly after power up.  `hhid` is null at
the time it occurs so the change to `hhid->state` causes a crash.
2019-03-16 12:02:42 +01:00
Michael Keller 93f933f01f Fixed build for gcc 8 (SITL). 2019-02-25 15:34:34 +13:00
Bruce Luckcuck 02a368a8e7 Fix UNUSED() macro conflict with STM libraries
Added `#if !defined(` blocks around the `UNUSED()` definitions in the libraries to prevent conflicts.
2019-02-18 11:26:03 -05:00
Bruce Luckcuck a3d4048493 Fix MacOS on-board flash MSC mode for F7 (HAL)
Needed to fix the F7 HAL library version as well. Tested on a DALRCF722DUAL.
2018-12-21 18:36:09 -05:00
Bruce Luckcuck a1899d671b Fixes to allow the MSC command with on-board flash to work on MacOS.
Fixed a bug in the STM libraries to set the write protected bin in the device config for the mass storage SCSI sense code 6 and 10. Previously the `isWriteProtected()` result was only being examined during write attempts and they correctly failed and returned a `NOT_READY` response (we don't support writes for SPIFLASH). Unfortunately since the device was not flagged as write protected on MacOS the operating system would try to write to the device and this would fail causing the operating system to think the device wasn't ready and refuse to mount it.

General fixes:

Ensured that the filesystem appears to be at least 256MB so that the volume will be treated as FAT32 instead of FAT16. A hidden "padding.txt" file is created to represent the extra space.

Fix the directory structure to only create the "btfl_all.bbl" file if there were any logs found. Previously it would always be created and this would lead to directory corruption.

Fix the size calculation for the  "btfl_all.bbl" file. Previously it was being set to the total flash size rather than the used space.
2018-11-27 18:48:46 -05:00
Andrey Mironov ff4c2bc145 Post-cleanup of F7 optimizations (#5729)
* Moved ART Prefetch enabling from library to main code

* Fixed tabs to spaces

* Added F7 LL EX header to simplify work with DMA and TIM

* Refactored F7 DSHOT using LL EX

* Got rid of overlooked duplicate lines
2018-04-21 18:14:35 +12:00
Andrey Mironov bf984f39b1 F7 optimizations (#5674)
* Revert "Revert "Rewritten F7 dshot to LL (draft)" (#5430)"

This reverts commit aa42a69d2f.

* Reworked F7 linker scripts to maximize performance of both F74x and F72x

* Some comments and changes from original F7 HAL DSHOT

* Prohibit inlining of some functions to place them in ITCM-RAM

* Fixed usartTargetConfigure implicit declaration

* Moved back to SRAM1 as main RAM

* Added SRAM2 attribute

* Fixed LL DSHOT FOR SPRF7DUAL and probably other adv TIM users

* Fixed SPRF7DUAL rev. A motor order

* Enabled CCM for data on F40x

* Fixed F7 startup assembly symbols

* Fixed KISSFCV2F7 linker script

* Added a quick way of building F7 targets only

* Got rid of the useless F7 target script

* Added NOINLINE and got rid of useless __APPLE__ define

* Added some important functions to ITCM

* Added NOINLINE macro for tests

* Copy to ITCM before passing execution into it

* Minimized cache footprint of motor output code

* Evicted low-impact functions from ITCM

* Switched MATEKF722 and SPRACINGF7DUAL to burst DSHOT

* Switched CLRACINGF7 to burst DSHOT

* Moved UART RX&TX buffers to DTCM-RAM to avoid cache incoherency

* Marked taskMainPidLoop for ITCM-RAM, disallowed inlining per-function

* Revert "Added a quick way of building F7 targets only"

This reverts commit 22945189980deaf493be54a5056a080e7edad629.
2018-04-20 08:37:32 +12:00
jflyper 0ae84bebb4 Per mikeller's comment. 2018-04-13 02:59:17 +09:00
jflyper 78bc3f52ad Disable VBUSSENSING features on PA9 completely 2018-04-13 02:07:58 +09:00
conkerkh a9136e2ba0 Add CDC+HID on F7 (#5596) 2018-04-02 14:35:51 +12:00
conkerkh a539bd60bc CDC+HID HotFixes (#5512)
- For now disables Composite (it can be enabled, with USB_CDC_HID define)
- Modified descriptors so they are properly recognized
- Changed PID for Composite device (otherwise it doesn't work probably due to windows feature - automatically finding drivers based on those values)
2018-03-23 13:19:14 +13:00
conkerkh 4786e1a333 Add Composite CDC+HID device option. (#5478)
* Add Composite CDC+HID device option.

- It passes on though HID interface 8 channels received from TX
- Endpoints are reconfigured to support HID interface
- Potentially this can slow down SPI Flash transfer though CDC interface...
- This could be addressed by support for MSC when using SPI Flash (emulating FATFS)

* Different way to handle MIN redefine
2018-03-22 15:21:22 +13:00
conkerkh 3a917a3755 Add USB Mass Storage Class support (#5443)
* Add MSC support

* Add support for MSC to WORMFC and SDIO_DMA

* Cleanup in fc_init

* Fix headers
2018-03-22 00:11:34 +13:00
SteveCEvans 5558174d33 Support programming of Arduino devices in serial passthrough mode (#5129)
* Support DTR in serial passthrough mode to enable programming of Arduino
based devices such as MinimOSD.

Use 'serialpassthrough 5 57600 rxtx 56' and then use Ardino to program MinimOSD
Use 'serialpassthrough 5 115200' and then use MWOSD configurator to setup

* Fix comment for CDC_SetCtrlLineStateCb routine

* Handle F7 CDC interface

* Use strToPin() to allow easy port/pin specification

* Fix use of CDC_SetCtrlLineStateCb for all processor types

* Only set baud when specified

* Fix unit tests for cli

* Only register callback if needed

* Fix white space

* Provide implementation of IOConfigGPIO in SITL

* Update serialpassthrough help text

* DTR handling through serial drivers

* Fix F3, F7 and SITL builds

* If serialpassthrough command specifies baud rate of 0, set baud rate over USB. MWOSD configurator can now access config and reflash MinimOSD without rebooting and changing baud rate.

* Fix F3 build

* Fix failing unit tests

* Use resources to declare DTR pin assignment

* Don't assert DTR during normal operation as MW_OSD doesn't like it

* MW_OSD must be built with MAX_SOFTRESET defined in order to support DTR resets

* Minimise changes after dropping DTR pin param from serialpassthrough cmd

* Remove DTR pin param from serialpassthrough cmd

* Treat ioDtrTag as boolean in conditional statements

* Tidy buffer check

* Check buffer size in CDC_Itf_Control

* Fix unit test

* Add documentation for DTR

* Add note on MAX_SOFTRESET to documentation

* Remove superfluous function definitions

* Fix tabs

* Fix tabs

* Removed superfluous entried from vtable

* Backout whitespace changes unrelated to this PR

* Pass true/false to IOWrite()

* Fix line coding packing

* Add LINE_CODING structure defintion

* Revise serial documentation

* Prevent tx buffer overflow in serialPassthrough()

* Revert change unrelated to PR

* Review feedback from ledvinap

* Fix unit test

* Use PINIO to drive DTR

* Fix unit test

* Remove change unrelated to PR

* Fix SITL build

* Use shifted bits for mask definition

* Fix serialpassthrough documentation

* Only compile PINIO functionality if USE_PINIO defined

* IOConfigGPIO not needed

* Move cbCtrlLine callback to cli.c

* serialPassthrough params changed

* Check packed structure size

* Fix unit test

* Tidy up baud rate handling
2018-03-21 23:17:31 +13:00
Dominic Clifton 0a2e5a5878 CF/BF - Update DSP_Lib and STM32F7/Drivers/CMSIS to CMSIS 5.3.0. (#5431)
* CF/BF - Update DSP_Lib and STM32F7/Drivers/CMSIS to CMSIS 5.3.0.

CMSIS 5.3.0 - https://github.com/ARM-software/CMSIS_5/releases/tag/5.3.0

* cleanup lib.

* pfft

* relocate driver files from lib/main/CMSIS/CM* to lib/main/STM32xx
folders

* Move DSP folder inside CM5.

It came from the same source as the other files inside CM5

* Remove the CM5 folder and move the files in it one level up.
2018-03-12 09:34:43 +13:00
jflyper 67b9966dc6 F446 support 2018-01-02 16:53:22 +09:00
Martin Budden 671382234a Enabled switch fallthrough checking by compiler 2017-12-23 19:46:40 +00:00
mikeller 4d30971e2d Fixed permissions on files. 2017-11-28 23:31:55 +13:00
Adrian Miriuta 7146c40ca8 HEADFREE true 3D (second edition)...
reduced memory footprint ...
	rebased squashed cleanup
2017-09-23 07:35:30 +02:00
blckmn 99a7223207 F1 and F3 HAL / LL libraries 2017-07-30 01:23:49 +10:00
blckmn e6780bd4d8 Fix unused param, add PERIPH_DRIVER flag for F4, tidied up F1 and F3 in prep. 2017-07-30 01:07:09 +10:00
blckmn 2dca6a5bbc Preparation for F4 being LL enabled.
Updated F7 to use latest HAL / LL libraries
2017-07-29 23:02:39 +10:00
blckmn 6151ded961 Low level driver for SPI for F7 2017-07-23 20:53:45 +10:00
Martin Budden b78a8bd519 Improved efficiency of gyro read for SPI 2017-07-02 05:32:18 +01:00
Martin Budden 6c9ef6df21 Fix pragma poison sprintf compile errors 2017-05-28 12:09:27 +01:00
rav d9909b91d3 enable frequency analysis and automatic, dynamic changing of notch filter frequencies
change F3 from CM1 to CM4
add debug flags for FFT
add bandpass filter
add different filtering apply function
add feature DYNAMIC_FILTER
replace mode GTUNE with DYNAMIC FILTER
move gyro frequency analysis into gyro loop instead of own task
2017-05-11 16:10:29 +02:00
Sami Korhonen 8a2e70bc3a F7 HAL update V1.2.2 2017-05-06 14:43:43 +03:00
Sami Korhonen 0c9b36d063 Update F7 HAL lib to version 1.2.1 2017-04-09 12:23:12 +03:00
cs8425 120fa21693 implement SITL in gazebosim with ArduCopterPlugin
need implement fake eeprom & fake IO

need implement fake system function

can compile, stuck in isEEPROMContentValid()

EEPROM in memory work

EEPROM as file should work

fix some complie warning

MSP over TCP work (add dyad.c)

a little clean up

fix FLASH_CONFIG_Size in ld script & implement some pwmout

IO to simulator work!! need to check direction & scale!!

can fly but Gyro buggy

move dyad.c

fix busy-loop (limit to max 20kHz)

can simulatie in different speed now! (hard code)

add option for IMU calculation

add README.md

move dyad.c and fix F3 overrun the flash size

explanation SITL in README.md and reuse CFLAGS, ASFLAGS
2017-04-05 18:22:59 +08:00
Martin Budden b8d6fb29df Fixed warnings in ARM math library 2017-03-06 06:11:49 +00:00
Martin Budden c1a02c714b Merge pull request #2002 from blckmn/stm32f4_hal
Stm32f4 hal
2017-02-28 06:57:19 +00:00
Martin Budden e3f9ce2578 Merge pull request #2005 from blckmn/stm32f3_hal
Stm32f3 hal
2017-02-28 06:57:05 +00:00
Martin Budden 68ec1d3ebf Merge pull request #2006 from blckmn/stm32f1_hal
Stm32f1 hal
2017-02-28 06:56:39 +00:00
Martin Budden ea2ec8b069 Added hooks for gyro data analysis 2017-02-23 15:52:26 +00:00
Martin Budden 09410ce80e Added ARM DSP library 2017-02-23 12:20:38 +00:00
Michael Jakob d6f3a50a9b Cleanup F7 CMSIS and HAL Library compiler warnings 2017-01-19 08:58:27 +01:00
Michael Jakob 35ca569c84 STM32F7 CMSIS Libraries V1.2.0 2017-01-18 13:58:05 +01:00
Michael Jakob e930261808 STM32F7 HAL Drivers V1.2.0 2017-01-18 13:47:15 +01:00
blckmn ba3ac12220 STM32F1xx_HAL_Driver 2017-01-05 12:39:10 +11:00
blckmn f98b52664a CMSIS HAL for F1 2017-01-05 10:32:56 +11:00
blckmn ee2430f4a3 STM32F3xx_HAL_Driver 2017-01-05 10:29:22 +11:00
blckmn 12a8171ed7 CMSIS HAL for F3 2017-01-05 10:29:00 +11:00
blckmn 11dba62499 STM32F4xx_HAL_Driver 2017-01-05 09:34:11 +11:00
blckmn df1409afee CMSIS HAL files for STM32F4 2017-01-05 09:34:07 +11:00
blckmn f67bf14b32 First NERO build
Using sample 722 support based on available documentation (pending update from STM)
2017-01-04 16:16:15 +11:00
blckmn 7b62b9a7ef Latest F7 HAL drivers (preparing for F722RE) 2017-01-03 14:47:24 +11:00
Martin Budden 8479ed0022 Starting the process of fixing type downcasting warnings 2016-12-28 09:46:30 +00:00
Sami Korhonen 03475a1ede Update STM32F7 HAL driver to 1.5.0 version 2016-11-19 14:40:47 +02:00
Martin Budden 3b93caa3ab Fix ANYFCF7 'unused' build warnings 2016-11-09 08:20:51 +00:00
Konstantin Sharlaimov (DigitalEntity) 09140cfdef Move MAVLink to lib/main/MAVLink; Post-rebase fixups 2016-10-17 17:24:42 +10:00
Martin Budden 4cd61f08b5 Further improvements to serial const correctness 2016-10-04 09:01:28 +01:00
Sami Korhonen 308f6b7820 F7 Libraries and Middlewares 2016-09-19 13:25:07 +03:00
Michael Jakob 33f8c76a96 VCP fix from cleanflight PR#2120 by ledvinap 2016-06-25 21:47:57 +02:00
blckmn 86459a77ed Warning fixes 2016-06-23 20:25:31 +10:00
blckmn eb547ba900 STM32F4: Fixed pointer warning 2016-06-22 08:24:23 +10:00
blckmn a5d46fd084 STM32F4: Updating USB Lib 2016-06-22 08:24:22 +10:00
blckmn bca73007d6 STM32F4: Library update 2016-06-22 08:24:21 +10:00
blckmn d4e96ba8e7 STM32F4: Libraries 2016-06-08 05:32:31 +10:00
blckmn 32e0be9802 A few warnings in the SP lib suppressed. 2016-06-03 20:21:10 +10:00
Michael Hope e569a71c60 usb: add volatile in more places.
Fixes the remaining (and valid) warnings.

Signed-off-by: Michael Hope <mlhx@google.com>
2015-06-30 22:44:11 +02:00
Michael Hope ebc0f53b59 usb: mark register accesses as volatile.
Fixes the LTO build with GCC 4.9.  Tested on the STM32F3DISCOVERY.  I
assume the compiler was doing cross function optimisation, saw that
the same non-volatile address was read twice, and dropped the second
read.

Fixes #763.

Signed-off-by: Michael Hope <mlhx@google.com>
2015-06-30 08:12:24 +02:00
Michael Hope 5c6760fd82 various: tidy up various things found when building with a C++ compiler.
Remove duplicate consts.
Pull in the include files where functions and variables are declared.
Mark file local but duplicated variables as static.
Mark some variable declarations as extern.
Remove duplicated variable definition.

Signed-off-by: Michael Hope <mlhx@google.com>
2015-06-04 22:32:31 +02:00
Michael Hope 31f933ac21 various: mark more constant data so it goes into flash instead of RAM.
Signed-off-by: Michael Hope <mlhx@google.com>
2015-05-29 05:42:08 +02:00
Dominic Clifton 24052eae2e Fix some character encoding issues in comments. 2015-04-22 20:29:21 +01:00
Dominic Clifton 581b0cd897 Fix compiler warning regarding failsafeIndicator 2015-04-22 21:15:47 +02:00
Dominic Clifton 2a37e26715 Use correct flag for GPIOC IDR check. 2015-01-31 22:27:45 +01:00
Dominic Clifton 1efe530ea3 Disable compilation of unused can/cec/crc libraries. 2015-01-08 05:02:23 +00:00
Dominic Clifton 754d0974c5 Fix clock initialisation on new revision CJMCU boards. 2015-01-03 18:58:42 +00:00
Dominic Clifton 996d72eee5 Merge branch 'AlienWii32_defaults' of
https://github.com/MJ666/cleanflight into MJ666-AlienWii32_defaults

Conflicts:
	src/main/target/NAZE/target.h
2014-12-26 18:40:01 +00:00
Dominic Clifton 30ddd177d9 Removing more profanity from code. See #43. 2014-10-15 14:33:10 +01:00
Dominic Clifton d60183d91d Normalize all the line endings 2014-09-15 23:40:17 +01:00
Dominic Clifton 7f027e7e24 Update makefile to use target specific files.
This is an alternative to #ifdef's everywhere which is getting out of
hand.

Confirmed that the VCP is working on the STM32F3Discovery board and
ChebuzzF3 variant.
2014-06-02 18:13:28 +01:00
Dominic Clifton 382356a09c STM32F30x - Fix USB VCP initialisation. 2014-06-02 11:10:19 +01:00
Dominic Clifton 3f8a6c0e20 Add VCP driver (work in progress) 2014-06-02 01:54:25 +01:00
Dominic Clifton d19a5e7046 Cleanup project structure. Update unit test Makefile to place object
files in obj/test
2014-05-31 22:43:06 +01:00
Dominic Clifton f268c9c4f2 Adding the first unit test to verify battery voltage calculations based
on expected ADC readings.
2014-05-05 15:29:23 +01:00
Dominic Clifton 8d9ce86a5a get GPIO and USART ports working.
The STM32F3DISCOVERY board would crash when setting GPIOA Pin_13 or
Pin_14 to analog mode so they are excluded in the gpio initialisation.

The USART GPIO configuration did not work when using the F10x code.  The
USART status and DMA registers are different too.
2014-04-25 15:19:28 +01:00
Dominic Clifton 2cc3a50c01 Avoid calling SetSysClock twice. 2014-04-25 12:10:51 +01:00
Dominic Clifton 0598704872 First commit of port to STM32F3DISCOVERY board.
work-in-progress, it does compile and run though but hangs early on in
main() because of unimplemented features.
2014-04-25 01:09:19 +01:00
Johannes Kasberger 6716ecfe7e added overclock feature 2014-04-15 08:33:37 +02:00
timecop@gmail.com 57cbd784a9 a couple optimizations for dynamic HSE frequency - moved SetSysClock() to run after reset vector + bss init, and changed rcc which used hardcoded HSE_VALUE.
turn off leds/beeper before initializing pins to prevent flash at startup
uninitialized errorAngle fix in new PID


git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@362 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
2013-07-02 00:58:50 +00:00
timecop@gmail.com e010e3a354 Cleaned up SetSysClock to remove duplicated code when configuring HSE or HSI
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@359 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
2013-06-30 06:25:24 +00:00
timecop@gmail.com 005308b430 Applied patch from trunet for running at 64MHz off HSI for broken Chinese kcopter clones
status in cli now prints cpu MHz, 72 when running off crystal, 64 when running off intrc.
corrected WHO_AM_I check for mpu6050 when it's used on alternate address (AD0 high).
corrected PWM driver to consider CPU clock for timer prescalers - now things properly work below 72MHz
added a neat hack for pitch angle calculation so that it's not affected when roll reaches 90deg
added proper math for vector rotation instead of small-angle approximation

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@225 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
2012-10-06 14:40:24 +00:00
timecop 3748f2b72d patch for core_cm3 and new gcc fail
commented values in vbat calculation

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@116 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
2012-03-17 07:13:45 +00:00