[SOLVED] sample jlink script for SiFive device

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

  • [SOLVED] sample jlink script for SiFive device

    I am trying write jlink script for sifive device.
    Any one has sample script?

    I'm able to read JTAG ID and DTMCS.
    But I'm facing problem with DMI register. it is 66 bits long. how to send 66 bits of data.
    my script

    C Source Code

    1. void Read_JTAGID(void) {
    2. int v;
    3. int BitPos;
    4. JTAG_WriteIR(0x1);
    5. BitPos = JTAG_WriteDR(0x00000000, 32);
    6. v = JTAG_GetU32(BitPos);
    7. MessageBox1("Read_JTAGID value: ", v);
    8. }
    9. void Read_DTMCS(void) {
    10. int BitPos;
    11. int v;
    12. JTAG_WriteIR(0x10);
    13. BitPos = JTAG_WriteDR(0x00000000, 32);
    14. v = JTAG_GetU32(BitPos);
    15. MessageBox1("Read_DTMCS : ", v);
    16. }
    17. void settings(void) {
    18. int Speed;
    19. JTAG_Reset();
    20. JTAG_IRLen = 5;
    21. Speed = JTAG_Speed;
    22. JTAG_Speed = 50;
    23. }
    24. void JTAG_DMI_WRITE(unsigned int addr, unsigned int val) {
    25. int BitPos;
    26. JTAG_WriteIR(0x11);
    27. JLINK_JTAG_StartDR();
    28. JLINK_JTAG_WriteDRCont(2, 2);
    29. BitPos = JLINK_JTAG_WriteDRCont(val, 32);
    30. JLINK_JTAG_WriteDREnd(addr, 32);
    31. MessageBox1("JTAG_DMI_WRITE BitPos ", BitPos);
    32. MessageBox1("JTAG_DMI_WRITE addr : ", addr);
    33. }
    34. unsigned int JTAG_DMI_READ(unsigned int addr) {
    35. int BitPos;
    36. unsigned int val0;
    37. unsigned int val1;
    38. unsigned int val2;
    39. JTAG_WriteIR(0x11);
    40. JLINK_JTAG_StartDR();
    41. BitPos = JLINK_JTAG_WriteDRCont(1, 2);
    42. JLINK_JTAG_WriteDRCont(0, 32);
    43. JLINK_JTAG_WriteDREnd(addr, 32);
    44. val0 = JTAG_GetU32(BitPos);
    45. val1 = JTAG_GetU32(BitPos+32);
    46. val2 = JTAG_GetU32(BitPos+64);
    47. MessageBox1("JTAG_DMI_READ addr ", addr);
    48. MessageBox1("JTAG_DMI_READ BitPos ", BitPos);
    49. MessageBox1("JTAG_DMI_READ val 1 ", val0);
    50. MessageBox1("JTAG_DMI_READ val 2 ", val1);
    51. MessageBox1("JTAG_DMI_READ val 3 ", val2);
    52. return val0;
    53. }
    Display All
  • Hello,

    Thank you for your inquiry.
    Could you contact us via our official support channels in that regard for easier correspondence?
    More information can be found in my signature.

    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.