PDA

View Full Version : memtool - jlink batch file



frankmag
Nov 7th, 2013, 06:46 AM
Hi,
Does anyone have a simple batch file to use with Memtool in order to execute from command line?
I need to Erase - program - verify an xmc4500 without opening the graphical interface. I see that I have to use a batch file but I don't find info about its configuration ( ie whats the command syntax for loading the hex file, start download ...).
As I need a command line tool I tried also jlink. Everything works fine but first of all you have to open the jlink console, than from there you can send single commands.
Is there anyway of doing all in one step?

Thanks
Frank

Travis
Nov 10th, 2013, 07:03 PM
Hi frank,

Please see my reply below in red.


Hi,
Does anyone have a simple batch file to use with Memtool in order to execute from command line?
Travis: Sorry there is no batch file to work with Memtool.

I need to Erase - program - verify an xmc4500 without opening the graphical interface. I see that I have to use a batch file but I don't find info about its configuration ( ie whats the command syntax for loading the hex file, start download ...).
Travis: I really don't understand what you are trying to do, these feature are already provided in the memtool and why do you need a batch file for?

As I need a command line tool I tried also jlink. Everything works fine but first of all you have to open the jlink console, than from there you can send single commands.
Is there anyway of doing all in one step?

Thanks
Frank

frankmag
Nov 11th, 2013, 12:22 AM
My goal is to call a single file from command line (ie Download.bat ) and have the micro programmed without any other manual insertion into a GUI.
If I call Memtool from command as follow:
memtool command.mtb
and inside command.mtb I put the commnd connect then memtool opens and automatically connct to the target.
What are the ather commands that I have to insert into command.mtb in order to load the hex file, start the program session and then close memtool?

Thanks

Aaron Walsh
Jan 14th, 2014, 08:52 AM
Hi Travis,

I have a similar requirement for the following reasons....

1) I need the end user to be able to perform the re-programming
2) The end user is not an electronics or software engineer and so the process has to be simple
3) The end user does not speak English and will not be able to operate the Memtool dialogs

I need the end user to simply run a command file. I imagine this would do the following....

a) Launch Memtool (possibly minimised)
b) Pass the batch commands to Memtool or point to another file containing the batch commands

Could you please advise if this or something similar is possible please.

Thank you very much
Aaron

Mike
Jan 27th, 2014, 05:17 AM
The professional version of Memtool which is available from PLS (www.pls-mc.com) supports scripting.

Aaron Walsh
Jan 27th, 2014, 05:39 AM
Thanks Mike, I will have a look at the professional version of Memtool.

I have received the Memtool batch command application note (see attached). It meets some of the requirements. So far I have not found a way to launch it silently and execute batch files so the end user doesn't have to speak English.

505

Best regards
Aaron

Marillion
Jan 27th, 2014, 08:46 AM
Here is the solution for JLINK. It works for all XMC kits with on-board dedugger (JLINK):

1. Make sure "JLink.exe" and "JLinkARM.dll" is located in the same folder as the batch-file (see next step).

2. Create a batch-file (e.g. program.bat) with following content:
JLink.exe -CommanderScript testscript.jlink

3. Create the JLINK script file (name "testscript.jlink" with the required commands e.g.:
device XMC1100-T038F0064
loadbin testprogram_v1_0.bin,0x10001000
r
exit


This example is programing a binary file (testprogram_v1_0.bin) into the XMC1100. You get the binary file from DAVE, if you switch the "Output file format" to "binary" (Project>>Active Project Properties>>ARM-GCC Create Flash Image/Output)

This works fine. I used this method several thousand times.

Best Regards
Marillion

Aaron Walsh
Jan 28th, 2014, 12:03 AM
Hi Marillion,

Thank you very much for your fast reply. I will try this method on the next production batch of pcb's.

Best regards
Aaron

chrisbaggott
Nov 28th, 2014, 07:23 AM
Hia, I have recently used the IMTMemtool.exe, via the command line interface, with a batch file to automate the reprogramming of a Tricore. Is there ant way to just erase the microprocessor as "erase" does not seem to be a valid batch command like "program" & "connect" are. Does anyone know if this is possible?

Thanks

Anoop
Jul 10th, 2015, 03:16 AM
Does any one know if "Segger Jlink" dll's and executable is free to distribute or licensed one?

tys
Jul 12th, 2015, 08:38 AM
Hi, Anoop,
Segger Jlink DLL is not free to distribute.

Cheers
tys

christopheroj
Mar 13th, 2017, 01:28 AM
Thanks Mike, I will have a look at the professional version of Memtool.

I have received the Memtool batch command application note (see attached). It meets some of the requirements. So far I have not found a way to launch it silently and execute batch files so the end user doesn't have to speak English.

505

Best regards
Aaron
Example Batch File
The following example batch file connects the target system. Than it loads a starter software
(starter.hex), a firmware and a device specific serial number. The firmware is loaded twice. The second
time it is loaded using an offset of 0x40000. So the firmware image is programmed twice into the
FLASH memory device. Please note that after each open_file operation the loaded sections have to be
added to the FLASH Buffers before the next open_file operation can take place. Finally all loaded
sections are programmed into the FLASH memory device.
connect
open_file c:\Data\starter.hex
select_all_sections
add_selected_sections
open_file c:\Data\firmware.hex
select_all_sections
add_selected_sections
open_file c:\Data\firmware.hex , +40000h
select_all_sections
add_selected_sections
open_file c:\Data\sernum.hex
select_all_sections
add_selected_sections
program
disconnect

cinderblock
Jun 6th, 2017, 04:10 PM
I was able to follow the instructions specified in the PDF that Aaron posted and get completely cli based opening, running, programming with, and closing of Infineon Memtool.

Create a file with the following contents:



connect
open_file C:\Must\Use\Full\Path\To\Hex\File.hex
select_all_sections
add_selected_sections
program
disconnect
exit


I experimentally found that the `exit` command is run by the batch script and can be used to close Memtool after the programming.

Memtool suggests using the `.mtb` file extension for this file but I've found that any extension works. As frankmag suggested, simply launch Memtool.exe with the filename of the "batch" file as the only argument and it will run those commands.

A couple caveats:
- You need to have Memtool previously configured for the correct processor / communication & bootloader method
- You must use an absolute path to the .hex files loaded for programming
- Memtool window still launches (not silent)

I'd love any thoughts on how to clean up these annoyances.

EDIT: Recent Explorations

I've been looking into how to use a script to automatically pick the correct target for memtool. So far, I've found two interesting things:

First, the folder in "My Documents", "Infineon/IMT 4.7". That folder's ini file can be updated to point to a new "target.cfg" to load automatically. It seems, if that folder doesn't exists, the tool does not re-create it. Maybe it was created by the installer?

Second, the registry keys found at "HKCU\SOFTWARE\Infineon\Memtool4\4.7\TargInfo" are used in the GUI to show target options.

jferreira
Jun 7th, 2017, 05:01 AM
Hi,

You can also use JLink commander if you are using a Segger probe or an on-board debugger of our development kits:

C:\Program Files (x86)\SEGGER\JLink_V616a\JLink.exe -Device XMC4700-2048 -CommandFile CommandFile.jlink

and CommandFile.jlink file:


si 1
speed auto
r
h
loadfile .\Debug\POSIF_QD_XMC47.hex, 0x0c000000
r
q