How to import example in Nordic folder to mbOS environment

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How to import example in Nordic folder to mbOS environment

    I am new to mbOS but I am familier with RTOS in general.
    I have an example of BLE UART take from Nordic example in package nRF5_SDK_15.2.0_9412b96 I download. It locate here with all of its <Package Folder>\nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_uart. It is open in SES.
    Now I open the start example of mbOS for nordic with the some device. There are 2 task of blink. I want to run the BLE UART example as a task in the mbOS example. I want to know how can I copy all the C folders of the BLE UART example as show in the Project explorer, and the user include Directories with the right path, conjunct 2 project together.
    Thanks.
  • Hello bar, and thanks for your inquiry,

    Unfortunately, there's no automated way to merge the projects:
    You'd have to manually add the files to your project tree and subsequently add the include paths as well.

    Once done, you'd also need to perform 3 minor modifications to the board support package that was shipped with embOS to work with the BLE.
    That is, first, the embOS BSP file RTOSInit.c will typically include a line to set the Vector table offset register. This can't be done when utilizing BLE, and users should therefore simply comment/delete that line.
    Second, the same file will call __WFI() within the function OS_Idle(). This, too, can't be done with BLE, so commenting/deleting that line is suggested as well.
    Third, RTOSInit.c will configure the embOSView communications interface for J-Link (#define OS_VIEW_IFSELECT OS_VIEW_IF_JLINK). This, once again, is not possible with BLE, hence using UART / Ethernet is suggested if available, otherwise the communications interface should simply be set to OS_VIEW_DISABLED. For clarification, SystemView may still be used via J-Link - only embOSView cannot.
    With these modifications, your selected bluetooth sample application may then simply be executed as an embOS task.

    Please also note that we're currently creating an evaluation software including embOS and Nordic's BLE for Segger Embedded Studio. While I can't give a definitive timeline, yet, please let me know whether you're interested in it and I will gladly notify you once it becomes available.

    Do not hesitate to contact me if there's any further questions.

    Best regards,
    Martin
  • THanks Martin.
    1.In my embOS I fond this file RTOSInit_nRF5x.c
    Is this is the right one?
    2. for the _WFI I found this function
    void OS_Idle(void) { // Idle loop: No task is ready to execute
    while (1) { // Nothing to do ... wait for interrupt
    #if ((OS_VIEW_IFSELECT != OS_VIEW_IF_JLINK) && (OS_DEBUG == 0))
    //__WFI(); // Switch CPU into sleep mode
    #endif
    }
    }
    _WFI all ready close. Is this the right function?
    3. I didn't find #define OS_VIEW_IFSELECT OS_VIEW_IF_JLINK in that file. Can it be so?
    Thanks
    Bar.
  • Hello bar,

    bar wrote:

    1.In my embOS I fond this file RTOSInit_nRF5x.c
    Is this is the right one?
    Yes, that's the right one.

    bar wrote:

    2. for the _WFI I found this function
    void OS_Idle(void) { // Idle loop: No task is ready to execute
    while (1) { // Nothing to do ... wait for interrupt
    #if ((OS_VIEW_IFSELECT != OS_VIEW_IF_JLINK) && (OS_DEBUG == 0))
    //__WFI(); // Switch CPU into sleep mode
    #endif
    }
    }
    _WFI all ready close. Is this the right function?
    Yes, that's the right one as well.
    Up to embOS V5.00a, the __WFI() instruction was not commented, while with embOS V5.02a and subsequent releases, that __WFI() is commented out by default. I was unaware which exact version you are using, hence I mentioned this as a required modification just in case you were using previous versions of embOS.

    bar wrote:

    3. I didn't find #define OS_VIEW_IFSELECT OS_VIEW_IF_JLINK in that file. Can it be so?
    The appropriate defines should be at line 74 of that file, i.e.:

    Source Code: RTOSInit_nRF5x.c

    1. /*********************************************************************
    2. *
    3. * Configuration of communication to embOSView
    4. */
    5. #ifndef OS_VIEW_IFSELECT
    6. #define OS_VIEW_IFSELECT OS_VIEW_IF_JLINK
    7. #endif
    Please let me know if I can be of any further help.

    Best regards,
    Martin