打印
[Cortex-M0技术交流]

请问没有isp,iap的话如何下载程序?

[复制链接]
3592|8
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
kiya_21|  楼主 | 2011-8-11 17:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
kiya_21|  楼主 | 2011-8-11 17:47 | 只看该作者
我上面说的swd+iap是指keil mdk里的flash programming algorithm,里面针对cortex的flash的编程算法大都是用IAP协议的。

。。。。
哦,刚仔细观察了下mdk,貌似也可以直接写操纵flash register的flash programming algorithm。
直接改写FlashPrg.c里的Init, UnInit, EraseSector, and ProgramPage

使用特权

评论回复
板凳
X-Hawk| | 2011-8-11 17:47 | 只看该作者
放一个程序到RAM里,让他自己运行并写flash,和IAP比较像。

使用特权

评论回复
地板
kiya_21|  楼主 | 2011-8-11 17:48 | 只看该作者
Creating New Algorithms
µVision allows creating Flash programming algorithms for unsupported devices. The algorithm source code is implemented as a µVision project with special compiler and linker settings.

Follow these steps to create a new Flash programming algorithm:

Create a sub-folder in \KEIL\ARM\FLASH.
Copy the content from \KEIL\ARM\FLASH\_Template to this new folder.
Rename the project file NewDevice.uvproj to represent the new Flash ROM device name, for example 29F400.uvproj.
Open the project with µVision. From the toolbar, use the drop-down Select Target to define the processor architecture:
Cortex-M fits for Cortex-M0, M1, M3, and M4 processor-based devices.
ARM7/ARM9 fits for ARM7 and ARM9 processor-based devices.
The configuration assumes a little-endian microcontroller. In case of a big-endian microcontroller, select the correct processor core with Project - Options for Target - Device.

Open the dialog Project - Options for Target - Output and change the content of the field Name of Executable to represent the device, for example 29F400.
Adapt the programming algorithms in the file FlashPrg.c (see below).
Adapt the device parameters in the file FlashDev.c (see below).
Use Project - Build Target to generate the new Flash programming algorithm. The output file, *.FLX - for ARM7/ARM9 devices, or *.FLM - for Cortex-M devices, is copied to the folder \KEIL\ARM\FLASH and is now available in the dialog Add Flash Programming Algorithm.
Note

Flash programming algorithms use Read-Only Position Independent and Read-Write Position Independent program code. These options are set in the dialogs Project - Options for Target - C/C++ and Project - Options for Target - Asm.
The dialog Project - Options for Target - Linker defines the linker scatter file Target.lin. The error L6305 is disabled with --diag_suppress L6305.
FlashPrg.c
The file FlashPrg.c contains the mandatory Flash Algorithm Functions Init, UnInit, EraseSector, and ProgramPage. Optionally, and in dependency of the device features, or to speed-up execution, the functions EraseChip, BlankCheck, and Verify can be implemented.

FlashDev.c
The file FlashDev.c contains parameter definitions for:

the mandatory Flash Programming Functions Init, UnInit, EraseSector, and ProgramPage. Depending on the device, the optional Flash Programming Functions EraseChip, BlankCheck, and Verify might need programming.
the FlashDevice structure.
struct FlashDevice const FlashDevice  =  {
   FLASH_DRV_VERS,                   // Driver Version, do not modify!
   "STM32Fxxx High-density Flash",   // Device Name (512kB/384kB/256kB)
   ONCHIP,                           // Device Type
   0x08000000,                       // Device Start Address
   0x00080000,                       // Device Size in Bytes (512kB)
   1024,                             // Programming Page Size
   0,                                // Reserved, must be 0
   0xFF,                             // Initial Content of Erased Memory
   100,                              // Program Page Timeout 100 mSec
   500,                              // Erase Sector Timeout 500 mSec

                                     // Specify Size and Address of Sectors
   0x0800, 0x000000,                 // Sector Size 2kB (256 Sectors)
   SECTOR_END
};
Testing Algorithms
The \KEIL\ARM\FLASH\_Template\Test\ folder contains a project that shows how to test a new Flash Programming Algorithm on behalf of an STM32 device.

使用特权

评论回复
5
X-Hawk| | 2011-8-11 18:32 | 只看该作者
我上面说的swd+iap是指keil mdk里的flash programming algorithm,里面针对cortex的flash的编程算法大都是用IAP协议的。

。。。。
哦,刚仔细观察了下mdk,貌似也可以直接写操纵flash register的flash programming  ...
kiya_21 发表于 2011-8-11 17:47


可以的,但是一般这么做,会很慢很慢。。

使用特权

评论回复
6
kiya_21|  楼主 | 2011-8-12 14:33 | 只看该作者
可以的,但是一般这么做,会很慢很慢。。
X-Hawk 发表于 2011-8-11 18:32

您说哪种方法很慢?

使用特权

评论回复
7
smithlin| | 2011-10-25 22:09 | 只看该作者
请问编译成功了吗? 我尝试编译了下,无法用JLINK下载下去。

使用特权

评论回复
8
forrest320| | 2012-2-16 21:10 | 只看该作者
编译应该没有问题。但是下载能不能成功就不知道了,反正我没有成功。LZ,你这样做成功了不?

使用特权

评论回复
9
kiya_21|  楼主 | 2012-6-18 15:50 | 只看该作者
8# forrest320
可以的。不好意思,这么久了才回帖。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

64

帖子

5

粉丝