GDB Cortex-M CONTROL / BASEPRI register mapping wrong endianesses

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

  • GDB Cortex-M CONTROL / BASEPRI register mapping wrong endianesses

    Hi,

    The CONTROL register (and BASEPRI) are mapped in the new GDB server as int types (4 bytes). I thought first that this was not right and that it should be 1 byte.
    But it seems that it is 4 bytes (with a lot of reservations in it) but the endianesses of these registers are wrong.

    The CONTROL is swapped over 4 bytes and the BasePri has an correct word swap but the word it self is wrong ?( ?( . See output below.

    output snippet:

    Source Code

    1. ,.{number="94",value="0x2800"}...,{number="96",value="0x2000000"}


    The BasePri gives 0x2800 back, should be 0x28.
    The CONTROL gives 0x2000000, should be 0x2.

    Regards

    The post was edited 3 times, last by EmBlocks ().

  • Hi,

    We fixed this in the current beta.
    The value of the registers is now in the lowest byte, instead of the highest.
    So in your example a read should return BasePri = 0x26 and CONTROL = 0x2.


    Best regards
    Johannes
    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, thanks!

    For those using EmBlocks (Beta 2.0 or 2.1) and are using the Beta Jlink with the correct Control and Basepri mappings, they need to change the script file for Arm registers (just plain text file).

    In the directory share\EmBlocks\debuggers the file arm-gdb-reg.script

    Remove the following lines:

    search in the function parse_ctrl for the line:
    // Correct the endianesses of Segger J-link
    value = (value >>24)&0xFF;


    search in the function set_ctrl for the line:
    // Correct the endianesses of Segger J-link
    regval = regval << 24;


    search in the function parse_bpri for the line:
    // Correct the endianesses of Segger J-link
    value = (value >>8 )&0xFF;

    search in the function set_bpri for the line:
    // Correct the endianesses of Segger J-link
    regval = regval << 8;

    The debugger register window will now show these registers like before (in the old jlink versions)
    Images
    • reg_jlink.PNG

      19.18 kB, 328×577, viewed 776 times

    The post was edited 2 times, last by EmBlocks ().