DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Understanding Git
  • Keep Your Application Secrets Secret
  • 3 Easy Steps for a (Dev)Containerized Microservice With Jolie and Docker
  • 7 Great Terminal/CLI Tools Not Everyone Knows

Trending

  • Exploring Edge Computing: Delving Into Amazon and Facebook Use Cases
  • A Better Web3 Experience: Account Abstraction From Flow (Part 2)
  • Building AI Applications With Java and Gradle
  • Time Series Analysis: VAR-Model-As-A-Service Using Flask and MinIO
  1. DZone
  2. Coding
  3. Languages
  4. Programming Kinetis With CodeWarrior from the DOS Shell

Programming Kinetis With CodeWarrior from the DOS Shell

Dealing with your Kinetis device from the comfort of the command line.

Erich Styger user avatar by
Erich Styger
·
Sep. 04, 15 · Tutorial
Like (3)
Save
Tweet
Share
2.39K Views

Join the DZone community and get the full member experience.

Join For Free

In “CodeWarrior Flash Programming from a DOS Shell” I showed how to program a device from the DOS shell. Because that example was for ColdFire and CodeWarrior for MCU10.2, here is the same for a Kinetis (FRDM-KL25Z) and CodeWarrior for MCU10.6. In my workspace (c:\tmp\wsp_10.6) I have a project folder (FRDM-KL25Z).

I’m using the ‘Flash Programmer’ to sneak the needed commands:

Sneaking Commands from Flasher

Sneaking Commands from Flasher


I use these commands to build my TCL file (Standalone.tcl) with the launch configuration of my project (FRDM-KL25Z_FLASH_OpenSDA):

############################################################
# Standalone.tcl: a script file to flash my application
############################################################

# in any case, disconnect an existing debug connection
cmdwin::fl::disconnect

# set launch configuration:
cmdwin::fl::target -lc "FRDM-KL25Z_FLASH_OpenSDA"

# set Set the target RAM buffer for downloading image data:
cmdwin::fl::target -b 0x1ffff000 0x4000

# switch off verify and logging:
cmdwin::fl::target -v off -l off

# select flash device, organization and memory range:
cmdwin::fl::device -d "FTFA_PFlash128S1RAM16" -o "32Kx32x1" -a 0x0 0x1ffff

# specify target file, auto detect format, range settings on followed by the flash range, offset settings off
cmdwin::fl::image -f "C:\\tmp\\wsp_10.6\\FRDM-KL25Z\\FLASH\\FRDM-KL25Z.elf" -t "Auto Detect" -re on -r 0x0 0x1ffff -oe off

# now erase the flash...
cmdwin::fl::erase image

# ... followed by writing the application to flash:
cmdwin::fl::write

# disconnect connection
fl::disconnect

# exit Eclipse IDE
quitIDE

I recommend to run the .tcl file wither with the ‘source’ command in the Debugger Shell first (without the quitIDE at the end):

Successful command execution

Successful command execution

Here is the full Debugger Shell log:

CodeWarrior Debugger Shell v1.0
%>source c:\tmp\wsp_10.6\Standalone.tcl
cmdwin::fl::disconnect 
cmdwin::fl::target -lc FRDM-KL25Z_FLASH_OpenSDA 
cmdwin::fl::target -b 0x1ffff000 0x4000 
cmdwin::fl::target -v off -l off 
cmdwin::fl::device -d FTFA_PFlash128S1RAM16 -o 32Kx32x1 -a 0x0 0x1ffff 
cmdwin::fl::image -f C:\tmp\wsp_10.6\FRDM-KL25Z\FLASH\FRDM-KL25Z.elf -t Auto Detect -re on -r 0x0 0x1ffff -oe off 
cmdwin::fl::erase image 
 Beginning Operation ...    
------------------------- 
Auto-detection is successful.   
  File is of type Elf Format.   

Performing target initialization ...    
thread break: Stopped, 0x0, 0x0, cpuARMLittle, Unknown (state, tid, pid, cpu, target) 
thread set: Stopped, 0x0, 0x0, cpuARMLittle, Unknown (state, tid, pid, cpu, target) 
thread break: Stopped, 0x0, 0x0, cpuARMLittle, Unknown (state, tid, pid, cpu, target) 
source c:\\tmp\\wsp_10.6\\Standalone.tcl 
 Downloading Flash Device Driver ...   
Reading flash ID ...   
Erasing Sector 0x00000000 to 0x000003FF   
Erasing Sector 0x00000800 to 0x00000BFF   
Erasing Sector 0x00000C00 to 0x00000FFF   
Erasing Sector 0x00001000 to 0x000013FF   
Erasing Sector 0x00001400 to 0x000017FF   
Erasing Sector 0x00001800 to 0x00001BFF   
Erasing ...   
 Erase Command Succeeded    
cmdwin::fl::write 
 Beginning Operation ...    
------------------------- 
Using restricted address range 0x00000000 to 0x0001FFFF   
Programming file C:\tmp\wsp_10.6\FRDM-KL25Z\FLASH\FRDM-KL25Z.elf   
Auto-detection is successful.   
  File is of type Elf Format.   

 Downloading Flash Device Driver ...   
Reading flash ID ...   
Auto-detection is successful.   
  File is of type Elf Format.   

Downloading 0x000000C0 bytes to be programmed at 0x00000000   
Executing program ....   
 Program Command Succeeded    
Downloading 0x00001364 bytes to be programmed at 0x00000800   
Executing program ....   
 Program Command Succeeded    
cmdwin::fl::disconnect 
thread exit: Stopped, 0x0, 0x0, cpuARMLittle, Unknown (state, tid, pid, cpu, target) 

Finally, I can add/enable the quitIDE at the end of the TCL file to close the IDE at the end. From the DOS shell, I launch it like this:

"c:\Freescale\CW MCU v10.6\eclipse\cwide.exe" -data "c:\tmp\wsp_10.6" -vmargsplus -Dcw.script="c:\tmp\standalone.tcl"

flashing with CodeWarrior from DOS

Flashing with CodeWarrior from DOS

It will take a while to initialize the debugger engine. But above way is a convenient way to automate flashing several boards.

Happy DOSing :-)

shell CodeWarrior

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Understanding Git
  • Keep Your Application Secrets Secret
  • 3 Easy Steps for a (Dev)Containerized Microservice With Jolie and Docker
  • 7 Great Terminal/CLI Tools Not Everyone Knows

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: