I have tried to create a static variable in a module content but the variable gets initialized with a random number from anywhere.
I have tried it with a STM32F407-DISCO and with a MIMXRT1062-EVKB with Release 6.1.1, 6.1.10 and 6.2.1 of ThreadX.
For the STM controller I build it with the CubeIDE, for MIMXRT1062 with MCUXpressoIDE and with cmake in VSCode with gcc-arm-none-eabi-10.3-2021.10 - same result.
What I did not find is, where the register r9 is set before the gcc_setup.S of the module gets executed? In my case, r9 is set to 0x20000c00 but for my understanding, r9 must be set to 0x20010000. Where comes 0x20000c00 from?
In flash memory, the values of the static variables are set correctly but the copy of the flash data to RAM is not correct.
What am I doing wrong? Is there a flag missing or is there a problem with the load of the module from the module manager?
How is the module being loaded via the module manager? Generally, ThreadX modules should be built in a PIC and PID fashion so the R9 data area address should be determined when the module is loaded.
Hey,
I have tried to create a static variable in a module content but the variable gets initialized with a random number from anywhere.
I have tried it with a STM32F407-DISCO and with a MIMXRT1062-EVKB with Release 6.1.1, 6.1.10 and 6.2.1 of ThreadX.
For the STM controller I build it with the CubeIDE, for MIMXRT1062 with MCUXpressoIDE and with cmake in VSCode with gcc-arm-none-eabi-10.3-2021.10 - same result.
My example for the CubeIDE is attached.
The Memory config is:
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 0x00010000 }
Module Flags:
What I did not find is, where the register r9 is set before the gcc_setup.S of the module gets executed? In my case, r9 is set to 0x20000c00 but for my understanding, r9 must be set to 0x20010000. Where comes 0x20000c00 from? In flash memory, the values of the static variables are set correctly but the copy of the flash data to RAM is not correct.
What am I doing wrong? Is there a flag missing or is there a problem with the load of the module from the module manager?
Many thanks for any help and BR
cubeide.zip