2020-05-20 07:09 AM
Hi all,
I am a senior developper but not so experimented with STM32 ecosystem.
I have a new board equiped with a STM32F429, which is based on an old board equiped with a STM32F207.
So I would like to re-use (and adapt) the firmware of the old board rather than develloping a new one from scratch.
Of course, the old board uses an old STM32 library and is not compatible with more recent HAL librairies.
Thus, I would need to get the library for F4 equivalent as the one I have for F2 (hopefully it exists :) )
What I have for the F2 library is a directory named ST32Lib with subdirectories
In peripherals, I have many files starting by stm32f2xx (or stm32f2x7) written by MCD Application Team. Most of them in version 1.1.2, some of them have been modified for the purpose of the firmware (example : stm32fxxx_it.c has been modified ...)
In Boards, I guess I have the main c file for F2 boards (stm32f2xx.h) + other files
...
Where and how can I rebuild the equivalent for F4 MCU, which would be compatible with my "old" firmware
Thanks a lot in advance for your help
Kind regards
Antoine
2020-05-20 07:47 AM
Except the CM4 core (which should be fully backward compatible with CM3) and a few minor differences (VOS and overdrive mode, which you don't need to use; divider on VBAT measurement in ADC, minor timing differences in FMC), the F42x is fully backward compatible with F20x. I'd bet, that you could populate F42x to your old F20x board and use the same binary and it will run.
So you can use the same library, or find the F4 SPL (Standard Peripheral Library, unsupported but still available on ST website) if you want to use some of the extra features of it.
JW
2020-05-20 02:23 PM
Back in the day I had a board we could populate with the F205 and F405, the SPL was pretty much interoperable, with the peripherals being the same, only one had the CM4F and the other the CM3. The tip here is to build for the CM3 ISA as there are a couple of instructions outside those used for the FPU, that the Keil compiler would use on one vs the other. The CM3 code for the F205 ran on the F405, and when setting up the clocks/pll one could read the chip ID from the DBGMCU registers and auto configure for F205, F405, F401 and F429, etc to automatically run at the highest speed available from a single binary.
2020-05-23 03:12 AM
thanks a lot, I will try and tell you
2020-05-27 01:38 AM
Hi All,
I downloaded the F4 SPL Library. I changed the search path and header files name (stm32f4xx.h instead of stm32f2xx.h for example)
As I didn't find how to change the CPU ref in the project settings (I'm on STM32CubeIde), I changed it directly in the .cproject file and STM32CubeIde seemed to accept that
At the end, it was finally easy to complete build step with no errors and no warnings
Now, my problem comes when I try to debug : I configured debug that same way it was for the "old" application on STM32F2. I use the same probe but when I start debug, it stops somewhere in the assembly with a stack that seems to be broken instead of stopping at the start of the main function (as it used to do for the "old" application).
What is strange is that if I try to debug directly my "old application" on the STM32F4 MCU, the debug seems to work better and stops on my first line of code (I didn't go farther for the moment as I would be more confident using actual STM32F4 library rather than STM32F2 library for a sTM32F4 MCU)
I suspect my problems comes form the fact that I changed manually the MCU type in the .cproject file....
If you have any (other) idea or fix to propose ....
Thanks in advance,
Antoine
2020-05-27 05:08 AM
> I'm on STM32CubeIde
Linker script issue? Startup code issue?
> it stops somewhere in the assembly with a stack that seems to be broken
Post details.
JW