2024-05-18 10:08 AM
I have a bootloader project that can jump to a QSPI application under normal conditions. When I first install this application and then install my application that I created separately for QSPI, it works without any problem.(Bootloader + App).
But what I want to do is to combine bootloader and application projects. I tried to add the App code into the Bootloader application with a method like below, but even if the compilation result was successful, the debugger gave an error and I could not load the application to flash.
My App Code
Jump Code
I've never tried anything like this before. Maybe I'm being ridiculous, sorry.
2024-05-18 10:12 AM
Yes, bootloader and application code can be in the same CubeIDE project.
But why one can want it? No idea. People want so many different things, some more reasonable, some less.
2024-05-19 02:55 AM
If this wil be true bootloader, then this will not work correccly.
2024-05-20 09:08 AM
I think the problem is that I use qspi and flash together. The two work fine separately but I can't use them in the same project. This may be a problem with stm32h750vbt6 rev V (old ?) or maybe it is related to the external external loader I am using (works smoothly on cube programmer and as App (without FLASH section))?
2024-05-20 09:09 AM
Why
2024-05-20 09:24 AM
Well calling main() in an entirely different application won't correctly initialize the statics, ie your variables, either with content, or zeros.
The idea is that the Boot Loader and Applications are two separate entities, and can reuse RAM independently.
Now with the STM32 and QSPI you REALLY want the loader to bring up the bulk of the system, things like the primary clocking, PLL, external memories (peripherals and pins). The QSPI needs to be viable before you can copy content from it and execute.
It is best to do this ONCE and EARLY, so the system is running at optimum speed, and you don't have to worry about the ground underneath you shifting.
Not sure how well CubeIDE permits multiple builds under one project, they allow for Debug / Release, but things like Keil allow for one project to have multiple build contexts, allowing for a Boot Loader, with it's own main.c, main(), vectors etc.
I don't know if this is significantly helpful, even for source code control, as loaders typically don't need to do a lot of faffing around, they have a very simple defined goal, and shouldn't need constant rework over the life of a project/design. They just need to get the board to basic viability, sanity check the application image, and transfer control. Perhaps allow for recognizing and update condition, and replacing old app with new one.
Build the loader for 0x08000000 and the app for 0x90000000, have them be operationally independent, and don't have the app mess with the PLL, MCU or QSPI, except for situations where you account for the fact you can't break the memory you're currently executing from.
2024-05-20 09:30 AM
Right, and why would you want the stress of them working together in some mixed hybrid? You'd have to deal with the code foot-print, and where code and libraries in the working-set live, and what the call-tree dependencies are.. ie you can only use code that's in functional memory at the time you call it.
The boot loader that can live in a few KB, only needing to bring up the MCU, clocks and the external memory, it can then hand-off to an application that can then, contractually, expect both internal and external memories to be completely viable.
You're trying to push water up-hill, it's a bunch of effort, and it's not clear you've understood the assignment..
2024-05-20 10:30 AM
Actually, when I tried a similar code with f769-disco, no problem. I'm not sure but the external loader seems to corrupt the FLASH SECTIONs content. Also now I can't even use the QSPI memory as read only (BL+APP is no longer. like FLASH + QSPI). Whe external loader can't be used with FLASH section (0x08000000).
2024-05-20 10:42 AM
same app on f769 fully working
I think there is a problem either in the mcu or in the external loader. Is it possible that the external loader can access the flash section?
2024-05-20 12:50 PM
I use the external loader in this repo .