如题,从官网EVT压缩包中的IAP例程只有跳转到boot的isp下载,不是IAP区的自定义烧录,另外也有看过ch559的IAP例程,是通过跳转至IAP区然后上位机烧录,但个人能力有限,移植至554上使用难度不小,希望大大可以给一份可以在554上用的IAP例程以及上位机例程。
论坛搜了一圈发现有CH552的IAP例程,我去试试移植,有问题再求助大大们!
The problem is the bootloader in the CH554 devices. For loader version >= 2.31 the IAP call does not exist anymore. I just found that call in V1.1.
Actuall devices of CH554 (CH552) are delivered with V2.5.
For CH559 its a bit different: In V2.31 there is still the IAP call suported. I dont know if there are newer versions of the bootloader for CH559 exit. I know of V2.0 and V2.31.
I guess IAP will not work with new versions of the bootloader because of security reasons. Bootloaders with IAP support all have included the keil libfunction _ICALL. More infos on my Gid pages or (in German) here
https://www.mikrocontroller.net/topic/462538?goto=new#6820478
@TECH29 大大,这个例程我这边有一些不太明白的地方:
1、codeflash地址预留0x0000~0x0078是有什么具体作用,我看没有程序烧录到这个地址,ch554这部分是否也有作用?
2、IAP工程地址起始从0x6000开始,APP地址从0x104开始,那么烧录后上电是如何进入APP或者IAP区?我理解上电后复位后boot从0x0000开始执行。
3、IAP工程中,USB初始化中开启了中断,然后主函数中又通过while判断标志轮询中断函数,这是否有必要?
4、IAP工程中的flash擦除流程,从554头文件看没有擦除命令定义,这部分是否就不适用ch554了?
I describe what I have done in the past:
I created a simple USB device just with control EP no other EPs. for flashing I used a vendor request
wIndex= adrress wValue=16 bit flashcontend no datastage. I linked that code to 0x3000 with modified startup.a51 (keil). For crccheck i used a second request wIndex = usr code size wValue = expected CRC.
If for any reason the crc fails I flash LMP 0x3000 + NOP at address 0x0000 so the IAP is reactivated again.
The same LMP 0x3000 + NOP is additionally linked a small asm module to the IAP code
CSEG at 0
LJMP 0x3000
NOP
end
This ensures that after Flashing the IAP code with WCHIspTool IAP starts automatically.
- CH552/554 dont need a erase.
- IAP code can not use any interrupt
- usercode can be at max from 0x0000 to 0x2FFF
@OJZ
1,因为前面有四个字节的跳转信息是一定不能被擦除修改的,而flash是页编程,因此直接跳过前面一页
2, 0地址的跳转信息做到
3,因为IAP中不能出现中断,中断向量表留给APP用
4,554可以直接编程不需要擦