MCU-Link probe, firmware flashing via Command line

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCU-Link probe, firmware flashing via Command line

Jump to solution
6,415 Views
shai_b
Senior Contributor II

Dear Team,

My customer is looking for a way to flash Kinetis MCU with MCU-Link probe using a command line but he does not want to install our mcuxpresso ide on his machine (PC) in order to flash his image (.bin file).

could you please advise if there is another method to flash (.bin/.hex) into NXP MCU (via command line method) without the need to install mcuxpresso ide?

Waiting for your kind feedback, Many thanks.

Shai

Tags (1)
0 Kudos
Reply
1 Solution
4,337 Views
brendonslade
NXP TechSupport
NXP TechSupport

You could use the OpenOCD version,  but this is not an officially supported NXP code base, and will disable several features (like power measurement, SWO profiling, etc.) if you use it. We introduced a new tool called LinkServer (https://nxp.com/linkserver) in March this year, and this enables you to program a target from the command line. It works with MCU-Link, LPC-Link, LPC-Link2, LPC11U35 based and NXP delivered OpenSDA implementations.

 

Also see this article about it: https://mcuoneclipse.com/2023/05/14/linkserver-for-microcontrollers/

 

View solution in original post

0 Kudos
Reply
9 Replies
4,338 Views
brendonslade
NXP TechSupport
NXP TechSupport

You could use the OpenOCD version,  but this is not an officially supported NXP code base, and will disable several features (like power measurement, SWO profiling, etc.) if you use it. We introduced a new tool called LinkServer (https://nxp.com/linkserver) in March this year, and this enables you to program a target from the command line. It works with MCU-Link, LPC-Link, LPC-Link2, LPC11U35 based and NXP delivered OpenSDA implementations.

 

Also see this article about it: https://mcuoneclipse.com/2023/05/14/linkserver-for-microcontrollers/

 

0 Kudos
Reply
6,375 Views
KalaimaniArumugamdev
Contributor III

Hi @shai_b 

   In user manual NXP mentioned that "MCU-Link’s VCOM feature can be used with serial terminal emulation programs such as PuTTY and TeraTerm."

  • Download any one the above serial terminals
  • Connect your port and set configuration as baud rate as "1152000", bit as 8 and no parity bit.
  • Press Refresh button.
  • After setup is completed, send file(Tera term) to send target file.It will show the file download status on the terminal window.

 

0 Kudos
Reply
6,381 Views
jh0
Contributor IV

I am using OpenOCD for this. No installation, small and simple PC side (only one file if I remember right) executed on CLI of any OS. MCU-Link master with KL27 and K32L2 targets.

6,400 Views
shai_b
Senior Contributor II

Hi @ErichStyger,

Thank you so much for your details answer, I got over it but did not understand how to do flash only .bin/.hex file (not .elf for debug).

I need some simple instructions for how to program/flash the MKV31 by using lite tool (we don't want that end customer support engineer will need to Install the MCUexpresso just updating the MCU on the field).

We sent to the field the MCU-LINK and looking for a simpler solution.

Waiting for your kind feedback, Thanks a lot.

KR,

Shai

0 Kudos
Reply
6,372 Views
jh0
Contributor IV

MCU-Link (non Pro version) with OpenOCD...

D:\>OpenOCD\bin\openocd -c "adapter driver cmsis-dap" -f "target\klx.cfg" -c "program fb.hex verify reset exit"

Open On-Chip Debugger 0.11.0 (2021-10-16) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : add flash_bank kinetis klx.pflash
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: FW Version = 1.10
Info : CMSIS-DAP: Serial# = XXXXXXXXXX
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : klx.cpu: hardware has 2 breakpoints, 2 watchpoints
Info : starting gdb server for klx.cpu on 3333
Info : Listening on port 3333 for gdb connections
Error: DP initialisation failed
Info : SWD DPIDR 0x2ba01477
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x00004096 msp: 0x1fff8400
Info : SWD DPIDR 0x2ba01477
Error: Failed to read memory at 0x40048024
Info : Kinetis K32L2A31 detected: 2 flash blocks
Info : 2 PFlash banks: 256k total
Info : Disabling Kinetis watchdog (initial WDOG_CS 0x00002180)
** Programming Started **
Info : Padding image section 0 at 0x00000008 with 1016 bytes
Info : Flash write discontinued at 0x00000410, next section at 0x00001000
Warn : MAXADDR1 0x20 check failed, please report to OpenOCD mailing list
Info : This device supports Program Longword execution only.
Info : FOPT requested in the programmed file differs from current setting, set 'kinetis fopt 0x3d'.
Info : Trying to re-program FCF.
Info : This device supports Program Longword execution only.
Info : This device supports Program Longword execution only.
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
Error: DP initialisation failed
shutdown command invoked

6,326 Views
shai_b
Senior Contributor II

@jh0 ,

Thanks for your input, I will give OpenOCD a try.

it looks like the most suitable solutions.

@ErichStyger,  The customer actually uses a PC to update his MCU but he needs a script style method, and using such as PEMicro Device is out of the picture at this point.

Anyway, thanks a lot to both of you for your effort and support.

Kind regards,

Shai

0 Kudos
Reply
6,303 Views
shai_b
Senior Contributor II

Dear @jh0,

Thank you so much it works perfectly for my needs.

Kind regards,

Shai

0 Kudos
Reply
6,397 Views
ErichStyger
Specialist I

Hi @shai_b ,

what we use for this in the field is a flasher (see https://mcuoneclipse.com/2016/04/02/flashing-many-arm-boards-without-a-host-pc/ the binary (e.g. intel hex) gets loaded on it, then all what you need is a USB power bank to power it and to press a button to flash the binary on the target board. No PC or whatever is needed. PEMICRO has a similar solution with their Cyclone programmers.

 

I hope this helps,

Erich

6,411 Views
ErichStyger
Specialist I

Hi @shai_b ,

You simply could use a MCU-Link Pro (https://mcuoneclipse.com/2021/10/17/new-mcu-link-pro-debug-probe-with-energy-measurement/ ), program it with the J-Link firmware and use the J-Link tools in command line mode or without any IDE (see https://mcuoneclipse.com/2015/03/25/command-line-programming-and-debugging-with-gdb/ ). This is what I would recommend.

If you want to use the McuLink (non-Pro): it uses a LinkServer which (at least as of today) does not support a gdb server. But with some tweaking (see https://community.nxp.com/t5/MCUXpresso-General/Use-mcuxpresso-linkserver-debug-via-command-line/td-... ) you should be able to use it that way too.

I hope this helps,

Erich