Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[H7] Migration to FW V1.4.0 library #8546

Merged

Conversation

@jflyper
Copy link
Contributor

commented Jul 8, 2019

Semantics preserving set of commits were very useful 馃槈

Now we can start working on "LL-izing".

jflyper added 13 commits Jun 24, 2019
Application of

STM32H750 - Fix for H750 Errata 2.11.5. (adcf556)

to V1.4.0
Application of

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

to V1.4.0
Application of

[H7] Modify USB Middleware library for composite device support #8235 (1861c6d)

to V1.4.0
Application of

Use union to access access size sensitive registers (7a0d3e7)

to V1.4.0

----
Note from "Use union to access access size sensitive registers (7a0d3e7)":
----

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.
- VRef and Temperature sensor calibration constants defined in "stm32h7xx_ll_adc.h" are now included via 鈥渟tm32h7xx_hal_adc.h鈥.
- Boostmode is now handled by HAL_ADC_Init using clock configuration parameters to cope with Rev.V.

- Channel specifier (ADC_CHANNEL_x) was a simple integer with V1.3.0, is now an bit field encoded value.
adcTagMap had this value, but adcChannel field in adcOperationConfig was not big enough to store it.
The adcChannel field is modified to hold 32-bit value.

- Rank for channel configuration was a integer, now a bit field encoded value (ADC_RANK_x).
adcRegularRankMap array was added to translate rank number to rank value.

- Other Rev.V changes also seem to be handled within HAL.
Application of
[H7] USB LIB Middlewares change: Avoid null hhid from being deferenced
to V1.4.0
@hydra

This comment has been minimized.

Copy link
Member

commented Jul 9, 2019

Can we merge #8536 and #8537 before this is merged as those targets were built and tested with v1.3.0 and it would be good to have a reference commit in master to 'git bisect' when needed.

As noted in Slack, I have tested a recent branch of this code on the SPRacingH7EXTREME and found a couple of missing changes which have now been merged into this branch by @jflyper

@hydra

This comment has been minimized.

Copy link
Member

commented Jul 9, 2019

@joelucid this PR (specifially, the new LL drivers) is what we need to get bi-direction DSHOT and then RPM filter up and running on the H7 boards.

@mikeller

This comment has been minimized.

Copy link
Member

commented Jul 9, 2019

@jflyper: Now that this is done, can I interest you in looking into updating F7 (and possibly F4 as well) to the latest libraries? We know that at least on F7 this will fix some long standing issues (like #7873).

@jflyper

This comment has been minimized.

Copy link
Contributor Author

commented Jul 10, 2019

@mikeller F7 library update has been noted!!!

@mikeller

This comment has been minimized.

Copy link
Member

commented Jul 11, 2019

@jflyper: Thanks so much!

@@ -274,8 +274,9 @@ typedef struct _USBD_HandleTypeDef

#define LOBYTE(x) ((uint8_t)(x & 0x00FFU))
#define HIBYTE(x) ((uint8_t)((x & 0xFF00U) >> 8U))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
// It's insane to define these here.

This comment has been minimized.

Copy link
@mikeller

mikeller Jul 13, 2019

Member

STM loves to pull these on unsuspecting users of their libraries...

@mikeller mikeller added this to the 4.1 milestone Jul 13, 2019
@mikeller mikeller merged commit bcaf13c into betaflight:master Jul 13, 2019
1 check passed
1 check passed
Travis CI - Pull Request Build Passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.