Mass erase when debugging on MCUXpresso

cancel
Showing results for 
Search instead for 
Did you mean: 

Mass erase when debugging on MCUXpresso

1,102 Views
alexstefan
Contributor III

Hi,

I have a Kinetis-based project that I'm developing on the MCU Xpresso IDE. I use LPC Link2 as a debug probe. In the past, I've been using CodeWarrior and that, by default, performed a mass erase of the chip every time I started debugging. Is there any way to achieve a similar behavior on MCU Xpresso?

Thank you!

Alex

Labels (1)
0 Kudos
4 Replies

481 Views
lpcxpresso_supp
NXP Employee
NXP Employee

By default, the kinetisconnect.scp is configured as the connect script for most Kinetis part launch configurations. This script will report if the Kinetis part is secure and requires a mass erase, but will initiate a mass erase. This is intentional. The kinetismasserase.scp script will mass erase, but only if the part is secure. A question posed to you is why you would want to mass erase every time? If you insist, you can modify the kinetismasserase.scp script file to bypass the secure check, and proceed with mass erase. So, for example, in the kinetismasserase.scp script, find and modify line 790 as below:

.

.

790   if s% & 0x00000004 Then Goto 860
800   REM ================================================================
810   Print "Part is not secured"

.

.

to

790   Goto 860
800   REM ================================================================
810   Print "Part is not secured"

Of course, you need to use kinetismasserase.scp as your launch configuration connect script.

Thanks and regards,

MCUXpresso Support

0 Kudos

481 Views
lpcxpresso_supp
NXP Employee
NXP Employee

This can be achieved by the use of a connect script.  Supplied with MCUXPresso IDE in the location <install dir>/IDE/bin/Scripts is a script file called kinetismasserase.scp. If you reference this script file as a connect script within your project launch configuration, then the part will be mass erased on each debug connection (before any other flash programming operation).  Note you would replace the existing kinetisconnect.scp.

A question however, is why you would want to do this. The flash drivers on these parts will perform sector erase operations as required. However a feature of these parts is that a erase is rapid, so there is little time penalty in erasing every time.

The MCUXpresso IDE User Guide section 4.2 An Introduction to Launch Configuration Files may be of assistance.

Yours,

MCUXpresso IDE Support

0 Kudos

481 Views
alexstefan
Contributor III

Hi,

I've tried that before contacting you, but it doesn't seem to work. Attached is the log.

MCUXpresso RedlinkMulti Driver v10.1 (Dec 19 2017 16:58:35 - crt_emu_cm_redlink build 390)
Reconnected to existing redlink server (PID 4294967295)
Connecting to probe 1 core 0 (server PID unknown) gave 'OK'
============= SCRIPT: kinetismasserase.scp =============
Kinetis Mass Erase Script
DpID = 2BA01477
Assert NRESET
Reset pin state: 00
Power up Debug
MDM-AP APID: 0x001C0000
MDM-AP System Reset/Hold Reset/Debug Request
MDM-AP Control: 0x0000001C
MDM-AP Status (Flash Ready) : 0x00000072
Part is not secured
MDM-AP Control: 0x00000014
Release NRESET
Reset pin state: 01
MDM-AP Control (Debug Request): 0x00000004
MDM-AP Status: 0x0001007A
MDM-AP Core Halted
============= END SCRIPT ===============================
Probe Firmware: LPC-LINK2 CMSIS-DAP V5.183 (NXP Semiconductors)
Serial Number: BYGWOVGU
VID:PID: 1FC9:0090
USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#8&24f7e99f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
debug interface type = Cortex-M3/4 (DAP DP ID 2BA01477) over SWD
processor type = Cortex-M4 (CPU ID 410FC240)
number of h/w breakpoints = 6
number of flash patches = 2
number of h/w watchpoints = 4
Probe(0): Connected&Reset. DpID: 2BA01477. CpuID: 410FC240. Info: <None>
Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Content of CoreSight Debug ROM(s):
RBASE E00FF000: CID B105100D PID 04000BB4C4 ROM dev (type 0x1)
ROM 1 E000E000: CID B105E00D PID 04000BB00C ChipIP dev SCS (type 0x0)
ROM 1 E0001000: CID B105E00D PID 04003BB002 ChipIP dev DWT (type 0x0)
ROM 1 E0002000: CID B105E00D PID 04002BB003 ChipIP dev FPB (type 0x0)
ROM 1 E0000000: CID B105E00D PID 04003BB001 ChipIP dev ITM (type 0x0)
ROM 1 E0040000: CID B105900D PID 04000BB9A1 CoreSight dev TPIU type 0x11 Trace Sink - TPIU
ROM 1 E0041000: CID B105900D PID 04000BB925 CoreSight dev ETM type 0x13 Trace Source - core
ROM 1 E0042000: CID B105900D PID 04003BB907 CoreSight dev ETB type 0x21 Trace Sink - ETB
ROM 1 E0043000: CID B105900D PID 04001BB908 CoreSight dev CSTF type 0x12 Trace Link - Trace funnel/router
Inspected v.2 On chip Kinetis Flash memory module FTFE_4K.cfx
Image 'Kinetis SemiGeneric Feb 17 2017 17:24:02'
Opening flash driver FTFE_4K.cfx
Sending VECTRESET to run flash driver
flash variant 'K 66 FTFE Generic 4K' detected (2MB = 512*4K at 0x0)
Closing flash driver FTFE_4K.cfx
NXP: MK66FN2M0xxx18
Connected: was_reset=true. was_stopped=true
MCUXpresso Free License - Downloads unlimited
Awaiting telnet connection to port 3330 ...
GDB nonstop mode enabled
Opening flash driver FTFE_4K.cfx (already resident)
Sending VECTRESET to run flash driver
Writing 8 bytes to address 0x00000000 in Flash
Erased/Wrote page 0-0 with 8 bytes in 50msec
Closing flash driver FTFE_4K.cfx
Flash Write Done
Opening flash driver FTFE_4K.cfx (already resident)
Sending VECTRESET to run flash driver
Writing 86608 bytes to address 0x00000400 in Flash
Erased/Wrote page 0-21 with 86608 bytes in 901msec
Closing flash driver FTFE_4K.cfx
Flash Write Done
Opening flash driver FTFE_4K.cfx (already resident)
Sending VECTRESET to run flash driver
Writing 85660 bytes to address 0x00015650 in Flash
Erased/Wrote page 21-42 with 85660 bytes in 897msec
Closing flash driver FTFE_4K.cfx
Flash Write Done
Flash Program Summary: 172273 bytes in 1.85 seconds (90.99 KB/sec)
Starting execution using system reset and halt target
Stopped: Breakpoint #1

0 Kudos

481 Views
alexstefan
Contributor III

Hi,

Any feedback on this?

0 Kudos