2022-04-20 07:19 AM
When I use memcpy like this:
memcpy(&config, SavedConf, sizeof(config));
whre config is an object and SavedConf is an array it turns out that nothing is copied.
The problem is in version 1.9 of CubeIDE, when I compile it in 1.7 the array is copied normally.
2022-04-20 07:23 AM
What chip? Is data cache enabled?
> it turns out that nothing is copied
How did you determine this exactly?
memcpy is a pretty standard function. You can step through (in assembly) to verify that it does in fact copy bytes over.
2022-04-20 07:24 AM
A minimum working example demonstrating the error is needed.
KnarfB
2022-04-20 07:41 AM
I check it running program (empty config not allow to log in) and debugging where I see that object config is empty after memcpy.
The chip is stm32g474. I didn't change anything in protection of memory and the same code works on CubeIDE 1.7 version
2022-04-20 08:03 AM
I have installed toolchain 9-2020-q2-update and the problem is solved, but I'd like to know what caused that and what can I change to run it using new toolchain 10.3-2021.10
2022-04-20 09:07 AM
Do what @TDK and @KnarfB have suggested above :)
The ver 10 compiler has different configuration defaults from the 9.x version. Do you get any warnings when compiling? Turn on -Wall and -Wextra (which may flag some lines in Cube-provided code). Turn off optimization and see if that makes a difference. memcpy() may be inlined in come circumstances (usually for "small" structures/objects).
2022-04-20 10:17 AM
You'd probably want to start with a disassembly to understand if it's calling library code, inlining, or optimizing away things.