Commit Graph

70 Commits

Author SHA1 Message Date
jflyper 697d0f7ed3 [H7] H7A3 support 2020-11-01 00:32:39 +09:00
Michael Keller a54e31a06a Changed optimisation on F7X2 targets to '-O2' to save flash space. 2020-10-19 09:10:43 +02:00
Unknown 5bf4f71a6d Initial install of GHST driver
First pass at GHST driver including low-latency control, and basic telemetry.

Fix Ghost channel scaling

Use ghstChannelData instead of rxRuntimeState->channelData

Integrate PR feedback

Primarily de-tab and a few cosmetic changes.

Keep Travis CI happy

Removed unused function

Rework ghost driver to reduce time in ISR, move processing

As requested in PR review.
Fixed issue in telemetry driver, mAh consumed is transmitted as units of 10mAh, not 1mAh.

Resolve Packet Collision Issue with GHST

Send telemetry packets only within a well defined time slot after an incoming Rx packet.

Remove unnecessary comment

rxRefreshRate doesn't need to be dynamic.

Ghost - Remove special case from scheduler

No need to reschedule telemetry for the Ghost protocol.
2020-10-14 21:52:33 +13:00
Michael Keller 5f8d9da384
Merge pull request #10224 from jflyper/bdev-h7-bbdshot
[H7] BB-Dshot support (TIM1/TIM8 limited version)
2020-10-05 00:28:34 +13:00
jflyper fe1a05fa2a [H7] BB-Dshot support (TIM1/TIM8 limited version) 2020-09-30 23:27:23 +09:00
jflyper e4d7c4e152 [G4][SYSTEM] Basic & build files 2020-09-30 18:20:05 +09:00
Dominic Clifton 09ac5be8d6 Cleanup and de-duplicate H7 linker scripts 2020-03-26 16:50:21 +01:00
Dominic Clifton fb6f93bc0d Remove 'flash' from the ram-based linker script filename. 2020-03-26 16:37:00 +01:00
jflyper ec2aac314d [I2C] Introduce computational I2C waveform configuration for HAL based MCUs
Tested with
Nucleo-F722ZE I2C1 on PB8,PB9
Nucleo-H743ZI I2C1 on PB8,PB9 and I2C4 on PF14,PF15
2020-03-10 12:11:50 +09:00
jflyper be923434b8 Rename FLASH_SIZE to TARGET_FLASH_SIZE 2020-01-20 12:30:28 +09:00
Bruce Luckcuck 04844bd5a1 Refactor common USB MSC code and improve activity LED
Eliminated the duplicated MSC functions in the architecture specific files and moved to a shared common.

Improved the activity indicating LED and made it consistent between onboard flash and sd card mass storage mode.
2019-12-02 22:08:19 -05:00
mikeller 11b3ba224c Moved MCU specific defines into 'common_pre.h' if not used in the STM32 libraries. 2019-10-27 23:09:33 +13:00
jflyper adf6fd1764 DMA bit banging Dshot, first cut
F405 working (OMNIBUSF4SD target)
F411 not tested
F722 working, needs testing (OMNINXT7 target)
F74x not working

NOX target (temporary)

bb_dshot with telemetry on f4
bbshot f7 targets and fix crash due to missing debug pins

remove empty line

add empty lines

remove OMNIBUSF4 specific debug pins

add missing comma

add missing comma

Use separate bbTimerHardware array to fix unified targets

eliminate now unneeded timerGetByUsage

don't duplicate timer1 def

Add auto mode, rename dshot_bbshot to dshot_bitbang

remove newline

renamve various files

various changes to address feedback

address feedback

address feedback

add pacer timers to timer show

don't disable telemetry if dshot_bitbang is on or auto

Address feedback, add faster decode implementation based on bit banding, modify dma parameters to reduce required memory bandwidth on half

remove debug output

remove NOINLINE

Protect gpio direction change with critical sections

FIXWS_SAVE_INDEX

add static back in

no forward typedef

address review feedback

disallow proshot1000 with dshot bitbang

Extracted and plumbed up 'dbgPin'.
2019-09-04 16:06:48 +12:00
jflyper 0780d1919c [H7] LL-Dshot support with DShot GCR telemetry 2019-08-17 02:11:48 +09:00
jflyper ff759034f3 Refactor (consolidation and separation of stdperiph and hal) 2019-08-02 04:11:22 +09:00
mikeller 1c60776487 Added target variant NUCLEOH743_RAMCONFIG to get CI coverage of 'EXST' changes.
Changing over to be RAM based.

Changes required for MPU configuration service.

Added documentation.
2019-07-27 18:20:05 +12:00
jflyper 7225aadb7d Move MAX_MPU_REGIONS into STM32H7.mk where EXST is visible 2019-07-24 17:16:34 +09:00
jflyper c8252fabdd Introduce memProtXXX MPU configuration service 2019-07-24 11:32:11 +09:00
jflyper d924e59c3c [H7][LIB][SDMMC] Workaround for SDMMC Errata 2.11.4
Application of

STM32H750 - Apply workaround to the SDMMC Errata 2.11.4 (8446832)

to V1.4.0
2019-07-08 09:30:55 +09:00
jflyper 400a122f30 [H7] STM32H7.mk additions and cleanup 2019-07-08 09:30:21 +09:00
Michael Keller 9b04b5ebd7
H7 build script updates (#8492)
H7 build script updates
2019-06-28 19:23:20 +12:00
Dominic Clifton 0c7b161c32 STM32H750 - Allow targets to override TARGET_FLASH. 2019-06-27 02:57:55 +02:00
Dominic Clifton aea8733e4f STM32H7 - Allow targets to override linker script. 2019-06-27 02:57:55 +02:00
Dominic Clifton 05c518847d [H7] Relocate startup files to match betaflight/master branch 2019-06-26 12:36:57 +02:00
jflyper dad1110181 [H7] Relocate LD files to match betaflight/master branch 2019-06-26 12:36:34 +02:00
Dominic Clifton e81d11049f Fix F1/F3 OPBL targets using wrong linker script. 2019-06-09 19:04:39 +02:00
Dominic Clifton 0632eeb934 Support compilation of EXST (EXTERNAL STORAGE) targets
- Initial

- Adjust load address of EXST firmware.

- Add helper script to pad an EXST binary to the expected size.

Padded firmware currently required due to a bug in the flash/dfu code
which causes anything less than a flash page size to be truncated when
uploading new firmware via the bootloader DFU.

- Minor linker script cleanups.

- STM32H7.mk change hardcoded TARGET_FLASH (384) to FIRMWARE_SIZE

- Delete unused configuration section entries from linker
scripts.

- Increase EXST firmware size to 448K.
It turns out 384K wasn't enough for a feature-complete firmware.

- Update pad-exst.sh to use 448K by default.

- Move the EXST file generation to the makefile.

[EXST] Embed firmware hash in ELF

- Add debug marker at end of CODE_RAM section.

It was found when transferring firmware to the H7 RAM via a BMP probe
using the 'gdb load' command, that the last few bytes were not
transferred, this debug marker is present to ensure all needed parts of
the firmware are present.

Example memory view of corrupted bytes at end of transfer:
0x2407DFAE  DEB90000 DEB9DEB9 DEB9DEB9 DEB9DEB9  ..¹Þ¹Þ¹Þ¹Þ¹Þ¹Þ¹Þ
0x2407DFBE  000000B9 00000000 00000000 00000000  ¹...............

should be:
0x2407DFAE  DEB9DEB9 DEB9DEB9 DEB9DEB9 DEB9DEB9  ¹Þ¹Þ¹Þ¹Þ¹Þ¹Þ¹Þ¹Þ
0x2407DFBE  00000000 00000000 00000000 00000000  ................

- Remove debug marker in EXST firmware.

STM32H750_EXST - Provide space for empty hash.

* Bootloader will run firmware if hash is empty, without re-verifying
RAM content against hash.
* CODE_RAM always shows as 100% usage.

STM32H750_EXST - Use a specific ELF section for a hash.

Two benefits:
1) CODE_RAM no-longer shows 100% full, since it is no-longer
padded/filled.
2) Prepares the code so that objcopy can be used to inject the hash
into the ELF.

STM32H750_EXST - Patch MD5 into ELF.

Process is now as follows.

* Binary generated (via make target dependency) so there is something to
hash.
* Binary copied (and padded).
* MD5 Hash computed.
* xxd patch file generated from hash.
* xxd hash patch applied to copy of binary at correct address.
* elf .exst_hash section dumped.
* hash injected into into dumped section.
* elf .exst_hash section updated with updated dumped section.

Replace EXST with USE_EXST.

Add documentation for the EXST firmware format.

Add table formatting to EXST documentation.

Update bootloader block.

Update H750 EXST linker script to use block format 0x00.

Use .exst.elf and .exst.bin on the exst files.

Add 'no checksum' to list of checksum hash methods.

Update EXST build system so it generates the following sets of files

obj/main/betaflight_TARGET.elf
obj/main/betaflight_TARGET.map
obj/main/betaflight_TARGET_EXST.elf
obj/betaflight_VERSION_TARGET.bin
obj/betaflight_VERSION_TARGET.bin.md5
obj/betaflight_VERSION_TARGET_EXST.bin

Update EXST build system to be more user-friendly.

* user-flashable files are generated in the normal place.
* Intermediate files are generated in `obj/main/...`
* Removes the `exst` goal.
* Adds .hex generation for EXST builds based on the patched .elf.

To build EXST targets, simply use `make TARGET=x` as normal and flash
the resulting `.hex/.bin` files rather than the .exst.bin file.

Developers can use either the `.elf` or patched `_EXST.elf` file as is
appropriate for their needs.

EXST documentation updated to match changes to build system.
2019-06-07 09:14:49 +12:00
jflyper 6beeca38c3 Consolidate F7 and H7 VCP HAL code except usbd_conf.c 2019-06-01 11:57:50 +09:00
jflyper dacb709e38 [H7] System and build files
Basic system files

- Initial system files

- Additional RCC clock enables for testing

- Coding style tidy (target/system_stm32h7xx.c) and enable MCO for testing

- Clock generator changes for SPI support

- Setup MPU for "D2 SRAM as write-through by MPU, call it DMA_RAM"

- Drop USB clock enabling from driver/system_stm32h7xx.c

- stm32h7_hal_conf.h for persistent object storage

Basic build files

STM32H7.mk changes

- STM32H7.mk for USE_UART and USE_SERIAL_RX

- Modify STM32H7.mk for inclusion of SPI driver

- STM32H7.mk change for D2 SRAM as write-through by MPU, call it DMA_RAM

- STM32H7.mk for DMA facility

- STM32H7.mk for [TIMER] For "Initial cut without Dshot"

- STM32H7.mk change for [LED_STRIP] Add LED_STRIP

- STM32H7.mk for [ADC] Initial cut without internal sensors

- STM32H7.mk for Enable I2C (HAL)

- STM32H7.mk for "Enable HAL-based DShot (no burst yet)"

- STM32H7.mk change for transponder

- STM32H750 - Add platform support.

- STM32H750 - Add H750 MCU ID.

- STM32H743 - Add MCU ID.

STM32H7.mk change for "Burst Dshot First working version"

Fix boot loader request

STM32H750 - Add PERSISTENT memory support.

STM32H743 - Add PERSISTENT memory support.

Use PERSISTENT memory for bootloader request.

Using DTCM RAM did not work on H750.

Change flash latency from 4WS to 2WS

STM32H750 - Fix reset of RCC_CR to reset value.

Note: The comment above the code didn't match code.

STM32H750 - Remove duplicate startup code, see SystemClock_Config.

STM32H7.mk changes for Port RTC backup register based persistent storage for H7

Make use of persistent object facility

Force reboot after possible boot loader activity

Enable CRS

stm32h7xx_hal_conf.h for H7 - QuadSPI support

stm32h7xx_hal_conf.h for STM32H7 - SDCard/SDIO using HAL Driver

stm32h7xx_hal_conf.h : Fix systick to be 0x00 instead of ST's default 0x0F.
This fixes the ability to use HAL_Delay() from an ISR, as required by
the ST's USB Library.
Specifically, systick handler must be a higher priority than the USB
FS/HS Interrupt handler priorities.

stm32h7xx_hal_conf.h for Add PID-Audio support

source.mk for H7 - QuadSPI support

drivers/system_stm32h7xx.c for H7 - QuadSPI support

STM32H7.mk for H7 - QuadSPI support

STM32H7.mk change for CDC-HID support

common_pre.h updates

- Scheduler parameters to same as F4 & F7

- Enable some important default features

- STM32H7 - Enable ITCM RAM.
Requires voltage scaling fix from commit
6e684c609310024141c43de484a5e78103140e3c

STM32H750 - Disable caches before reboot.

Prior to this when EEPROM_IN_RAM was used the persistent data section
would have corruption immediately after a reboot, prior to even the
Reset_Handler code having been executed.

drivers/system_stm32h7xx.c Touch-up after 2019-02-02 rebase

STM32H7 - Write protect ITCM ram.

Remove local defs for RESET_xxx symbols

STM32H750 - EXST firmware reboots to FLASH bootloader, rather than ROM bootloader.

STM32H750 - Disable some MCO/clock testing code as the pins interfere with new targets.

STM32H750 - Don't disable data caches after bootloader.

Observed that disabling dcache after cold boot with BOOT pin high causes
segfault.

drivers/system_stm32h7xx.c for STM32H7 - SDCard/SDIO using HAL Driver

drivers/system_stm32h7xx.c change for Move SDMMC clock init into SDIO driver

drivers/system_stm32h7xx.c: Cleanup some Clock/MCO/GPIO initialisation code.

drivers/system_stm32h7xx.c for Reset if systick is stuck.

STM32H7 - Fix missing CPU voltage scaling.

It appears this was the cause of other seemingly random issues:

* Crash soon after enabling USB.
* Flash write failures.
* Random un-explainable crashes.

Change RCC_HSE_BYPASS to RCC_HSE_ON

Even Nucleo-H743 seems to work without setting HSE_BYPASS.

STM32H7xx - Move memory section initialisation earlier into the init sequence.

Allows startup-code/libs/etc to be moved into different memory regions.

Don't touch vector table in EXST targets

STM32H750_EXST - fix boot loop

target/system_stm32h7xx.c for STM32H7 - SDCard/SDIO using HAL Driver

target/system_stm32h7xx.c change for Fix SD card clock speed selection

STM32H750_EXST - Reset MPU regions on boot.

* Failure to reset regions will result in mem-fault if bootloader has
configured a similar region.

STM32H750 - Fix missing include of platform.h in system_stm32h7xx.c

This caused the SDMMC peripheral clock to be un-configured (at reset
state) when USE_SDCARD_SDIO was defined.

Change MPU region number for DMA_RAM from 0 to 1

Avoid conflict with ITCM-RAM write protection.

STM32H7xx - HSERDY slow/stuck workarounds.

STM32H7xx - Fix region MPU number for SDIO.

* It was overwriting the previous region causing LED strip and
transponder issues.

Target/system_stmh7xx.c for Reset if systick is stuck.

startup/system_stm32h7xx.c change for non-caching DMA_RAM

H750 - Use SIZE optimization by default due to limited flash space.

STM32H7.mk for STM32H7 - SDCard/SDIO using HAL Driver

STM32H7.mk updates

- Decrease HSE_STARTUP_TIMEOUT to 1 second
* default is 5 seconds, which is too long when HSE gets stuck.

- Add PID-Audio support

Temporary override LINKER_DIR
2019-05-21 02:26:31 +09:00
jflyper e62cc6552d [F7] Move non-library CDC-HID code out of lib tree 2019-05-08 11:59:23 +09:00
Thorsten Laux cec679ac60 incorporte review feedback 2019-03-03 11:33:14 +01:00
blckmn 1bedb1b911 Moved hal config headers etc to ./src/main/startup 2019-02-20 18:24:16 +11:00
jflyper c0d51a5f55 Convert F7s to use RTC backup register based persistent memory 2018-12-03 23:56:41 +09:00
jflyper 99fde1a0ff Use RTC backup register for persistent storage 2018-12-03 09:45:36 +09:00
jflyper 00840ce40f Prepare SD card SPI and SDIO variants for consolidation 2018-10-01 19:44:04 +09:00
Andrey Mironov 7a331d03f4 Added preliminary support for STM32F765xx 2018-09-07 22:47:20 +03: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 d749879cf6 FAT emulation of onboard flash for MSC (#5650) 2018-04-11 11:29:56 +12:00
jflyper 2811171ea3 Prepare MSC for simultaneous multiple storages 2018-04-09 11:18:59 +09:00
Chris 9d5fa7311e Add MSC for F7 (#5629)
* Add MSC for F7

* Fix compilation error.
2018-04-06 12:53:26 +12:00
Michael Keller 75bafb7b71
Merge pull request #3039 from cleanflight/f7-transponder-ir (#5618)
CF/BF - Add support for IR Transponder on STM32F7 boards.
2018-04-06 03:44:18 +12:00
conkerkh 494e42610e Add SDIO for F7 (#5604) 2018-04-04 01:03:54 +12:00
conkerkh f00e4f2a82 Simplify compilation of F4 SDIO enabled targets. (#5603) 2018-04-02 14:41:16 +12:00
conkerkh a9136e2ba0 Add CDC+HID on F7 (#5596) 2018-04-02 14:35:51 +12:00
Michael Keller 92d19e7be6
Merge pull request #3036 from cleanflight/spracingf7dual-pidaudio (#5586)
PID-Audio feature
2018-04-01 11:08:41 +12:00
Michael Keller a8e86880f5
Generalised USB MSC use for all F4 targets with SD card. (#5519) 2018-03-24 16:00:53 +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
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
Dominic Clifton cde9a9517b SPRacingF7DUAL - Dual SIMULTANEOUS gyro support. (#5264)
* CF/BF - Set STM32F7 SPI FAST clock to 13.5Mhz - Gyros not stable at
27mhz.

* CF/BF - Initial SPRacingF7DUAL commit.

Support two simultaneous gyro support (code by Dominic Clifton and Martin Budden)
There are new debug modes so you can see the difference between each gyro.

Notes:
* spi bus instance caching broke spi mpu detection because the detection
tries I2C first which overwrites the selected bus instance when using
dual gyro.
* ALL other dual-gyro boards have one sensor per bus.  SPRacingF7DUAL is has two per bus and thus commit has a lot of changes to fix SPI/BUS/GYRO initialisation issues.

* CF/BF - Add SPRacingF4EVODG target.

This target adds a second gyro to the board using the SPI pads on the back of the board.

* CF/BF - Temporarily disable Gyro EXTI pin to allow NEO target to build.
2018-03-04 11:29:31 +13:00