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

📄 test.s

📁 mips下的ucos
💻 S
字号:
	.file	1 "Test.c"
gcc2_compiled.:
__gnu_compiled_c:
	.rdata
	.align	2
$LC0:
	.ascii	"Start of uCos test\n\000"
	.align	2
$LC1:
	.ascii	"OSInit done\n\000"
	.text
	.align	2
	.globl	main
	.text
	.ent	main
main:
	.frame	$sp,24,$31		# vars= 0, regs= 1/0, args= 16, extra= 0
	.mask	0x80000000,-8
	.fmask	0x00000000,0
	subu	$sp,$sp,24
	sw	$31,16($sp)
	jal	__main
	lui	$4,%hi($LC0) # high
	.set	noreorder
	.set	nomacro
	jal	printf
	addiu	$4,$4,%lo($LC0) # low
	.set	macro
	.set	reorder

	jal	OSInit
	lui	$4,%hi($LC1) # high
	.set	noreorder
	.set	nomacro
	jal	printf
	addiu	$4,$4,%lo($LC1) # low
	.set	macro
	.set	reorder

	.set	noreorder
	.set	nomacro
	jal	OSSemCreate
	li	$4,1			# 0x1
	.set	macro
	.set	reorder

	lui	$4,%hi(TaskStart) # high
	lui	$6,%hi(TaskStartStk+2044) # high
	addiu	$4,$4,%lo(TaskStart) # low
	addiu	$6,$6,%lo(TaskStartStk+2044) # low
	move	$5,$0
	sw	$2,IOSem
	.set	noreorder
	.set	nomacro
	jal	OSTaskCreate
	move	$7,$0
	.set	macro
	.set	reorder

	jal	OSStart
	lw	$31,16($sp)
	#nop
	.set	noreorder
	.set	nomacro
	j	$31
	addu	$sp,$sp,24
	.set	macro
	.set	reorder

	.end	main
	.rdata
	.align	2
$LC2:
	.ascii	"Main task started\n\000"
	.align	2
$LC3:
	.ascii	"Timer started\n\000"
	.align	2
$LC4:
	.ascii	"I am task %i\000"
	.align	2
$LC5:
	.ascii	"About to create task %i\n\000"
	.align	2
$LC6:
	.ascii	"Task %5d  CPU Usage %3d%%\n\000"
	.align	2
$LC7:
	.ascii	"Task switch/sec: %5d\n\000"
	.text
	.align	2
	.globl	TaskStart
	.text
	.ent	TaskStart
TaskStart:
	.frame	$sp,64,$31		# vars= 8, regs= 10/0, args= 16, extra= 0
	.mask	0xc0ff0000,-4
	.fmask	0x00000000,0
	lui	$4,%hi($LC2) # high
	subu	$sp,$sp,64
	addiu	$4,$4,%lo($LC2) # low
	sw	$fp,56($sp)
	sw	$23,52($sp)
	sw	$22,48($sp)
	sw	$21,44($sp)
	sw	$20,40($sp)
	sw	$19,36($sp)
	sw	$18,32($sp)
	sw	$31,60($sp)
	sw	$17,28($sp)
	.set	noreorder
	.set	nomacro
	jal	printf
	sw	$16,24($sp)
	.set	macro
	.set	reorder

	.set	noreorder
	.set	nomacro
	jal	BSPInit
	move	$18,$0
	.set	macro
	.set	reorder

	lw	$4,IOSem
	move	$5,$0
	.set	noreorder
	.set	nomacro
	jal	OSSemPend
	addu	$6,$sp,16
	.set	macro
	.set	reorder

	lui	$4,%hi($LC3) # high
	.set	noreorder
	.set	nomacro
	jal	printf
	addiu	$4,$4,%lo($LC3) # low
	.set	macro
	.set	reorder

	lw	$4,IOSem
	.set	noreorder
	.set	nomacro
	jal	OSSemPost
	lui	$23,%hi($LC4) # high
	.set	macro
	.set	reorder

	.set	noreorder
	.set	nomacro
	jal	OSStatInit
	lui	$22,%hi($LC5) # high
	.set	macro
	.set	reorder

	lui	$2,%hi(TaskData) # high
	addiu	$fp,$2,%lo(TaskData) # low
	lui	$21,%hi(Task) # high
	lui	$20,%hi(TaskStk+2044) # high
	li	$19,80			# 0x50
$L7:
	mtlo	$fp
	mad	$18,$19
	addu	$16,$18,1
	move	$6,$16
	addiu	$5,$23,%lo($LC4) # low
	mflo	$17
	.set	noreorder
	.set	nomacro
	jal	sprintf
	move	$4,$17
	.set	macro
	.set	reorder

	move	$5,$18
	.set	noreorder
	.set	nomacro
	jal	printf
	addiu	$4,$22,%lo($LC5) # low
	.set	macro
	.set	reorder

	andi	$16,$16,0x00ff
	sll	$2,$18,11
	addiu	$6,$20,%lo(TaskStk+2044) # low
	addu	$6,$2,$6
	move	$5,$17
	move	$18,$16
	addiu	$4,$21,%lo(Task) # low
	.set	noreorder
	.set	nomacro
	jal	OSTaskCreate
	move	$7,$16
	.set	macro
	.set	reorder

	sltu	$3,$18,10
	.set	noreorder
	.set	nomacro
	bne	$3,$0,$L7
	lui	$17,%hi($LC6) # high
	.set	macro
	.set	reorder

	lui	$16,%hi($LC7) # high
$L9:
	lw	$4,IOSem
	addu	$6,$sp,16
	.set	noreorder
	.set	nomacro
	jal	OSSemPend
	move	$5,$0
	.set	macro
	.set	reorder

	lb	$6,OSCPUUsage
	lbu	$5,OSTaskCtr
	.set	noreorder
	.set	nomacro
	jal	printf
	addiu	$4,$17,%lo($LC6) # low
	.set	macro
	.set	reorder

	lw	$5,OSCtxSwCtr
	.set	noreorder
	.set	nomacro
	jal	printf
	addiu	$4,$16,%lo($LC7) # low
	.set	macro
	.set	reorder

	lw	$4,IOSem
	jal	OSSemPost
	move	$4,$0
	move	$5,$0
	li	$6,1			# 0x1
	sw	$0,OSCtxSwCtr
	.set	noreorder
	.set	nomacro
	jal	OSTimeDlyHMSM
	move	$7,$0
	.set	macro
	.set	reorder

	j	$L9
	.end	TaskStart
	.sdata
	.align	2
$LC8:
	.ascii	"%s\n\000"
	.text
	.align	2
	.globl	Task
	.text
	.ent	Task
Task:
	.frame	$sp,40,$31		# vars= 8, regs= 4/0, args= 16, extra= 0
	.mask	0x80070000,-4
	.fmask	0x00000000,0
	subu	$sp,$sp,40
	lui	$2,%hi(x) # high
	sw	$18,32($sp)
	sw	$17,28($sp)
	sw	$16,24($sp)
	sw	$31,36($sp)
	move	$18,$4
	addiu	$17,$2,%lo(x) # low
	lui	$16,%hi($LC8) # high
$L13:
	lw	$4,IOSem
	addu	$6,$sp,16
	.set	noreorder
	.set	nomacro
	jal	OSSemPend
	move	$5,$0
	.set	macro
	.set	reorder

	move	$5,$18
	.set	noreorder
	.set	nomacro
	jal	printf
	addiu	$4,$16,%lo($LC8) # low
	.set	macro
	.set	reorder

	lw	$4,IOSem
	jal	OSSemPost
	move	$11,$0
	move	$10,$17
$L19:
	lw	$8,0($10)
	lw	$9,4($10)
	move	$7,$0
$L23:
	addu	$2,$11,$7
	move	$3,$2
	multu	$9,$3
	sra	$2,$2,31
	addu	$7,$7,1
	slt	$6,$7,10
	mfhi	$4
	mflo	$5
	mtlo	$4
	mad	$2,$9
	mad	$8,$3
	mflo	$4
	move	$8,$4
	.set	noreorder
	.set	nomacro
	bne	$6,$0,$L23
	move	$9,$5
	.set	macro
	.set	reorder

	addu	$11,$11,1
	slt	$2,$11,100
	sw	$8,0($10)
	sw	$9,4($10)
	.set	noreorder
	.set	nomacro
	bne	$2,$0,$L19
	addu	$10,$10,8
	.set	macro
	.set	reorder

	.set	noreorder
	.set	nomacro
	jal	OSTimeDly
	li	$4,1			# 0x1
	.set	macro
	.set	reorder

	j	$L13
	.end	Task

	.comm	TaskStk,20480

	.comm	TaskStartStk,2048

	.comm	TaskData,800

	.comm	IOSem,4

	.comm	x,800

	.extern	OSCtxSwCtr, 4
	.extern	OSCPUUsage, 1
	.extern	OSTaskCtr, 1

⌨️ 快捷键说明

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