很多人用K60的时候会出现K60程序无法下载的问题,写此文的目的是让大家能尽量避免K60锁死引起不必要的麻烦。
很多人使用IAR作为开发环境此处也以IAR为例谈:
文章摘自IAR技术报告
Problem
When you create a new project from scratch in Embedded Workbench for ARM version 6.30.3 and older, for a Freescale Kinetis K60Xxxx device, using Target -> Core: "Cortex-M4", or Device -> "Freescale K60Xxxx", the default linker configuration file "generic_cortex.icf" will be selected.
This linker configuration file may cause a permanent device secure (i.e. the device is made impossible to re-program), when you download your code to the board.
In Embedded Workbench for ARM version 6.30.4 and newer, another default linker configuration file (FreescaleMK60xxxx.icf) will automatically be selected, which prevents this issue.
Solution
EWARM 6.30.3 and older:
Use the following linker configuration file for K60Xxxx devices:
$TOOLKIT_DIR$examplesFreescaleK60
TWR-K60GettingStartedconfigK60X_Flash.icf
EWARM 6.30.4 and newer:
Use the default linker configuration file (automatically selected) located in:
$TOOLKIT_DIR$configlinkerFreescale
Background
The default linker configuration file for ARM Cortex in IAR Embedded Workbench IDE (version 6.30.3 and older) places code starting at location 0. The problem is that once the code grows to encompass address 0x40C, the NVFSEC register will be programmed.
There are two bits in the NVFSEC register that can permanently disable the mass erase functionality on the chip. These bits are called Mass Erase Enable Bits (MEEN). In this same register there are also two bits that controls the Flash security (SEC). When used in conjunction, they can permanently lock the device.
Note that when selecting Options -> Target -> Device: Freescale K60Xxxx in EWARM version 6.30.3 and older, the option Linker -> Config -> "Linker configuration file" is set to "generic_cortex.icf" by default.
To change the settings, see the attached pictures on the right hand side of this page.
Note 1:
All example projects included in the IAR K60N512 kit overrides the default linker configuration file with either "K60X_ram.icf" or "K60X_Flash.icf", and the device lock problem does not occur.
Note 2:
The example projects provided with Freescale MQX includes a vector table in "vector.c" that is extended to cover the flash config area and sets the proper values.
Note 3:
If the device has been locked with the Flash security bits only, you can unlock the device using the J-Link Commander (jlink.exe) command:
J-Link> unlock Kinetis
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>