Skip to content

Fix F4x7vx definitions #940

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 18, 2020
Merged

Fix F4x7vx definitions #940

merged 3 commits into from
Feb 18, 2020

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Feb 17, 2020

Issue reported by @stas2z
#937 (comment)

Thanks

@fpistm fpistm added the fix 🩹 Bug fix label Feb 17, 2020
@fpistm fpistm added this to the 1.9.0 milestone Feb 17, 2020
@stas2z
Copy link
Contributor

stas2z commented Feb 17, 2020

One little note about ccm ram since you are included it to loader script and defined a region

At least at f4, it have an issue with dfu upload
After upload board can stuck in hardfault when accessing ccm cuz dfu bootloader disable ccm clock, so you need to enable ccm clock manually in your code to prevent it.
Simpliest way is to include __HAL_RCC_CCMDATARAMEN_CLK_ENABLE() call to SystemClock_Config

@fpistm
Copy link
Member Author

fpistm commented Feb 17, 2020

@stas2z
I used Black F407 several time with DFU and doesn't met this issue.
Do you used a custom DFU command and /or tools ?

@stas2z
Copy link
Contributor

stas2z commented Feb 17, 2020

@stas2z
I used Black F407 several time with DFU and doesn't met this issue.
Do you used a custom DFU command and /or tools ?

Have you accessed ccm on it? You can simply check this issue, just define estack to ccm origin+0x10000, upload, and upload it again, it will stuck until reset
Ive tried cubeprog and dfu-util, same issue

@fpistm
Copy link
Member Author

fpistm commented Feb 17, 2020

Ok this is because you specifically access it 😉
By default this is not used as nothing is store to it.

@stas2z
Copy link
Contributor

stas2z commented Feb 17, 2020

Sure, as i said "can stuck in hardfault when accessing ccm"
I mentioned this issue cuz you added this section, so anyone who will try to utilize defined ccm section will face this issue with dfu 😬

@stas2z
Copy link
Contributor

stas2z commented Feb 17, 2020

Really, im serious, i think it's a bad idea to provide support for this F4x5/7 feature and miss simple issue which can cause serious headache (believe me, i spent a few hours trying to find out whats wrong with it)
CCM is a huge part of memory (half of RAM), it's fast, and it is a nice place for stack or FreeRTOS stack (heap1/4/5 with user defined ucHeap @ CCM) or some kind of framebuffer (in case you are not going to use DMA as DMA have no access to CCM)

@fpistm
Copy link
Member Author

fpistm commented Feb 17, 2020

so you advise to not add it to the linker script ?

@stas2z
Copy link
Contributor

stas2z commented Feb 17, 2020

so you advise to not add it to the linker script ?

as an option
but better to add __HAL_RCC_CCMDATARAMEN_CLK_ENABLE to "affected" variants clock config
as it enabled by default after reset it will not cause any additional drain, but it will fix issue with dfu bl disabling it

@fpistm
Copy link
Member Author

fpistm commented Feb 17, 2020

This should be OK now.
Some linker script defined CCMRAM while they do not have it.
I guess @MCUdude copy the linker script across the generic F4 variant?

@stas2z
Copy link
Contributor

stas2z commented Feb 17, 2020

Feeling myself boring, but, are you sure ccm memory have to be defined with (xwr) attr?
Afaik ifor f4x5/7 it connected to d-bus only and can't be used to execute code 😬
Ive seen cube generates ld script with xwr also, but...

@fpistm
Copy link
Member Author

fpistm commented Feb 17, 2020

Feeling myself boring, but, are you sure ccm memory have to be defined with (xwr) attr?
Afaik ifor f4x5/7 it connected to d-bus only and can't be used to execute code 😬
Ive seen cube generates ld script with xwr also, but...

No worries 😉
Honestly, in a general way I trust the cube (even if sometimes there are some bugs 😝 ).

Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
@fpistm
Copy link
Member Author

fpistm commented Feb 17, 2020

I've fixed it.

@fpistm fpistm merged commit 3c9aa02 into stm32duino:master Feb 18, 2020
@fpistm fpistm deleted the Fix branch February 18, 2020 06:53
@MCUdude
Copy link
Contributor

MCUdude commented Feb 18, 2020

I guess @MCUdude copy the linker script across the generic F4 variant?

I did, and it has worked on all the hardware I own (well, except for the F407). However, it would be great if the Arduino_Tools repo could provide the correct linker scripts for each target, just like it contains PeripheralPins.c and PinNamesVar.h for every variant

@fpistm
Copy link
Member Author

fpistm commented Feb 18, 2020

Arduino_Tools repo could provide the correct linker scripts for each target, just like it contains PeripheralPins.c and PinNamesVar.h for every variant

Unfortunately, It could not as there is no access to the linker script generator. If the Cube MX had a CLI it would be easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants