My question is explained below.
1. Build the main image.
2. Download main image using JTAG.
3. Build the application image.
4. Download app image using RS232.
5. Run main image.
6. Call the func_a in the application image from the main().
Is it possible on this system?
Please let me know what to do if possible.
hi, the main image must know the entry point of application image, you can find this kind of jump in bootloaders or bootstaps like uboot. i think you can´t return to main image.
static void GoToJumpAddress(unsigned int jumpAddr, unsigned int matchType)
typedef void(*fctType)(volatile unsigned int, volatile unsigned int);
void(*pFct)(volatile unsigned int r0_val, volatile unsigned int r1_val);
pFct = (fctType)jumpAddr;
pFct(0/*dummy value in r0*/, matchType/*matchType in r1*/);
while (1);//never reach
In my case, I had divided the RAM area between the images. Main image start executing after reset, it invokes its startup() routine to initialize its(main partition). The main program calls application's init_app() (using function pointer loading this init_app() function location from a fixed flash location) which in tern invokes the it's startup() to initialize application
You can refer the start() routine available even in your main image/bootloader. Without this(i.e., its data sections initialized), even the main image/bootloader wouldn't have worked. You can probably build the same/similar start() routine into application image also and once the application entry point is invoked, that should simply call its start(). Note in this case, only the data sections of the application image will be initialized(as this is completely separate program than the boot loader).
Hope this helps.
Hi, I don’t think it would be possible to simply perform function calling from main image.
In the application image, you would have define start point located at exact address (i.e. _start) being branched from main image.
I suppose from your description you have 2 independently compiled binaries.