No announcement yet.

Parent-Child syscall system

  • Filter
  • Time
  • Show
Clear All
new posts

  • Parent-Child syscall system

    We are actually developing a display application for various vending system. We are developing with another company together and make some architecture of the display software to share perfectly the work.

    Our idea was to develop a first part called "core" and the other part "app".
    The "core" should do the following thing :
    - Schedule the system tasks (we develop a simple state-machine scheduler)
    - Communicate through a proprietary protocol with our vending devices
    - Expose function to the application
    - Update through the proprietary protocol itself and the "app" part (a bootloader will flash the "core" into flash)

    The "app" should do the following :
    - Drawing the display different screens
    - Detect touches on buttons, etc...

    For both company (us and the other one), the core will be always identical and updatable. The "app" will be different, because of branding and other fields applications. That mean, we want that the "core" can load dynamically the "app". We don't want to recompile the "core" part. Like every OS, there is like the kernel ("core") and the user application ("app").
    So we design an API facade that will pass function pointers from the "core" to the "app"

    So there is 2 solutions for us :
    1) Compile the core and the app together generating one .4XE flashable image. This solution works for now perfectly.
    There is still some disadvantages :
    - For both company, our images will differs completely, even when the "core" stay the same...
    - The size of the whole image is limited to 32 kB, maximum size of a flash bank.
    2) Compile the "core" and the "app" separatly, then burn the "core" to the flash, and just copy the "app" to SD card or burn it to another flash bank.
    Then, in the "core", we could call "file_LoadFunction()" and pass our function pointers. The data are passed perfectly, but the system give "Adress trap" errors.
    After reading the documentation, we discover that the child process is place in an other memory area (which could be good for the use of a kernel). Then when the child
    tries to call the passed parent function pointer, it crashed. We though that the memory was shared :-S. We even tried flash_Exec()...

    So is there a solution for the 2) ? We read the AN-...-P2005, but it's for variable sharing, and the callback example are always the function pointer received from file_LoadFunction(), which work.
    Is there some syscall possibilities that the child could make to the parent ?

    Below an illustration of the architecture :


    var m_coreConnectorFunc1 := NULL;
    var m_coreConnectorFunc2 := NULL;
    var m_coreConnectorFunc3 := NULL;

    func coreConnectorInit(var pInterface) // Were pInterface is [pCoreFunc1, pCoreFunc2, pCoreFunc3, ....]
    m_coreConnectorFunc1 := pInterface[0]
    m_coreConnectorFunc2 := pInterface[1]
    m_coreConnectorFunc3 := pInterface[2]


    func childOtherFunction()

    // It crash like here...
    m_coreConnectorFunc1(param1, param2);


    func coreFunc1(var a, var b)

    func coreFunc2(var a)

    func coreFunc3(var a)

    func appConnectorInit()
    var pInterface[N];
    var loadFunc := NULL;

    pInterface[0] := coreFunc1;
    pInterface[1] := coreFunc2;
    pInterface[2] := coreFunc3;

    loadFunc := file_LoadFunction("myfil.4FN");

    loadFunc(pInterface); // Calling the child

    // Crash in loadFunc :-(

    Thank you very much for your help! ;-)