⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm8s_flash.ls

📁 STM8全部资料
💻 LS
📖 第 1 页 / 共 3 页
字号:
   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.8.32.1 - 30 Mar 2010
   3                     ; Generator V4.3.4 - 23 Mar 2010
  75                     ; 63 void FLASH_Unlock(FLASH_MemType_TypeDef MemType)
  75                     ; 64 {
  77                     	switch	.text
  78  0000               _FLASH_Unlock:
  82                     ; 66     assert_param(IS_MEMORY_TYPE_OK(MemType));
  84                     ; 69     if (MemType == FLASH_MEMTYPE_PROG)
  86  0000 4d            	tnz	a
  87  0001 260a          	jrne	L73
  88                     ; 71         FLASH->PUKR = FLASH_RASS_KEY1;
  90  0003 35565062      	mov	20578,#86
  91                     ; 72         FLASH->PUKR = FLASH_RASS_KEY2;
  93  0007 35ae5062      	mov	20578,#174
  95  000b 2008          	jra	L14
  96  000d               L73:
  97                     ; 78         FLASH->DUKR = FLASH_RASS_KEY2; /* Warning: keys are reversed on data memory !!! */
  99  000d 35ae5064      	mov	20580,#174
 100                     ; 79         FLASH->DUKR = FLASH_RASS_KEY1;
 102  0011 35565064      	mov	20580,#86
 103  0015               L14:
 104                     ; 82 }
 107  0015 81            	ret
 142                     ; 98 void FLASH_Lock(FLASH_MemType_TypeDef MemType)
 142                     ; 99 {
 143                     	switch	.text
 144  0016               _FLASH_Lock:
 148                     ; 101     assert_param(IS_MEMORY_TYPE_OK(MemType));
 150                     ; 104     if (MemType == FLASH_MEMTYPE_PROG)
 152  0016 4d            	tnz	a
 153  0017 2606          	jrne	L16
 154                     ; 106         FLASH->IAPSR = (u8)(~FLASH_IAPSR_PUL);
 156  0019 35fd505f      	mov	20575,#253
 158  001d 2004          	jra	L36
 159  001f               L16:
 160                     ; 112         FLASH->IAPSR = (u8)(~FLASH_IAPSR_DUL);
 162  001f 35f7505f      	mov	20575,#247
 163  0023               L36:
 164                     ; 114 }
 167  0023 81            	ret
 199                     ; 130 void FLASH_DeInit(void)
 199                     ; 131 {
 200                     	switch	.text
 201  0024               _FLASH_DeInit:
 203  0024 88            	push	a
 204       00000001      OFST:	set	1
 207                     ; 132     u8 temp = 0;
 209                     ; 133     FLASH->CR1 = FLASH_CR1_RESET_VALUE;
 211  0025 725f505a      	clr	20570
 212                     ; 134     FLASH->CR2 = FLASH_CR2_RESET_VALUE;
 214  0029 725f505b      	clr	20571
 215                     ; 135     FLASH->NCR2 = FLASH_NCR2_RESET_VALUE;
 217  002d 35ff505c      	mov	20572,#255
 218                     ; 136     FLASH->IAPSR &= (u8)(~FLASH_IAPSR_DUL);
 220  0031 7217505f      	bres	20575,#3
 221                     ; 137     FLASH->IAPSR &= (u8)(~FLASH_IAPSR_PUL);
 223  0035 7213505f      	bres	20575,#1
 224                     ; 138     temp = FLASH->IAPSR; /* Reading of this register causes the clearing of status flags */
 226  0039 c6505f        	ld	a,20575
 227                     ; 139 }
 230  003c 84            	pop	a
 231  003d 81            	ret
 286                     ; 154 void FLASH_ITConfig(FunctionalState NewState)
 286                     ; 155 {
 287                     	switch	.text
 288  003e               _FLASH_ITConfig:
 292                     ; 156     if (NewState != DISABLE)
 294  003e 4d            	tnz	a
 295  003f 2706          	jreq	L721
 296                     ; 158         FLASH->CR1 |= FLASH_CR1_IE; /* Enables the interrupt sources */
 298  0041 7212505a      	bset	20570,#1
 300  0045 2004          	jra	L131
 301  0047               L721:
 302                     ; 162         FLASH->CR1 &= (u8)(~FLASH_CR1_IE); /* Disables the interrupt sources */
 304  0047 7213505a      	bres	20570,#1
 305  004b               L131:
 306                     ; 164 }
 309  004b 81            	ret
 358                     ; 184 void FLASH_EraseBlock(u16 BlockNum, FLASH_MemType_TypeDef MemType)
 358                     ; 185 {
 359                     	switch	.text
 360  004c               _FLASH_EraseBlock:
 362  004c 89            	pushw	x
 363  004d 5204          	subw	sp,#4
 364       00000004      OFST:	set	4
 367                     ; 186     u32 StartAddress = 0;
 369                     ; 189     assert_param(IS_MEMORY_TYPE_OK(MemType));
 371                     ; 190     if (MemType == FLASH_MEMTYPE_PROG)
 373  004f 0d09          	tnz	(OFST+5,sp)
 374  0051 260c          	jrne	L551
 375                     ; 192         assert_param(IS_FLASH_PROG_BLOCK_NUMBER_OK(BlockNum));
 377                     ; 193         StartAddress = FLASH_PROG_START_PHYSICAL_ADDRESS;
 379  0053 ae8000        	ldw	x,#32768
 380  0056 1f03          	ldw	(OFST-1,sp),x
 381  0058 ae0000        	ldw	x,#0
 382  005b 1f01          	ldw	(OFST-3,sp),x
 384  005d 200a          	jra	L751
 385  005f               L551:
 386                     ; 197         assert_param(IS_FLASH_DATA_BLOCK_NUMBER_OK(BlockNum));
 388                     ; 198         StartAddress = FLASH_DATA_START_PHYSICAL_ADDRESS;
 390  005f ae4000        	ldw	x,#16384
 391  0062 1f03          	ldw	(OFST-1,sp),x
 392  0064 ae0000        	ldw	x,#0
 393  0067 1f01          	ldw	(OFST-3,sp),x
 394  0069               L751:
 395                     ; 202     StartAddress = StartAddress + ((u32)BlockNum * FLASH_BLOCK_SIZE);
 397  0069 1e05          	ldw	x,(OFST+1,sp)
 398  006b a680          	ld	a,#128
 399  006d cd0000        	call	c_cmulx
 401  0070 96            	ldw	x,sp
 402  0071 1c0001        	addw	x,#OFST-3
 403  0074 cd0000        	call	c_lgadd
 405                     ; 205     FLASH->CR2 |= FLASH_CR2_ERASE;
 407  0077 721a505b      	bset	20571,#5
 408                     ; 206     FLASH->NCR2 &= (u8)(~FLASH_NCR2_NERASE);
 410  007b 721b505c      	bres	20572,#5
 411                     ; 209     *((@far u8*) StartAddress) = FLASH_CLEAR_BYTE;
 413  007f 7b02          	ld	a,(OFST-2,sp)
 414  0081 b700          	ld	c_x,a
 415  0083 1e03          	ldw	x,(OFST-1,sp)
 416  0085 bf01          	ldw	c_x+1,x
 417  0087 4f            	clr	a
 418  0088 92bd0000      	ldf	[c_x.e],a
 419                     ; 210     *((@far u8*) StartAddress + 1) = FLASH_CLEAR_BYTE;
 422  008c 7b02          	ld	a,(OFST-2,sp)
 423  008e b700          	ld	c_x,a
 424  0090 1e03          	ldw	x,(OFST-1,sp)
 425  0092 90ae0001      	ldw	y,#1
 426  0096 bf01          	ldw	c_x+1,x
 427  0098 93            	ldw	x,y
 428  0099 4f            	clr	a
 429  009a 92a70000      	ldf	([c_x.e],x),a
 430                     ; 211     *((@far u8*) StartAddress + 2) = FLASH_CLEAR_BYTE;
 433  009e 7b02          	ld	a,(OFST-2,sp)
 434  00a0 b700          	ld	c_x,a
 435  00a2 1e03          	ldw	x,(OFST-1,sp)
 436  00a4 90ae0002      	ldw	y,#2
 437  00a8 bf01          	ldw	c_x+1,x
 438  00aa 93            	ldw	x,y
 439  00ab 4f            	clr	a
 440  00ac 92a70000      	ldf	([c_x.e],x),a
 441                     ; 212     *((@far u8*) StartAddress + 3) = FLASH_CLEAR_BYTE;
 444  00b0 7b02          	ld	a,(OFST-2,sp)
 445  00b2 b700          	ld	c_x,a
 446  00b4 1e03          	ldw	x,(OFST-1,sp)
 447  00b6 90ae0003      	ldw	y,#3
 448  00ba bf01          	ldw	c_x+1,x
 449  00bc 93            	ldw	x,y
 450  00bd 4f            	clr	a
 451  00be 92a70000      	ldf	([c_x.e],x),a
 452                     ; 219 }
 456  00c2 5b06          	addw	sp,#6
 457  00c4 81            	ret
 489                     ; 238 void FLASH_EraseByte(u32 Address)
 489                     ; 239 {
 490                     	switch	.text
 491  00c5               _FLASH_EraseByte:
 493       00000000      OFST:	set	0
 496                     ; 241     assert_param(IS_FLASH_ADDRESS_OK(Address));
 498                     ; 244     *((@far u8*) Address) = FLASH_CLEAR_BYTE; /* Erase byte */
 500  00c5 7b04          	ld	a,(OFST+4,sp)
 501  00c7 b700          	ld	c_x,a
 502  00c9 1e05          	ldw	x,(OFST+5,sp)
 503  00cb bf01          	ldw	c_x+1,x
 504  00cd 4f            	clr	a
 505  00ce 92bd0000      	ldf	[c_x.e],a
 506                     ; 248 }
 510  00d2 81            	ret
 544                     ; 267 void FLASH_EraseOptionByte(u32 Address)
 544                     ; 268 {
 545                     	switch	.text
 546  00d3               _FLASH_EraseOptionByte:
 548       00000000      OFST:	set	0
 551                     ; 270     assert_param(IS_OPTION_BYTE_ADDRESS_OK(Address));
 553                     ; 273     FLASH->CR2 |= FLASH_CR2_OPT;
 555  00d3 721e505b      	bset	20571,#7
 556                     ; 274     FLASH->NCR2 &= (u8)(~FLASH_NCR2_NOPT);
 558  00d7 721f505c      	bres	20572,#7
 559                     ; 278     *((@far u8*)Address) = FLASH_CLEAR_BYTE;
 561  00db 7b04          	ld	a,(OFST+4,sp)
 562  00dd b700          	ld	c_x,a
 563  00df 1e05          	ldw	x,(OFST+5,sp)
 564  00e1 bf01          	ldw	c_x+1,x
 565  00e3 4f            	clr	a
 566  00e4 92bd0000      	ldf	[c_x.e],a
 567                     ; 279     *((@far u8*)(Address + 1 )) = FLASH_SET_BYTE;
 570  00e8 96            	ldw	x,sp
 571  00e9 1c0003        	addw	x,#OFST+3
 572  00ec cd0000        	call	c_ltor
 574  00ef a601          	ld	a,#1
 575  00f1 cd0000        	call	c_ladc
 577  00f4 450100        	mov	c_x,c_lreg+1
 578  00f7 be02          	ldw	x,c_lreg+2
 579  00f9 bf01          	ldw	c_x+1,x
 580  00fb a6ff          	ld	a,#255
 581  00fd 92bd0000      	ldf	[c_x.e],a
 582                     ; 285     FLASH_WaitForLastOperation(FLASH_MEMTYPE_DATA);
 585  0101 a601          	ld	a,#1
 586  0103 cd02eb        	call	_FLASH_WaitForLastOperation
 588                     ; 288     FLASH->CR2 &= (u8)(~FLASH_CR2_OPT);
 590  0106 721f505b      	bres	20571,#7
 591                     ; 289     FLASH->NCR2 |= FLASH_NCR2_NOPT;
 593  010a 721e505c      	bset	20572,#7
 594                     ; 290 }
 597  010e 81            	ret
 695                     ; 318 void FLASH_ProgramBlock(u16 BlockNum, FLASH_MemType_TypeDef MemType, FLASH_ProgramMode_TypeDef ProgMode, u8 *Buffer)
 695                     ; 319 {
 696                     	switch	.text
 697  010f               _FLASH_ProgramBlock:
 699  010f 89            	pushw	x
 700  0110 5206          	subw	sp,#6
 701       00000006      OFST:	set	6
 704                     ; 320     u16 Count = 0;
 706                     ; 321     u32 StartAddress = 0;
 708                     ; 324     assert_param(IS_MEMORY_TYPE_OK(MemType));
 710                     ; 325     assert_param(IS_FLASH_PROGRAM_MODE_OK(ProgMode));
 712                     ; 326     if (MemType == FLASH_MEMTYPE_PROG)
 714  0112 0d0b          	tnz	(OFST+5,sp)
 715  0114 260c          	jrne	L552
 716                     ; 328         assert_param(IS_FLASH_PROG_BLOCK_NUMBER_OK(BlockNum));
 718                     ; 329         StartAddress = FLASH_PROG_START_PHYSICAL_ADDRESS;
 720  0116 ae8000        	ldw	x,#32768

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -