Hi, is it possible - to speed up execution - to execute functions in SRAM, while the main application is running in SDRAM?
I already had a look into the docs, but there is only a way to place a function in SRAM at program begin by telling the linker the functions location. But is there also a way, to copy the function to SRAM right before execution? This would allow many functions to be executed in SRAM, even if they are - in sum - bigger than the SRAM.
I already had a look into the docs, but there is only a way to place a function in SRAM at program begin by telling the linker the functions location.
The chapter about scatter-loading is the last one in the linker documentation. That's the one you want to look at, especially the parts about setting load and execution addresses of functions.
Hi, maybe I misunderstood the docs. When is the function code copied to the execution region? At startup or at runtime - right before execution?
If its copied to SRAM at startup, I can only execute functions which fit the SRAM. When its copied right before execution, I can have many function to be execute in SRAM one after another, when each of them fits into SRAM.
When is the function code copied to the execution region? At startup or at runtime - right before execution?
It doesn't matter - it's not the job of the linker to copy the code. Telling the linker that a function has different load and execute addresses says nothing about where a function is when it is not running. It just says "Hey, when you call the function, it'll he here.". You may feel free to use the the space occupied by the functions code in other ways while the function is not running.
Usually, you will have the startup code copy the function to its execute address, but the startup code is easily modified not to do this automatically.