This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM46L852: Do we have an application note or some information links to see how to call alternatively one program and then the other one ?

Part Number: RM46L852

Hello,

I have a technical question regarding scheduling and function calling with 2 .out files loaded in my target.

Supposing I want to separate my software in two parts.

One is built by me (applicative), and the other by someone else (drivers) and they are stored in separated FLASH areas and they are communicate through shared memory.

Do you have an application note or some information links to see how to call alternatively one program and then the other one ?

Is it just possible to use assembly command like :

-        LCR program1_entry_point

-        LCR program2_entry_point

Sorry if it’s a basic question, I just want to have the most quickest and nice way to do it, I guess you know this very well from a while.

 

  • Hello,

    What is LCR? I guess it is a branch instruction for other device. ARM Cortex device doesn't use LCR.

    If the two parts are compiled/linked in one project, you can call the functions directly.

    If they are in different projects, you need to call the functions by the address:

    ((void (*)(void))address_of_program1_entry_point)();

    ((void (*)(void))address_of_program2_entry_point)();

  • Hello David C,

    If you're trying to run two or more threads of execution simultaneously, you'll want to be using the capability of an operating system to help manage this.  There are multiple options available for the Hercules microcontroller line (at least one RTOS which is free); the details of how you would use them would depend somewhat upon which operating system you use.

    For many of the options it gets easier if you link them together into a single flash image, but it's not insurmountable to do otherwise.  Keep in mind that there are more "sharing points" between the two domains than just the shared memory you mentioned; they'll need to cooperate properly such that interrupts, MPU settings, exception vectors, microcontroller peripherals, and so forth work properly (on top of the usual cpu-register handling when swapping execution contexts, which every OS will help with).

    Or perhaps you're thinking of something a bit simpler, where the "drivers" will only be interrupt driven.  This would make implementation without an operating system easier (although you might still want to use an RTOS, say, to help with your own application's development), but you'll still need to manage the shared resources somehow.

    I don't believe you're asking for a bootloader, where the microcontroller starts out running one application and then switches to another.  If you are, you can find several posts in this forum with links to examples and related discussion.  These are commonly implemented as separate projects, linked into separate outout files, and are largely but not quite independent of each other.  Their implementation is simpler because once the execution of the bootloader has finished, the application is free to re-initialize most of the system to meet its own needs.  But even there, there remains shared resources; in particular, you can only really have one "owner" of flash sector 0, which contains a jump table used for ARM CPU exception handling (including an exception commonly used by operating systems).

    --thx