Cart Contact NSDSP Home

nsdsp_session_program_for_debug

This function programs the target device for debug

Syntax

int nsdsp_session_program_for_debug(
        nsdsp_session_t   session,
        hex_map_t         hex_map,
        int               tcy
);

Parameters

session - a reference to the Session Object

hex_map - a Hex Map object containing data to be programmed on the device

tcy - instruction cycle period in ns

Return

The function returns non-zero if programming succeeds, or zero otherwise. If programming fails, you can use nsdsp_get_error to retrieve the error message.

Notes

After programming, the type of the session changes to debug (or idle in case of failure). The session can then be used for debugging.

Example

  hex_map_t hm;
  mcu_t mcu;
  nsdsp_session_t sess;
  nsdsp_t nsdsp;
  int tcy;

  hm = hex_map_read("your_hex_file.hex",NULL);
  nsdsp = nsdsp_connect(NULL);
  sess = nsdsp_start_prog_session(nsdsp, mcu, 0);
  nsdsp_session_check_id(sess,1);
  if (nsdsp_session_program_for_debug(sess, hm, tcy)) {

    // The type of the session has changed to debug

    if (nsdsp_debug_wait_for_halt(sess)) {
      printf("Halted at %08x\n",nsdsp_debug_get_pc(sess));

      // Debug here

    }
  }
  nsdsp_end_session(nsdsp);
  nsdsp_free(nsdsp);

 

Supported session types: program

Minimum library version - 163

Northern Software Home NSDSP Contact Us Purchase/View Cart

© 2007-2025 Northern Software Inc. All Rights Reserved.