infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3
Results 21 to 30 of 30

Thread: Aurix 2G Free Entry Tool Chain Interrupt on all cores

  1. #21
    Intermediate Intermediate Praktikant is on a distinguished road
    Join Date
    Jun 2018
    Posts
    13
    Points
    280
    Quote Originally Posted by HIGHTEC.henk-piet.glas View Post
    Hi,

    The typedef for spinlock doesn't provide the compiler with sufficient information to know that its state may be changed by threads other than the current one. Therefore variables of type spinlock will be subject to compiler optimisations. For regular variables this is precisely what you want because it will have a positive effect on codesize and speed. For semaphores the story is a different one. Those must be explicitly written to and read from such as you code it. The way to do this is by adding the volatile keyword to your type definition. So rather than using 'typedef int spinlock' you will have to use 'typedef volatile int spinlock'.

    Another advise I want to give you is to drop STM1_Handler() from your lock() function definition. To me it makes no sense to repeatedly call it while waiting to acquire the lock. The lock() function must only be used to acquire the semaphore. Once it is in your possession you become the sole owner of the resource that you're sharing. And only at that point you call the resource. Combining both remarks, this is the preferred approach:

    [CODE] typedef volatile unsigned SEM_t;
    [/FONT]
    Dear Glas,

    Thank you very much for your help.
    I have written my spinlock code like the you suggested and now i am planning to check if i can lock one core from another and result can be seen by blinking LED.

    Do you have any suggestion regarding this ?

    With best regards
    Praktikant

  2. #22
    Intermediate Intermediate HIGHTEC.henk-piet.glas is on a distinguished road
    Join Date
    May 2017
    Posts
    31
    Points
    462.5
    Hi Praktikant,

    Quote Originally Posted by Praktikant View Post
    <snip> Do you have any suggestion regarding this? <snip>
    What you may want to try first is see if you can get the multi-core example running that I created for Jens earlier in this thread. Simply add the code that you want to test to the core0_main, core1_main and core2_main placeholders. Note that the example was developed for the TC297 application kit so you may need to give it a carefull lookover when testing it on your TriBoard TC299.

    Best regards,

    Henk-Piet Glas
    Principal Technical Specialist

    p.s. What is your real name?

  3. #23
    Intermediate Intermediate Praktikant is on a distinguished road
    Join Date
    Jun 2018
    Posts
    13
    Points
    280
    Quote Originally Posted by HIGHTEC.henk-piet.glas View Post
    Hi Praktikant,


    Note that the example was developed for the TC297 application kit so you may need to give it a carefull lookover when testing it on your TriBoard TC299.

    Dear Glas,

    I have used your example that you developed earlier for the TC297 application kit and made some changes for my board. Everything works perfectly now. I have also initialised the locks for 1 core. Now i have to test it with the debugger to check the values.

    Thank you very much for your help.

    With best regards
    Praktikant.

  4. #24
    Beginner Beginner SPM is on a distinguished road
    Join Date
    Jul 2018
    Posts
    2
    Points
    60
    Hello Glas,
    I am pretty new to Microcontrollers in generall.
    Is it posible to change your code that it can be used for an TC397?
    And if it is possible how can I find out what I need to change?

    Thanks and best regards,
    SPM

  5. #25
    Intermediate Intermediate HIGHTEC.henk-piet.glas is on a distinguished road
    Join Date
    May 2017
    Posts
    31
    Points
    462.5
    Hi Felix,

    Quote Originally Posted by SPM View Post
    Is it posible to change your code that it can be used for an TC397? And if it is possible how can I find out what I need to change?
    This is certainly possible. I think it is a matter of replacing the board support package support code with that of your device/board and then you should be good. And you'd have to increase the amount of cores of course. At the moment I'm a bit short for time but I'll try and find a moment to do it.

    Best regards,

    Henk-Piet Glas
    Principal Technical Specialist


  6. #26
    Beginner Beginner SPM is on a distinguished road
    Join Date
    Jul 2018
    Posts
    2
    Points
    60
    Quote Originally Posted by HIGHTEC.henk-piet.glas View Post
    Hi Felix,

    Hi,

    This is certainly possible. I think it is a matter of replacing the board support package support code with that of your device/board and then you should be good. And you'd have to increase the amount of cores of course.


    I have replaced the board support packages and it works.
    Thank you for your reply!

    Best regards,
    SPM

  7. #27
    Intermediate Intermediate Praktikant is on a distinguished road
    Join Date
    Jun 2018
    Posts
    13
    Points
    280
    Hello Glas,

    I want to unlock a process in one core from another core which was locked. The whole process should be in loop. Do you have any suggestions ?

    Best regards
    Prakti

  8. #28
    Intermediate Intermediate HIGHTEC.henk-piet.glas is on a distinguished road
    Join Date
    May 2017
    Posts
    31
    Points
    462.5
    Hi Felix,

    Quote Originally Posted by SPM View Post
    I have replaced the board support packages and it works.
    Thank you for your reply!

    Best regards,
    SPM
    Brilliant to read you got it running. For my part it took a bit longer but you'll find the results attached just in case you want to give that a go as well. Normally I try to include some comments as well but this time I have to keep it short and rely on the fact that most of it explains itself. The project is imported as follows:
    • Select 'File | Import...' MENU
    • Expand the 'General' FOLDER
    • Select 'Existing Projects into Workspace' SOURCE
    • Click 'Next'
    • Click 'Select archive file' RADIOBUTTON
    • Browse to the portable archive and press 'Open'
    • Select the example and finish import
    Prior to building the project you may want to check the following menu:
    • Select 'Window | Preferences' MENU
    • Select 'HighTec Preferences | Linker Description Model'
    And change the checkboxes as follows:
    • Disable 'Update model after each build' CHECKBOX
    • Disable 'Validate model before each build' CHECKBOX
    • Disable 'Generate LDF before each build' CHECKBOX
    • Enable 'Allow user defined ... in project settings' CHECKBOX
    The last one is paramount, because the project uses a user defined description file rather than a generated one.

    Should you have any questions, feel free to ask. There may be some delay in me replying. This week I'll be a bit short for time.

    Best regards,

    Henk-Piet Glas
    Principal Technical Specialist
    ?????

  9. #29
    Intermediate Intermediate Praktikant is on a distinguished road
    Join Date
    Jun 2018
    Posts
    13
    Points
    280
    Quote Originally Posted by HIGHTEC.henk-piet.glas View Post
    Hi,

    [FONT=Courier New]


    SEM_t sem;

    inline void P(SEM_t * const s) {
    while ( __builtin_tricore_cmpswapw(s,1,0) != 0 );
    }

    inline void V(SEM_t * const s) {
    *s = 0;
    }

    /* code snippet demonstrating use
    */

    P(&sem);
    STM1_Handler();
    V(&sem); [/CODE]
    Hi Glas,

    Thank you very much for the code. It really helped a lot.

    With best regards
    Praktikant

  10. #30
    Intermediate Intermediate Praktikant is on a distinguished road
    Join Date
    Jun 2018
    Posts
    13
    Points
    280
    Hi Glas,

    I am facing a problem with scratch pad memory. The spinlock is accessing the scratch pad ram but I dont want to use the Scratch pad ram. Is there any way I can avoid my code from accessing it ?

    With best regards
    Prakti

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.