initializing memory before/after main()
- From: alb <alessandro.basili@xxxxxxx>
- Date: Mon, 06 Feb 2012 09:42:53 +0000
I am using an Analog Devices DSP from the old days (ADSP21020) and the g21k toolset (even though the VisualDSP would do exactly the same in this respect).
When using the runtime header, the vendor provides three calls to setup the hardware, the environment and the processor prior to the execution of the main() program. The mechanism is very simple: the reset vector table looks like this:
JUMP _main (DB);
When using the mem21k utility after linking (you can opt out in case you need to use the loader utility ldr21k which produces a bootloader and takes care of memory initialization), the segment seg_init will contain the necessary information that is needed to configure the memory during the
Since my system has already a boot loader and the way is done is such that to run my main() application it would copy it from flash and then jump to a specific location, I have no way to perform the memory initialization before my main() is called. What I still can do is to call ___lib_setup_processor (and maybe the others as well) as first instruction(s) in my program. This will lead to initializing the memory after the main() is called but before any memory is used. I would like to know if there is any caveat with this approach and if there's something I need to take care about that goes beyond these library calls.
Certainly I may as well take care about memory initialization explicetely, in my program, without any need to care about seg_init.
Any suggestions/ideas are appreciated.