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.

Compiler/RM57L843: RM57L843 FREERTOS

Part Number: RM57L843
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

 Dear TI Engineers,

Hope you are fine.There is a problem that occurs in ( RM57L843 FreeRTOS).I am using  xSemaphoreCreateMutex() function which is creating mutex but when calling this function  error occurs which is attached in the figure.I think there is a problem in setting of MPU in HALCOGEN or in FREERTOS driver in RM57.The same  xSemaphoreCreateMutex() function  is successfully used in (porting of FreeRtos )in  STM32F103 board and in Visual studio (porting of freertos) .Here no error occurs because mpu is not used by both environment(visual studio and STM32).But in (RM57 FreeRtos )it is showing error because mpu is the additional feature that is used by RM57.Please provide me a solution for this problem.
Thanks and Best Regards,
Bilal Zahoor Ahmed.
  • Hi, Bilal,

    Sorry for the slow response. I was out of office last week and just get back today. I'll take a look at the issue and reply later.

    Rex

  • Hi, Bilal,

    The MPU_xQueueCreateMutex() is defined in os_mpu_wrappers.c. Do you have it in your folder? You may need to include the file in your makefile.

    For MPU configuration, you may need to manually modify the MPU regions in os_port.c if HalCoGen greys out the MPU configuration. You can find more info on MPU in RM57Lx TRM at http://www.ti.com/product/RM57L843/technicaldocuments#doctype6

    Rex

  •    

    Hi Rex,

    Yes , (os_mpu_wrappers.c) file is included in the project folder and also included in make file.Functions such as xSemaphoreTake() and  xSemaphoreGive() and others are also present in os_mpu_wrappers.c file which are executing succesfully without any error.The only function is showing error is MPU_xQueueCreateMutex() .If file is not included in project folder and make file then other functions are also showing error but thy dont. It means there is a setting problem in halcogen or in driver file or any other problem.I have read the mpu document but didinot get any solution for my problem.Suggest me a solution for this problem

    Regards,

    Bilal Zahoor Ahmed.

  • Hi, Bilal,

    From the CCS window snapshot, it shows a linking issue that the linker can't find the function MPU_xQueueCreateMutex(). Does this function exist in os_mpu_wrappers.c? If it is not in os_mpu_wrappers.c, that explains it. It could be something did wrong during the configuraton.. If the .c file has the function, you may want to find out why this function is not linked in.

    Rex

  • Hi Rex,

     Function MPU_xQueueCreateMutex() is present in two files (os_queue.c and os_mpu_wrappers.c) which is attached in the figure.

    Bilal.

  • Hi, Bilal,

    The snapshot is different from the original post. The original post showed compilation failed for unresolved symbol, MPU_xQueueCreateMutex, but the last snapshot shows the build was successful. Were there any changes between the two snapshots? Since the build is successful, have you tried to run it and what's the result?

    Rex

  • Hi Rex,

    I am out from office now.I only comment the function xSemaphoreCreateMutex() thats why build is successful.When i uncomment the function same error appears which i show you tommorrow.

    Regards, 

    Bilal.

  • Hi, Bilal,

    Ok. That's fine. Let me spend some time to investigate what could be the problem. Thanks!

    Rex

  • Hi Rex,

    Hope you are fine.I cant figure out the exact problem.Why linker is not find the definition for the only function xSemaphoreCreateMutex() .

    Bilal.

  • Hi, Bilal,

    I see the function is wrapped around with #if. Are you sure if the function gets included?

    #if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
    QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType )
    {
    QueueHandle_t xReturn;
    BaseType_t xRunningPrivileged = prvRaisePrivilege();
    xReturn = xQueueCreateMutex( ucQueueType );
    portRESET_PRIVILEGE( xRunningPrivileged );
    return xReturn;
    }
    #endif

    I changed my configUSE_MUTEXES to 1 and compiled without any issue.

    Rex

  • Hi Rex,

    Yes,function is wrapped in #if()   -------    #endif  body. Preprocessors such as  (configUSE_MUTEXES == 1  and configSUPPORT_DYNAMIC_ALLOCATION == 1) both are declared as 1 in the header file.This is not concerned with our problem.Our problem is that linker will not find the correct definition for the function MPU_xQueueCreateMutex().This issue takes too much time however same function is used in different platforms.If you want  to see my freertos project i will send here for more information.Please find the attached project.2577.rtos_demo_project4.rar

    Regards,

    Bilal.

  • Hi, Bilal,

    You can’t compare project for device without MPU with the ones with MPU. Though it works for no-MPU device, it is not necessary that it will work for MPU device without any modification.

    The project you gave me don't have those variables in #if enabled which I asked in my earlier post. There are several others need to set to 1, and eventually I got the following linking error.

    undefined                     first referenced    

    symbol                           in file        

    ---------                     ----------------    

    vApplicationGetIdleTaskMemory ./source/os_tasks.obj

     

    error #10234-D: unresolved symbols remain

    error #10010: errors encountered during linking; "rtos_demo_project4.out" not built

    >> Compilation failure

    makefile:171: recipe for target 'rtos_demo_project4.out' failed

    gmake[1]: *** [rtos_demo_project4.out] Error 1

    makefile:167: recipe for target 'all' failed

    gmake: *** [all] Error 2

     

     

    According to the header file, this function is a callback function prototype and you should provide it.

    After I created a dummy function for it, I was able to build your project.

     

    "./source/HL_sci.obj" "./source/HL_sys_core.obj" "./source/HL_sys_dma.obj" "./source/HL_sys_intvecs.obj" "./source/HL_sys_main.obj" "./source/HL_sys_mpu.obj" "./source/HL_sys_pcr.obj" "./source/HL_sys_phantom.obj" "./source/HL_sys_pmm.obj" "./source/HL_sys_pmu.obj" "./source/HL_sys_startup.obj" "./source/HL_sys_vim.obj" "./source/HL_system.obj" "./source/os_croutine.obj" "./source/os_event_groups.obj" "./source/os_heap.obj" "./source/os_list.obj" "./source/os_mpu_wrappers.obj" "./source/os_port.obj" "./source/os_portasm.obj" "./source/os_queue.obj" "./source/os_tasks.obj" "./source/os_timer.obj" "../source/HL_sys_link.cmd" -llibc.a

    <Linking>

    Finished building target: "rtos_demo_project4.out"

    **** Build Finished ****

     

    I did a search in  FreeRTOS web page and here I found one thread in its support forum similar to yours.

    https://www.freertos.org/FreeRTOS_Support_Forum_Archive/April_2016/freertos_undefined_reference_to_xQueueCreateMutex_40521010j.html

    If this resolved your issue, please click "Resolved"

    Rex

  • Hi Rex,

    Hope you are fine.You are telling the missing settings which are necessary.Please mention it .I have seen the thread related to my problem in FREERTOS forum.and did it according to the forum.

    Bilal.

  • Hi, Bilal,

    Have you resolved the issue? As I mentioned in my earlier post that the code is wrapped around by #if. 

    #if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
    QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType )
    {
    QueueHandle_t xReturn;
    BaseType_t xRunningPrivileged = prvRaisePrivilege();
    xReturn = xQueueCreateMutex( ucQueueType );
    portRESET_PRIVILEGE( xRunningPrivileged );
    return xReturn;
    }
    #endif
    
    

    If any of the configUSE_MUTEXES or configSUPPORT_DYNAMIC_ALLOCATION is not defined as 1, then the code will not be included in compilation. You should be able to find where those variables defined in the folder. In your zip file, I see they are still set to 0. You mentioned in your post that you have set it, but my grep didn't show that they were set. The FreeRTOS url I provided in my post, has the info. 

    If the issue is resolved, please click "Resolved".

    Rex

  • Hi Rex,

    Hope you are fine.The parameters that you are mentioned  (configUSE_MUTEXES or configSUPPORT_DYNAMIC_ALLOCATION ) are set to 1 in the following attached picture. but it still gives compilation error.

    With Regards,

    Bilal.

  • Hi, Bilal,

    That's correct. Just enabling those 2 isn't enough. After setting those 2 variables to 1, do you still get the same undefined symbol of MPU_xCreateQueueMutex? I got different symbols undefined which I need to enable other #define variables. I leave that as an exercise for you to figure what other variables need to enable next. That will be the same practice as finding what #define variables wrapped around the undefined symbols and set those variables to 1.

    If you are still getting the same MPU_xCreateQueueMutex undefined, then I have no idea why it behaves that way. in this case, I would suggest that you check your source file paths to be sure it is the right file get pulled in for compilation.

    I don't think there is anything more that I can do. I'll close this issue.

    Rex