elivoe

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • elivoe
    Participant

    Hi,

     

    I have already tried to reproduce it on a clean project created from scratch before I started this topic. I wasn’t able to reproduce it in this small project, although it occurred in two different of our larger projects. I will put some further effort into this and hope to reproduce it in future to understand what exactly is going on here.

    elivoe
    Participant

    Hi,

     

    I’ve tried both of your suggestions and both ended in the same problems as I described in my first post. The ‘testCount’ variable couldn’t be found by GDB and so all tests are executed.

     

    Yours,

    Elias

    elivoe
    Participant

    Hi,

     

    thank you for the background information. It helped me a lot understanding what is going on. I was able to fix the error, it really seems to be an optimization problem.

     

    What helped for me was to make the testCount and the pTests variable global and volatile instead of passing it with the function. In this case GDB could find the variables.  Maybe GCC optimized the unused arguments although I use -O0 optimization?

     

     

    I changed the code of RunAllTests() to the following:

     

    volatile int testCount = 0;
    volatile void **pTests = nullptr;


    void RunAllTests()
    {
    for (TestGroup *pGroup = TestGroup::s_pFirstTestGroup; pGroup; pGroup = pGroup->m_pNextGroup)
    for (TestInstance *pTest = pGroup->m_pFirstTest; pTest; pTest = pTest->m_pNextTestInGroup)
    testCount++;

    #ifdef __ICCARM__
    TestInstance **pAllInstances = (TestInstance **)malloc(testCount * sizeof(TestInstance *)); //WARNING: this will cause a one-time memory leak
    #else
    TestInstance **pAllInstances = (TestInstance **)alloca(testCount * sizeof(TestInstance *));
    #endif
    int index = 0;

    for (TestGroup *pGroup = TestGroup::s_pFirstTestGroup; pGroup; pGroup = pGroup->m_pNextGroup)
    for (TestInstance *pTest = pGroup->m_pFirstTest; pTest; pTest = pTest->m_pNextTestInGroup)
    pAllInstances[index++] = pTest;

    #ifdef SIMULATION
    TinyEmbeddedTest::InitializeSimulation(testCount, pAllInstances);
    #endif

    pTests = (volatile void **)pAllInstances;
    SysprogsTestHook_SelectTests(testCount, (void **)pAllInstances);

    TestGroup *pGroup = 0;

    for (index = testCount - 1; index >= 0; index--)
    {

     

     

    Maybe you could change that in your code too?

     

    Yours,

    Elias

     

    elivoe
    Participant

    Hi,

     

    thanks for your reply. For us the workaround with the commented line in the file I specified works for now, so we won’t install a beta on our productive systems. I will try it as soon as the 5.6 version is out of its beta phase.

     

     

    in reply to: Problem with ProfilerRTOS_FreeRTOS.c #30871
    elivoe
    Participant

    Hi,

     

    Thank you for your quick response and the fix!

    in reply to: Problem with ProfilerRTOS_FreeRTOS.c #30859
    elivoe
    Participant

    A possible fix could be something like that:

    #ifndef xQueueSendFromISR
    extern void xQueueGenericSendFromISR();
    extern void xQueueReceiveFromISR();
    #endif // xQueueSendFromISR

    So it detects if the “queue.h” file is included by checking if the xQueueSendFromIsr is defined.

     

    • This reply was modified 2 years, 8 months ago by support. Reason: formatting
    in reply to: Visual Live Watch FreeRTOS static tasks #30357
    elivoe
    Participant

    Hi,

     

    I have tested the build and it works perfectly. Thank you very much for the adaptions!

    • This reply was modified 2 years, 11 months ago by elivoe.
    in reply to: Visual Live Watch FreeRTOS static tasks #30307
    elivoe
    Participant

    Hi,

     

    I am again debugging a FreeRTOS based system with tasks with statically allocated RAM. So I have created a demo project with and tried to get closer to the problem. The demo project runs on a XMC4500 as I don’t have an STM32 in the office to test it. But I think you should be able to just copy the code from the main.cpp and test it with an STM32 project.

    I have summarized what the two problems behave like:

    Problem 1:
    If nothing from the FreeRTOS heap is allocated the system does not recognize that there is FreeRTOS running on the controller. In the live watch windows the FreeRTOS button is not visible.  As soon as there is at least one task with dynamically allocated RAM created or anything else allocated from the FreeRTOS RAM (i.e. via pvPortMalloc(1)), all tasks (cynamically and statically allocated) show up in the live watch  view. The problem could be that the ucHeap field gets removed if there is nothing allocated from the FreeRTOS heap. Are you checking for this field?

    Problem 2:
    If there are two or more tasks with statically allocated RAM created the live watch view in FreeRTOS mode shows strange stack usage value for all tasks except the first created (only talking about the tasks with statically allocated RAM). In this example the live watch shows the following stack usage for the first demo task: 708 bytes remaining which would be fine, but shows 631612121 / 631612829 bytes for demo task 2.

    It is also interesting that the stack usage for task on the heap is formatted in the style 92/400 and the format of the task in the stack is 708 bytes remaining.

     

    See my attached screenshots for further details.

     

    Hope this information and the attached demo project can help you finding the problem.

    Attachments:
    You must be logged in to view attached files.
    elivoe
    Participant

    Hi,

     

    thank you very much for checking it again and fixing it! I will try this build right away.

     

    Of course, if I have the FreeRTOS as a part of the BSP eveything works fine. But I actually do not want that, because it would mean, that the FreeRTOS is not available for the Simulation platform. I currently use the FreeRTOS inside a standalone embedded framework included into the project. With this setting I can also use it during Simulation (with the FreeRTOS Windows port). As the BSP gets built as a seperate embedded library it of course does not find the header files of an other embedded framework in the project during build. Currently my work-around is to add the header files of FreeRTOS to the BSP too, so it can build and the linker finds the references inside the embedded framework of the FreeRTOS anyway. Maybe you have a more elegant way to achieve this?

    elivoe
    Participant

    Hi,

    the problem does not occur during building but if I want to export my bsp as a regular bsp. In the file copying process the error I mentioned appears. Did you try this process if your source files are in sub-directories within the project? I only get the error in the case of having my sources in sub-directories…

     

    An other (and hopefully the last problem) I came across. I use the regular XMC4500_F100x1024 BSP with the Fast Semihosting and Embedded Profiler framework. I am also using FreeRTOS, so I have defined the USE_FREERTOS preprocessor directive. The FreeRTOS is integrated into my custom stand-alone framework, which I have integrated into my project (and referenced at the executable). When I want to build the target I get the “FreeRTOS.h No such file or directory” of the ProfilerRTOS_FreeRTOS.c file. This file is part of the BSP and my FreeRTOS is inside an other framework (I can see the FreeRTOS.h file in my solution explorer, it is correctly added by the EFP.xml). What can I do to let the compiler find this file during building ProfilerRTOS_FreeRTOS.c?

    elivoe
    Participant

    Hi,

     

    thank you for your reply. I managed to fix the problem by using mingw32 or mingw64 instead of mingw. The problem with not finding the main function was gone as I started a new project in a new, clean solution.

    I have now finished setting up my custom BSP. During exporting it to a regular BSP I am facing the following problem:

    Everything works fine if I do not attach sample projects. But if I add at least one sample project, I get the following error during file copying: “Could not find a part of the path ‘D:\…\Custom.XMC4500BSP\samples\TestExecutable\TestExecutable/src/TestExecutable.cpp’. Note that “…” is a placeholder I put there, in the error message there is the full path. What seams a bit suspicious instead is that there are backslashes and forward slashes mixed in the path. The .cpp files are all added to the executable (Add > Existing Item > …). The folder “…\Custom.XMC4500BSP\samples\TestExecutable\” is empty. So neither the sub folder TestExecutable, src or TestExecutable.cpp exist there.

    When I remove the TestExecutable.cpp from the executable there are no errors occurs and the BSP export is successful.

    Is there any problem with having files in sub folders in a project to use it as a sample project?

    Hope you can help me here as well.

    elivoe
    Participant

    Thank you for the information. I will get deeper into that.

     

    Further exploring the features coming with advanced cmake projects I also tried the simulation feature.

    There I came across the following problems:

    Building with the MinGW toolchain I get the compiler error “crtdbg.h: No such file or directory”. This error is gone, if I build with the MinGW32 toolchain. But than I face an other problem: I can successfully build the project but debugging does not work. When I hit “Start debugging”/F5 I get the error “undefined reference to WinMain@16”, so it cannot find my main function. Are you familiar with these problems?

    I have also started a completely new unit test project with advanced cmake (XMC4500 controller), same problems than.

     

    Hope you can help me, I would really like the feature to test software without the need of the controller hardware.

     

     

    elivoe
    Participant

    Hi,

     

    that would be great, if you could integrate this functionality into one of the next releases. In between it would massively help if you could provide us a detailed documentation about the structure of the efp.xml and the framework.cmake files (what are the options? what must be included?). If this information is provided it would be much easier to create stand-alone frameworks manually.

     

    Thanks!

    elivoe
    Participant

    Hi,

     

    thanks for the fast reply. The link you provided does not answer all my questions. I do understand now how to create custom BSPs but I still haven’t found an easy way to create stand-alone frameworks, that than are in the framework library of VisualGDB. I managed to create an own simple framework by creating my own framework.cmake and added the framework to the project with import_framework() (for the controllers I use (Infineon XMC4XXX) there was no framework available that I could make stand-alone and adapt than). But I have not found a way to do that automatically (creating a new stand-alone framework with the framework.cmake). It would be also nice to have the possibility to add the own frameworks in the project settings or in the context menu (right click on the project > Add > New Item > “Framework” or something similar). Is something like that planned for the future?

    in reply to: Dynamic analysis VisualGDB crash #28709
    elivoe
    Participant

    Hi everyone,

     

    I had exactly the same problem with my Infineon XMC4500. After installing the new Version of VisualGDB the error is replaced by a new one:

    VisualGDB version: 5.5.7.3666
    —————— System.Exception ——————
    System.Exception: Could not find the following symbol in <Project>:
    SysprogsRTOSHooks_FreeRTOS_vTaskSwitchContext

    Please ensure that your project references the profiler framework, calls the InitializeInstrumentingProfiler() function and is built with the USE_FREERTOS preprocessor macro.
    at zg1.h(String d, String e, i c, String b, n a, f f)
    at xj..ctor(String c, EmbeddedDynamicAnalysisSettings a, String f, qr g, i h, j d, EmbeddedRTOSProfile b, Dictionary`2 e)
    at vs1.i(Boolean a)
    at vs1.g_2(DebugCustomizationSettings b, Boolean a)
    at o41.p2()
    at x8.e2()
    at VisualGDB.GDBDebugEngine.w1(rz1 a, m1 b)
    trace=[zg1.h:628, xj..ctor:1475, vs1.i:2275, vs1.g_2:24, o41.p2:36, x8.e2:22, VisualGDB.GDBDebugEngine.w1:58]

     

    It would be great if you could help me!

     

    Yours,

    Elias

Viewing 15 posts - 1 through 15 (of 15 total)