[SOLVED] [JLinkScript] Error using division "/" operator inside script

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

  • [SOLVED] [JLinkScript] Error using division "/" operator inside script

    Hello,

    I can not use simple division inside the script though documentation say it is supported.
    Im using version v6.72b.

    What am I doing wrong?


    Script:


    C Source Code

    1. U32 test;
    2. // end variable definitions
    3. test=10/5;

    JLinkGDBServer output:

    Source Code

    1. ERROR: Error while evaluating J-Link script file: Error while compiling. Line 334, column 14:
    2. test=10/5;
    3. ^
    4. Internal error: Compiling "/" operator. Unsupported operand type combination.
    5. Failed prepare script file
  • Hello,

    Thank you for your inquiry.
    / is and was never supported in JLinkScript files.
    Could you point me to the documentation you are referencing? It should be corrected.

    To do divisions in the JLinkScript you would need to work with the >> operator.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    Yes that documentation is not correct and will be fixed.
    Sorry for the confusion.

    godmode wrote:

    Operator >> does only 2^n divisions/multiplications.
    On the surface yes, you can still write helper functions that do any kind of division with >>.
    Every CPU is in its core binary and can still do any division with only >>, right? ;)

    For examples see stackoverflow or similar resources.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.