Hi
I am working on STM32G4 with Keil, ARMCompiler6.13.
There is critical code executing in CCMRAM (start address is 0x10000000) , I want to load this region once when cold boot (my program is able to detemine cold boot or upgrade boot), and will not be changed after even firmware upgrade.
But when the program jumps to the Reset_Handler after firmware upgrade, the CCMRAM was refreshed.I want to keep CCMRAM remain not change during startup.
Then I tried to add "UNINIT" to the CCMRAM region in .sct file, but it doesn't work.
I checked the "Application Note 241 ARM Compiler C Library Startup and Initialization", found the ram is initialized by "__scatterload()" function, then I tried to override this function, but looks it is impossible because there is compressed data in RW region, I don't know how to decompress it.
could someone help on this? could user customize the load function for CCMRAM?
thanks!
The data-compression can be disabled at link time with --datacompressor=off
https://developer.arm.com/documentation/101754/0621/armlink-Reference/armlink-Command-line-Options/--datacompressor-opt
However I am not sure if there is a way to optionally execute __scatterload().
Thanks Ronan
"--datacompressor=off" works fine, but for my program, the image size will increase 5KB with this argument. I will make this as plan B.
In my thought, the better way is disabling the initialization of a specifilt region in the scatter file.This is what i am using to variables, but I don't know if it is applicable to functions.
Below is what I am using, to disable the initialization of specifilt variables
Scatter file: (Added "UNINIT" to region)
Variables declaration: (Added attribute ".bss.xxxx")
And below is what I am trying, to disable the initialization of a specifilt function.
Scatter file:(Added "UNINIT" to region)
Function declaration/prototype: (Added attribute ".ccmram")
Result: region still be initialized.
And I aslo tried attribute ".bss.ccmram", but fail to build the program, it will cause compiler inernal fatal error.
Was i doing with wrong attribute?
Or is it impossible to apply "UNINIT" to Function/Code region?
UNINIT applies only to data sections.
Ronan,
Thanks again.I will set "--datacompressor=off" and make my own "__scatterload()" function.