从 DOS Shell 使用 CodeWarrior 对 Kinetis 进行编程

一则或许对你有用的小广告

欢迎加入小哈的星球 ,你将获得:专属的项目实战 / Java 学习路线 / 一对一提问 / 学习打卡/ 赠书活动

目前,正在 星球 内带小伙伴们做第一个项目:全栈前后端分离博客项目,采用技术栈 Spring Boot + Mybatis Plus + Vue 3.x + Vite 4手把手,前端 + 后端全栈开发,从 0 到 1 讲解每个功能点开发步骤,1v1 答疑,陪伴式直到项目上线,目前已更新了 204 小节,累计 32w+ 字,讲解图:1416 张,还在持续爆肝中,后续还会上新更多项目,目标是将 Java 领域典型的项目都整上,如秒杀系统、在线商城、IM 即时通讯、权限管理等等,已有 870+ 小伙伴加入,欢迎点击围观

在“ 从 DOS Shell 进行 CodeWarrior Flash 编程 ”中,我展示了如何从 DOS Shell 对设备进行编程。因为该示例适用于 MCU10.2 的 ColdFire 和 CodeWarrior,所以这里同样适用于 Kinetis ( FRDM-KL25Z ) 和适用于 MCU10.6 的 CodeWarrior。在我的工作区 (c:\tmp\wsp_10.6) 中,我有一个项目文件夹 (FRDM-KL25Z)。

我正在使用“Flash Programmer”偷偷需要的命令:

来自 Flasher 的潜行命令


我使用这些命令通过我的项目 (FRDM-KL25Z_FLASH_OpenSDA) 的启动配置来构建我的 TCL 文件 (Standalone.tcl):


 ############################################################
# 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

我建议先在 Debugger Shell 中使用“source”命令运行 .tcl 文件(最后不使用 quitIDE):

命令执行成功

这是完整的调试器 Shell 日志:


 ############################################################
# 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

最后,我可以在 TCL 文件末尾添加/启用 quitIDE 以在末尾关闭 IDE。在 DOS shell 中,我像这样启动它:

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

从 DOS 使用 CodeWarrior 刷机

初始化调试器引擎需要一段时间。但是上面的方法是一种自动刷写多块板的便捷方法。

快乐剂量 :-)