[SOLVED] Script file API function to get date and time

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

  • Hi,
    Thank you for your inquiry.

    There is no such function available.
    Could you please tell us what exactly you are trying to do?

    Best regards,
    Fabian
    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.
  • SEGGER - Fabian wrote:

    Could you please tell us what exactly you are trying to do?
    Hello Fabian,

    I would like the manufacturer to write automatically the current time and date in the DATA FLASH (using a script with JLINK_MEM_WriteU8(), etc), right next to the serial number (SN) programmed with JFLASH.

    Regards.

    The post was edited 1 time, last by Hardwariano ().

  • Hi,
    As already mentioned, this will not be possible via a J-Link Scriptfile.

    But you can do this via a J-Flash:
    1. Create a .bin file with the desired timestamp via a script (e.g. .bat or .py).
    2. When opening J-Flash add the command line "-merge<FILENAME>.bin,<ADDR>" (without quotations).

    Example in a production setup:
    JFlash.exe -openprjC:\Projects\Default.jflash -mergeTimeStamp.bin,0x12345678 -auto -exit

    Does this solution work for you?

    Best regards,
    Fabian
    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.
  • SEGGER - Fabian wrote:

    Example in a production setup:
    JFlash.exe -openprjC:\Projects\Default.jflash -mergeTimeStamp.bin,0x12345678 -auto -exit

    Does this solution work for you?
    Thanks for the example Fabian. It works well and does what I want. However, I think it's a bit complicated to send it to production because of the need to use command prompt.
    Wouldn't there be some way to make an automatic merge without using command prompt? If not, would it be added in future versions?

    Regards

    The post was edited 1 time, last by Hardwariano ().

  • Hi,

    Could you elaborate what you mean with "complicated"?
    As mentioned above, you could do this with a script, so your production would only need to click a .bat or .py file.
    Your bat or py script could do the following:
    - Get current date/time
    - Write date/time into a .bin file
    - Call J-Flash with the above command line

    You would only have to set this up once and your solution would be portable and working out of the box.

    Hardwariano wrote:

    If not, would it be added in future versions?
    This is not planned and there are currently no plans to add this feature, since it is very user and device specific.

    Best regards,
    Fabian
    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.
  • SEGGER - Fabian wrote:

    As mentioned above, you could do this with a script, so your production would only need to click a .bat or .py file
    Yes, you are right, using a .bat file is much easier. At first I didn't think of a ".bat" file, but wrote it on the command line.

    SEGGER - Fabian wrote:

    - Get current date/time
    - Write date/time into a .bin file
    - Call J-Flash with the above command line
    This is what I have done and it works. This question is solved.

    Thanks for your help.
    Best regards.
  • Hi,
    Good to hear, that you are up and running again.

    We will consider this thread as closed.

    Best regards,
    Fabian
    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.