-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos.list
2718 lines (2574 loc) · 91.4 KB
/
os.list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
os.elf: file format elf32-littlearm
Disassembly of section .text:
08000000 <isr_vectors>:
8000000: 00 a0 00 20 0d 06 00 08 81 06 00 08 81 06 00 08 ... ............
8000010: 81 06 00 08 81 06 00 08 81 06 00 08 00 00 00 00 ................
...
800002c: 81 06 00 08 00 00 00 00 00 00 00 00 fd 0a 00 08 ................
800003c: a9 0b 00 08 ....
08000040 <usart_init>:
*/
#define USART_FLAG_TXE ((uint16_t) 0x0080)
void usart_init(void)
{
8000040: b480 push {r7}
8000042: af00 add r7, sp, #0
*(RCC_APB2ENR) |= (uint32_t) (0x00000001 | 0x00000004);
8000044: f241 0318 movw r3, #4120 ; 0x1018
8000048: f2c4 0302 movt r3, #16386 ; 0x4002
800004c: f241 0218 movw r2, #4120 ; 0x1018
8000050: f2c4 0202 movt r2, #16386 ; 0x4002
8000054: 6812 ldr r2, [r2, #0]
8000056: f042 0205 orr.w r2, r2, #5
800005a: 601a str r2, [r3, #0]
*(RCC_APB1ENR) |= (uint32_t) (0x00020000);
800005c: f241 031c movw r3, #4124 ; 0x101c
8000060: f2c4 0302 movt r3, #16386 ; 0x4002
8000064: f241 021c movw r2, #4124 ; 0x101c
8000068: f2c4 0202 movt r2, #16386 ; 0x4002
800006c: 6812 ldr r2, [r2, #0]
800006e: f442 3200 orr.w r2, r2, #131072 ; 0x20000
8000072: 601a str r2, [r3, #0]
/* USART2 Configuration, Rx->PA3, Tx->PA2 */
*(GPIOA_CRL) = 0x00004B00;
8000074: f44f 6300 mov.w r3, #2048 ; 0x800
8000078: f2c4 0301 movt r3, #16385 ; 0x4001
800007c: f44f 4296 mov.w r2, #19200 ; 0x4b00
8000080: 601a str r2, [r3, #0]
*(GPIOA_CRH) = 0x00000800;
8000082: f640 0304 movw r3, #2052 ; 0x804
8000086: f2c4 0301 movt r3, #16385 ; 0x4001
800008a: f44f 6200 mov.w r2, #2048 ; 0x800
800008e: 601a str r2, [r3, #0]
*(GPIOA_ODR) = 0x00000000;
8000090: f640 030c movw r3, #2060 ; 0x80c
8000094: f2c4 0301 movt r3, #16385 ; 0x4001
8000098: 2200 movs r2, #0
800009a: 601a str r2, [r3, #0]
*(GPIOA_BSRR) = 0x00000000;
800009c: f44f 6301 mov.w r3, #2064 ; 0x810
80000a0: f2c4 0301 movt r3, #16385 ; 0x4001
80000a4: 2200 movs r2, #0
80000a6: 601a str r2, [r3, #0]
*(GPIOA_BRR) = 0x00000000;
80000a8: f640 0314 movw r3, #2068 ; 0x814
80000ac: f2c4 0301 movt r3, #16385 ; 0x4001
80000b0: 2200 movs r2, #0
80000b2: 601a str r2, [r3, #0]
*(USART2_CR1) = 0x0000000C;
80000b4: f244 430c movw r3, #17420 ; 0x440c
80000b8: f2c4 0300 movt r3, #16384 ; 0x4000
80000bc: 220c movs r2, #12
80000be: 601a str r2, [r3, #0]
*(USART2_CR2) = 0x00000000;
80000c0: f244 4310 movw r3, #17424 ; 0x4410
80000c4: f2c4 0300 movt r3, #16384 ; 0x4000
80000c8: 2200 movs r2, #0
80000ca: 601a str r2, [r3, #0]
*(USART2_CR3) = 0x00000000;
80000cc: f244 4314 movw r3, #17428 ; 0x4414
80000d0: f2c4 0300 movt r3, #16384 ; 0x4000
80000d4: 2200 movs r2, #0
80000d6: 601a str r2, [r3, #0]
*(USART2_CR1) |= 0x2000;
80000d8: f244 430c movw r3, #17420 ; 0x440c
80000dc: f2c4 0300 movt r3, #16384 ; 0x4000
80000e0: f244 420c movw r2, #17420 ; 0x440c
80000e4: f2c4 0200 movt r2, #16384 ; 0x4000
80000e8: 6812 ldr r2, [r2, #0]
80000ea: f442 5200 orr.w r2, r2, #8192 ; 0x2000
80000ee: 601a str r2, [r3, #0]
*(USART1_CR1) = 0x0000000C;
80000f0: f244 430c movw r3, #17420 ; 0x440c
80000f4: f2c4 0300 movt r3, #16384 ; 0x4000
80000f8: 220c movs r2, #12
80000fa: 601a str r2, [r3, #0]
*(USART1_CR2) = 0x00000000;
80000fc: f244 4310 movw r3, #17424 ; 0x4410
8000100: f2c4 0300 movt r3, #16384 ; 0x4000
8000104: 2200 movs r2, #0
8000106: 601a str r2, [r3, #0]
*(USART1_CR3) = 0x00000000;
8000108: f244 4314 movw r3, #17428 ; 0x4414
800010c: f2c4 0300 movt r3, #16384 ; 0x4000
8000110: 2200 movs r2, #0
8000112: 601a str r2, [r3, #0]
*(USART1_CR1) |= 0x2000;
8000114: f244 430c movw r3, #17420 ; 0x440c
8000118: f2c4 0300 movt r3, #16384 ; 0x4000
800011c: f244 420c movw r2, #17420 ; 0x440c
8000120: f2c4 0200 movt r2, #16384 ; 0x4000
8000124: 6812 ldr r2, [r2, #0]
8000126: f442 5200 orr.w r2, r2, #8192 ; 0x2000
800012a: 601a str r2, [r3, #0]
}
800012c: 46bd mov sp, r7
800012e: f85d 7b04 ldr.w r7, [sp], #4
8000132: 4770 bx lr
08000134 <print_str>:
void print_str(const char *str)
{
8000134: b480 push {r7}
8000136: b083 sub sp, #12
8000138: af00 add r7, sp, #0
800013a: 6078 str r0, [r7, #4]
while (*str) {
800013c: e013 b.n 8000166 <print_str+0x32>
while (!(*(USART2_SR) & USART_FLAG_TXE));
800013e: bf00 nop
8000140: f44f 4388 mov.w r3, #17408 ; 0x4400
8000144: f2c4 0300 movt r3, #16384 ; 0x4000
8000148: 681b ldr r3, [r3, #0]
800014a: f003 0380 and.w r3, r3, #128 ; 0x80
800014e: 2b00 cmp r3, #0
8000150: d0f6 beq.n 8000140 <print_str+0xc>
*(USART2_DR) = (*str & 0xFF);
8000152: f244 4304 movw r3, #17412 ; 0x4404
8000156: f2c4 0300 movt r3, #16384 ; 0x4000
800015a: 687a ldr r2, [r7, #4]
800015c: 7812 ldrb r2, [r2, #0]
800015e: 601a str r2, [r3, #0]
str++;
8000160: 687b ldr r3, [r7, #4]
8000162: 3301 adds r3, #1
8000164: 607b str r3, [r7, #4]
void print_str(const char *str)
{
while (*str) {
8000166: 687b ldr r3, [r7, #4]
8000168: 781b ldrb r3, [r3, #0]
800016a: 2b00 cmp r3, #0
800016c: d1e7 bne.n 800013e <print_str+0xa>
while (!(*(USART2_SR) & USART_FLAG_TXE));
*(USART2_DR) = (*str & 0xFF);
str++;
}
}
800016e: 370c adds r7, #12
8000170: 46bd mov sp, r7
8000172: f85d 7b04 ldr.w r7, [sp], #4
8000176: 4770 bx lr
08000178 <print_chr>:
void print_chr(const char c)
{
8000178: b480 push {r7}
800017a: b083 sub sp, #12
800017c: af00 add r7, sp, #0
800017e: 4603 mov r3, r0
8000180: 71fb strb r3, [r7, #7]
while (!(*(USART2_SR) & USART_FLAG_TXE));
8000182: bf00 nop
8000184: f44f 4388 mov.w r3, #17408 ; 0x4400
8000188: f2c4 0300 movt r3, #16384 ; 0x4000
800018c: 681b ldr r3, [r3, #0]
800018e: f003 0380 and.w r3, r3, #128 ; 0x80
8000192: 2b00 cmp r3, #0
8000194: d0f6 beq.n 8000184 <print_chr+0xc>
*(USART2_DR) = ( c & 0xFF);
8000196: f244 4304 movw r3, #17412 ; 0x4404
800019a: f2c4 0300 movt r3, #16384 ; 0x4000
800019e: 79fa ldrb r2, [r7, #7]
80001a0: 601a str r2, [r3, #0]
}
80001a2: 370c adds r7, #12
80001a4: 46bd mov sp, r7
80001a6: f85d 7b04 ldr.w r7, [sp], #4
80001aa: 4770 bx lr
080001ac <print_int>:
void print_int(int i)
{
80001ac: b580 push {r7, lr}
80001ae: b088 sub sp, #32
80001b0: af00 add r7, sp, #0
80001b2: 6078 str r0, [r7, #4]
int l;
//char number;
char buff[11]= {0};
80001b4: f107 030c add.w r3, r7, #12
80001b8: 2200 movs r2, #0
80001ba: 601a str r2, [r3, #0]
80001bc: 3304 adds r3, #4
80001be: 2200 movs r2, #0
80001c0: 601a str r2, [r3, #0]
80001c2: 3304 adds r3, #4
80001c4: 2200 movs r2, #0
80001c6: 801a strh r2, [r3, #0]
80001c8: 3302 adds r3, #2
80001ca: 2200 movs r2, #0
80001cc: 701a strb r2, [r3, #0]
80001ce: 3301 adds r3, #1
buff[10] = '\0';
80001d0: 2300 movs r3, #0
80001d2: 75bb strb r3, [r7, #22]
int b = 9;
80001d4: 2309 movs r3, #9
80001d6: 61fb str r3, [r7, #28]
do{
l = i % 10;
80001d8: 687a ldr r2, [r7, #4]
80001da: f246 6367 movw r3, #26215 ; 0x6667
80001de: f2c6 6366 movt r3, #26214 ; 0x6666
80001e2: fb83 1302 smull r1, r3, r3, r2
80001e6: 1099 asrs r1, r3, #2
80001e8: 17d3 asrs r3, r2, #31
80001ea: 1ac9 subs r1, r1, r3
80001ec: 460b mov r3, r1
80001ee: 009b lsls r3, r3, #2
80001f0: 440b add r3, r1
80001f2: 005b lsls r3, r3, #1
80001f4: 1ad3 subs r3, r2, r3
80001f6: 61bb str r3, [r7, #24]
i = i / 10;
80001f8: 687a ldr r2, [r7, #4]
80001fa: f246 6367 movw r3, #26215 ; 0x6667
80001fe: f2c6 6366 movt r3, #26214 ; 0x6666
8000202: fb83 1302 smull r1, r3, r3, r2
8000206: 1099 asrs r1, r3, #2
8000208: 17d3 asrs r3, r2, #31
800020a: 1acb subs r3, r1, r3
800020c: 607b str r3, [r7, #4]
// number = l +'0';
buff[b] = l+ '0';
800020e: 69bb ldr r3, [r7, #24]
8000210: b2db uxtb r3, r3
8000212: 3330 adds r3, #48 ; 0x30
8000214: b2da uxtb r2, r3
8000216: f107 010c add.w r1, r7, #12
800021a: 69fb ldr r3, [r7, #28]
800021c: 440b add r3, r1
800021e: 701a strb r2, [r3, #0]
b--;
8000220: 69fb ldr r3, [r7, #28]
8000222: 3b01 subs r3, #1
8000224: 61fb str r3, [r7, #28]
//print_chr(number);
}while(i > 0);
8000226: 687b ldr r3, [r7, #4]
8000228: 2b00 cmp r3, #0
800022a: dcd5 bgt.n 80001d8 <print_int+0x2c>
print_str(buff+b+1);
800022c: 69fb ldr r3, [r7, #28]
800022e: 3301 adds r3, #1
8000230: f107 020c add.w r2, r7, #12
8000234: 4413 add r3, r2
8000236: 4618 mov r0, r3
8000238: f7ff ff7c bl 8000134 <print_str>
}
800023c: 3720 adds r7, #32
800023e: 46bd mov sp, r7
8000240: bd80 pop {r7, pc}
8000242: bf00 nop
08000244 <delay>:
static void delay(volatile int count)
{
8000244: b480 push {r7}
8000246: b083 sub sp, #12
8000248: af00 add r7, sp, #0
800024a: 6078 str r0, [r7, #4]
count *= 50000;
800024c: 687b ldr r3, [r7, #4]
800024e: f24c 3250 movw r2, #50000 ; 0xc350
8000252: fb02 f303 mul.w r3, r2, r3
8000256: 607b str r3, [r7, #4]
while (count--);
8000258: bf00 nop
800025a: 687b ldr r3, [r7, #4]
800025c: 1e5a subs r2, r3, #1
800025e: 607a str r2, [r7, #4]
8000260: 2b00 cmp r3, #0
8000262: d1fa bne.n 800025a <delay+0x16>
}
8000264: 370c adds r7, #12
8000266: 46bd mov sp, r7
8000268: f85d 7b04 ldr.w r7, [sp], #4
800026c: 4770 bx lr
800026e: bf00 nop
08000270 <busy_loop>:
static void busy_loop(void *str)
{
8000270: b580 push {r7, lr}
8000272: b082 sub sp, #8
8000274: af00 add r7, sp, #0
8000276: 6078 str r0, [r7, #4]
while (1) {
print_str(str);
8000278: 6878 ldr r0, [r7, #4]
800027a: f7ff ff5b bl 8000134 <print_str>
print_str(": Running...\n");
800027e: f241 207c movw r0, #4732 ; 0x127c
8000282: f6c0 0000 movt r0, #2048 ; 0x800
8000286: f7ff ff55 bl 8000134 <print_str>
delay(1000);
800028a: f44f 707a mov.w r0, #1000 ; 0x3e8
800028e: f7ff ffd9 bl 8000244 <delay>
}
8000292: e7f1 b.n 8000278 <busy_loop+0x8>
08000294 <test1>:
}
void test1(void *userdata)
{
8000294: b580 push {r7, lr}
8000296: b082 sub sp, #8
8000298: af00 add r7, sp, #0
800029a: 6078 str r0, [r7, #4]
busy_loop(userdata);
800029c: 6878 ldr r0, [r7, #4]
800029e: f7ff ffe7 bl 8000270 <busy_loop>
}
80002a2: 3708 adds r7, #8
80002a4: 46bd mov sp, r7
80002a6: bd80 pop {r7, pc}
080002a8 <test2>:
void test2(void *userdata)
{
80002a8: b580 push {r7, lr}
80002aa: b082 sub sp, #8
80002ac: af00 add r7, sp, #0
80002ae: 6078 str r0, [r7, #4]
busy_loop(userdata);
80002b0: 6878 ldr r0, [r7, #4]
80002b2: f7ff ffdd bl 8000270 <busy_loop>
}
80002b6: 3708 adds r7, #8
80002b8: 46bd mov sp, r7
80002ba: bd80 pop {r7, pc}
080002bc <test3>:
void test3(void *userdata)
{
80002bc: b580 push {r7, lr}
80002be: b082 sub sp, #8
80002c0: af00 add r7, sp, #0
80002c2: 6078 str r0, [r7, #4]
busy_loop(userdata);
80002c4: 6878 ldr r0, [r7, #4]
80002c6: f7ff ffd3 bl 8000270 <busy_loop>
}
80002ca: 3708 adds r7, #8
80002cc: 46bd mov sp, r7
80002ce: bd80 pop {r7, pc}
080002d0 <fib>:
void fib(int f) {
80002d0: b580 push {r7, lr}
80002d2: b086 sub sp, #24
80002d4: af00 add r7, sp, #0
80002d6: 6078 str r0, [r7, #4]
int previous = -1;
80002d8: f04f 33ff mov.w r3, #4294967295 ; 0xffffffff
80002dc: 617b str r3, [r7, #20]
int result = 1;
80002de: 2301 movs r3, #1
80002e0: 613b str r3, [r7, #16]
int i=0;
80002e2: 2300 movs r3, #0
80002e4: 60fb str r3, [r7, #12]
int sum=0;
80002e6: 2300 movs r3, #0
80002e8: 60bb str r3, [r7, #8]
for (i = 0; i <= f; i++) {
80002ea: 2300 movs r3, #0
80002ec: 60fb str r3, [r7, #12]
80002ee: e00a b.n 8000306 <fib+0x36>
sum = result + previous;
80002f0: 693a ldr r2, [r7, #16]
80002f2: 697b ldr r3, [r7, #20]
80002f4: 4413 add r3, r2
80002f6: 60bb str r3, [r7, #8]
previous = result;
80002f8: 693b ldr r3, [r7, #16]
80002fa: 617b str r3, [r7, #20]
result = sum;
80002fc: 68bb ldr r3, [r7, #8]
80002fe: 613b str r3, [r7, #16]
void fib(int f) {
int previous = -1;
int result = 1;
int i=0;
int sum=0;
for (i = 0; i <= f; i++) {
8000300: 68fb ldr r3, [r7, #12]
8000302: 3301 adds r3, #1
8000304: 60fb str r3, [r7, #12]
8000306: 68fa ldr r2, [r7, #12]
8000308: 687b ldr r3, [r7, #4]
800030a: 429a cmp r2, r3
800030c: ddf0 ble.n 80002f0 <fib+0x20>
sum = result + previous;
previous = result;
result = sum;
}
print_int(result);
800030e: 6938 ldr r0, [r7, #16]
8000310: f7ff ff4c bl 80001ac <print_int>
// return result;
}
8000314: 3718 adds r7, #24
8000316: 46bd mov sp, r7
8000318: bd80 pop {r7, pc}
800031a: bf00 nop
0800031c <findGCD>:
void findGCD(int a, int b) {
800031c: b580 push {r7, lr}
800031e: b082 sub sp, #8
8000320: af00 add r7, sp, #0
8000322: 6078 str r0, [r7, #4]
8000324: 6039 str r1, [r7, #0]
//int a = 33, b = 9999;
while (1) {
if (a > b) a -= b;
8000326: 687a ldr r2, [r7, #4]
8000328: 683b ldr r3, [r7, #0]
800032a: 429a cmp r2, r3
800032c: dd04 ble.n 8000338 <findGCD+0x1c>
800032e: 687a ldr r2, [r7, #4]
8000330: 683b ldr r3, [r7, #0]
8000332: 1ad3 subs r3, r2, r3
8000334: 607b str r3, [r7, #4]
8000336: e00c b.n 8000352 <findGCD+0x36>
else if (a < b) b -= a;
8000338: 687a ldr r2, [r7, #4]
800033a: 683b ldr r3, [r7, #0]
800033c: 429a cmp r2, r3
800033e: da04 bge.n 800034a <findGCD+0x2e>
8000340: 683a ldr r2, [r7, #0]
8000342: 687b ldr r3, [r7, #4]
8000344: 1ad3 subs r3, r2, r3
8000346: 603b str r3, [r7, #0]
8000348: e003 b.n 8000352 <findGCD+0x36>
else{
print_int(a);
800034a: 6878 ldr r0, [r7, #4]
800034c: f7ff ff2e bl 80001ac <print_int>
break;
8000350: e000 b.n 8000354 <findGCD+0x38>
}
}
8000352: e7e8 b.n 8000326 <findGCD+0xa>
}
8000354: 3708 adds r7, #8
8000356: 46bd mov sp, r7
8000358: bd80 pop {r7, pc}
800035a: bf00 nop
0800035c <find_cmd>:
/* 72MHz */
#define CPU_CLOCK_HZ 72000000
/* 100 ms per tick. */
#define TICK_RATE_HZ 10
int find_cmd( char* cmd, int i ){
800035c: b580 push {r7, lr}
800035e: b08c sub sp, #48 ; 0x30
8000360: af00 add r7, sp, #0
8000362: 6078 str r0, [r7, #4]
8000364: 6039 str r1, [r7, #0]
char *delim = " ";
8000366: f241 238c movw r3, #4748 ; 0x128c
800036a: f6c0 0300 movt r3, #2048 ; 0x800
800036e: 62fb str r3, [r7, #44] ; 0x2c
char *c;
char *para;
c = strtok(cmd, delim);
8000370: 6878 ldr r0, [r7, #4]
8000372: 6af9 ldr r1, [r7, #44] ; 0x2c
8000374: f000 fea2 bl 80010bc <strtok>
8000378: 62b8 str r0, [r7, #40] ; 0x28
para = strtok(NULL, delim);
800037a: 2000 movs r0, #0
800037c: 6af9 ldr r1, [r7, #44] ; 0x2c
800037e: f000 fe9d bl 80010bc <strtok>
8000382: 6278 str r0, [r7, #36] ; 0x24
//print_str(c);
//print_str(para);
if( strncmp(c, "start", 5) == 0 && i == 5 ){
8000384: 6ab8 ldr r0, [r7, #40] ; 0x28
8000386: f241 2190 movw r1, #4752 ; 0x1290
800038a: f6c0 0100 movt r1, #2048 ; 0x800
800038e: 2205 movs r2, #5
8000390: f000 fe3a bl 8001008 <strncmp>
8000394: 4603 mov r3, r0
8000396: 2b00 cmp r3, #0
8000398: d110 bne.n 80003bc <find_cmd+0x60>
800039a: 683b ldr r3, [r7, #0]
800039c: 2b05 cmp r3, #5
800039e: d10d bne.n 80003bc <find_cmd+0x60>
const char *str1 = "Task1";
80003a0: f241 2398 movw r3, #4760 ; 0x1298
80003a4: f6c0 0300 movt r3, #2048 ; 0x800
80003a8: 623b str r3, [r7, #32]
thread_create(test1, (void *) str1);
80003aa: f240 2095 movw r0, #661 ; 0x295
80003ae: f6c0 0000 movt r0, #2048 ; 0x800
80003b2: 6a39 ldr r1, [r7, #32]
80003b4: f000 fd5e bl 8000e74 <thread_create>
return 1;
80003b8: 2301 movs r3, #1
80003ba: e06d b.n 8000498 <find_cmd+0x13c>
}
else if( strncmp(c, "task2", 5) == 0&& i == 5 ){
80003bc: 6ab8 ldr r0, [r7, #40] ; 0x28
80003be: f241 21a0 movw r1, #4768 ; 0x12a0
80003c2: f6c0 0100 movt r1, #2048 ; 0x800
80003c6: 2205 movs r2, #5
80003c8: f000 fe1e bl 8001008 <strncmp>
80003cc: 4603 mov r3, r0
80003ce: 2b00 cmp r3, #0
80003d0: d110 bne.n 80003f4 <find_cmd+0x98>
80003d2: 683b ldr r3, [r7, #0]
80003d4: 2b05 cmp r3, #5
80003d6: d10d bne.n 80003f4 <find_cmd+0x98>
const char *str1 = "Task2";
80003d8: f241 23a8 movw r3, #4776 ; 0x12a8
80003dc: f6c0 0300 movt r3, #2048 ; 0x800
80003e0: 61fb str r3, [r7, #28]
thread_create(test2, (void *) str1);
80003e2: f240 20a9 movw r0, #681 ; 0x2a9
80003e6: f6c0 0000 movt r0, #2048 ; 0x800
80003ea: 69f9 ldr r1, [r7, #28]
80003ec: f000 fd42 bl 8000e74 <thread_create>
return 1;
80003f0: 2301 movs r3, #1
80003f2: e051 b.n 8000498 <find_cmd+0x13c>
}
else if( strncmp(c, "gcd", 3) == 0 ){
80003f4: 6ab8 ldr r0, [r7, #40] ; 0x28
80003f6: f241 21b0 movw r1, #4784 ; 0x12b0
80003fa: f6c0 0100 movt r1, #2048 ; 0x800
80003fe: 2203 movs r2, #3
8000400: f000 fe02 bl 8001008 <strncmp>
8000404: 4603 mov r3, r0
8000406: 2b00 cmp r3, #0
8000408: d118 bne.n 800043c <find_cmd+0xe0>
char *para2 = strtok(NULL, delim);
800040a: 2000 movs r0, #0
800040c: 6af9 ldr r1, [r7, #44] ; 0x2c
800040e: f000 fe55 bl 80010bc <strtok>
8000412: 61b8 str r0, [r7, #24]
//print_str(para);
//print_str(para2);
int *a = (int *)atoi(para);
8000414: 6a78 ldr r0, [r7, #36] ; 0x24
8000416: f000 fdef bl 8000ff8 <atoi>
800041a: 4603 mov r3, r0
800041c: 617b str r3, [r7, #20]
int *b = (int *)atoi(para2);
800041e: 69b8 ldr r0, [r7, #24]
8000420: f000 fdea bl 8000ff8 <atoi>
8000424: 4603 mov r3, r0
8000426: 613b str r3, [r7, #16]
thread_create_int2(findGCD, a, b);
8000428: f240 301d movw r0, #797 ; 0x31d
800042c: f6c0 0000 movt r0, #2048 ; 0x800
8000430: 6979 ldr r1, [r7, #20]
8000432: 693a ldr r2, [r7, #16]
8000434: f000 fbf6 bl 8000c24 <thread_create_int2>
return 1;
8000438: 2301 movs r3, #1
800043a: e02d b.n 8000498 <find_cmd+0x13c>
}
else if( strncmp(c, "fib", 3) == 0 ){
800043c: 6ab8 ldr r0, [r7, #40] ; 0x28
800043e: f241 21b4 movw r1, #4788 ; 0x12b4
8000442: f6c0 0100 movt r1, #2048 ; 0x800
8000446: 2203 movs r2, #3
8000448: f000 fdde bl 8001008 <strncmp>
800044c: 4603 mov r3, r0
800044e: 2b00 cmp r3, #0
8000450: d10d bne.n 800046e <find_cmd+0x112>
int *f = (int *)atoi(para);
8000452: 6a78 ldr r0, [r7, #36] ; 0x24
8000454: f000 fdd0 bl 8000ff8 <atoi>
8000458: 4603 mov r3, r0
800045a: 60fb str r3, [r7, #12]
thread_create_int(fib, f);
800045c: f240 20d1 movw r0, #721 ; 0x2d1
8000460: f6c0 0000 movt r0, #2048 ; 0x800
8000464: 68f9 ldr r1, [r7, #12]
8000466: f000 fc75 bl 8000d54 <thread_create_int>
return 1;
800046a: 2301 movs r3, #1
800046c: e014 b.n 8000498 <find_cmd+0x13c>
}
else if( strncmp(c, "help", 4) ==0 && i == 4 ){
800046e: 6ab8 ldr r0, [r7, #40] ; 0x28
8000470: f241 21b8 movw r1, #4792 ; 0x12b8
8000474: f6c0 0100 movt r1, #2048 ; 0x800
8000478: 2204 movs r2, #4
800047a: f000 fdc5 bl 8001008 <strncmp>
800047e: 4603 mov r3, r0
8000480: 2b00 cmp r3, #0
8000482: d108 bne.n 8000496 <find_cmd+0x13a>
8000484: 683b ldr r3, [r7, #0]
8000486: 2b04 cmp r3, #4
8000488: d105 bne.n 8000496 <find_cmd+0x13a>
print_str("\nCommand list:\n"
800048a: f241 20c0 movw r0, #4800 ; 0x12c0
800048e: f6c0 0000 movt r0, #2048 ; 0x800
8000492: f7ff fe4f bl 8000134 <print_str>
" gcd %d %d -two integer each seperate with a space\n"
"KNOWN ISSUE: users have to press ENTER after the fib or gcd command, or the shell:~$ wont print out"
);
}
return 0;
8000496: 2300 movs r3, #0
}
8000498: 4618 mov r0, r3
800049a: 3730 adds r7, #48 ; 0x30
800049c: 46bd mov sp, r7
800049e: bd80 pop {r7, pc}
080004a0 <shell>:
void shell(){
80004a0: b580 push {r7, lr}
80004a2: b086 sub sp, #24
80004a4: af00 add r7, sp, #0
char c[20] = {0};
80004a6: 463b mov r3, r7
80004a8: 2200 movs r2, #0
80004aa: 601a str r2, [r3, #0]
80004ac: 3304 adds r3, #4
80004ae: 2200 movs r2, #0
80004b0: 601a str r2, [r3, #0]
80004b2: 3304 adds r3, #4
80004b4: 2200 movs r2, #0
80004b6: 601a str r2, [r3, #0]
80004b8: 3304 adds r3, #4
80004ba: 2200 movs r2, #0
80004bc: 601a str r2, [r3, #0]
80004be: 3304 adds r3, #4
80004c0: 2200 movs r2, #0
80004c2: 601a str r2, [r3, #0]
80004c4: 3304 adds r3, #4
int i = 0;
80004c6: 2300 movs r3, #0
80004c8: 617b str r3, [r7, #20]
// int x;
print_str("type help for command list\n");
80004ca: f241 30ac movw r0, #5036 ; 0x13ac
80004ce: f6c0 0000 movt r0, #2048 ; 0x800
80004d2: f7ff fe2f bl 8000134 <print_str>
print_str("shell:~$ ");
80004d6: f241 30c8 movw r0, #5064 ; 0x13c8
80004da: f6c0 0000 movt r0, #2048 ; 0x800
80004de: f7ff fe29 bl 8000134 <print_str>
while(1){
if(*(USART1_SR) & 0x0020){
80004e2: f44f 4388 mov.w r3, #17408 ; 0x4400
80004e6: f2c4 0300 movt r3, #16384 ; 0x4000
80004ea: 681b ldr r3, [r3, #0]
80004ec: f003 0320 and.w r3, r3, #32
80004f0: 2b00 cmp r3, #0
80004f2: d05c beq.n 80005ae <shell+0x10e>
c[i] = *(USART1_DR) & 0x0FF;
80004f4: f244 4304 movw r3, #17412 ; 0x4404
80004f8: f2c4 0300 movt r3, #16384 ; 0x4000
80004fc: 681b ldr r3, [r3, #0]
80004fe: b2da uxtb r2, r3
8000500: 4639 mov r1, r7
8000502: 697b ldr r3, [r7, #20]
8000504: 440b add r3, r1
8000506: 701a strb r2, [r3, #0]
if( c[i] == 0x0d){
8000508: 463a mov r2, r7
800050a: 697b ldr r3, [r7, #20]
800050c: 4413 add r3, r2
800050e: 781b ldrb r3, [r3, #0]
8000510: 2b0d cmp r3, #13
8000512: d114 bne.n 800053e <shell+0x9e>
// print_chr('\n');
// print_str(c);
if(find_cmd(c, i))
8000514: 463b mov r3, r7
8000516: 4618 mov r0, r3
8000518: 6979 ldr r1, [r7, #20]
800051a: f7ff ff1f bl 800035c <find_cmd>
800051e: 4603 mov r3, r0
8000520: 2b00 cmp r3, #0
8000522: d003 beq.n 800052c <shell+0x8c>
print_chr('\n');
8000524: 200a movs r0, #10
8000526: f7ff fe27 bl 8000178 <print_chr>
800052a: e005 b.n 8000538 <shell+0x98>
// break;
else{
print_str("\nshell:~$ ");
800052c: f241 30d4 movw r0, #5076 ; 0x13d4
8000530: f6c0 0000 movt r0, #2048 ; 0x800
8000534: f7ff fdfe bl 8000134 <print_str>
}
i = 0;
8000538: 2300 movs r3, #0
800053a: 617b str r3, [r7, #20]
800053c: e037 b.n 80005ae <shell+0x10e>
}
else if( c[i] == 0x8 || c[i] ==0x7f ){
800053e: 463a mov r2, r7
8000540: 697b ldr r3, [r7, #20]
8000542: 4413 add r3, r2
8000544: 781b ldrb r3, [r3, #0]
8000546: 2b08 cmp r3, #8
8000548: d005 beq.n 8000556 <shell+0xb6>
800054a: 463a mov r2, r7
800054c: 697b ldr r3, [r7, #20]
800054e: 4413 add r3, r2
8000550: 781b ldrb r3, [r3, #0]
8000552: 2b7f cmp r3, #127 ; 0x7f
8000554: d120 bne.n 8000598 <shell+0xf8>
if( i != 0){
8000556: 697b ldr r3, [r7, #20]
8000558: 2b00 cmp r3, #0
800055a: d01c beq.n 8000596 <shell+0xf6>
c[i] = '\0';
800055c: 463a mov r2, r7
800055e: 697b ldr r3, [r7, #20]
8000560: 4413 add r3, r2
8000562: 2200 movs r2, #0
8000564: 701a strb r2, [r3, #0]
// c[i-1] = ' ';
// for( x = 0; x<i; x++){
// print_str("\b");
// }
print_str("\b");
8000566: f241 30e0 movw r0, #5088 ; 0x13e0
800056a: f6c0 0000 movt r0, #2048 ; 0x800
800056e: f7ff fde1 bl 8000134 <print_str>
print_chr(' ');
8000572: 2020 movs r0, #32
8000574: f7ff fe00 bl 8000178 <print_chr>
print_str("\b");
8000578: f241 30e0 movw r0, #5088 ; 0x13e0
800057c: f6c0 0000 movt r0, #2048 ; 0x800
8000580: f7ff fdd8 bl 8000134 <print_str>
i--;
8000584: 697b ldr r3, [r7, #20]
8000586: 3b01 subs r3, #1
8000588: 617b str r3, [r7, #20]
c[i] = '\0';
800058a: 463a mov r2, r7
800058c: 697b ldr r3, [r7, #20]
800058e: 4413 add r3, r2
8000590: 2200 movs r2, #0
8000592: 701a strb r2, [r3, #0]
print_str("\nshell:~$ ");
}
i = 0;
}
else if( c[i] == 0x8 || c[i] ==0x7f ){
if( i != 0){
8000594: e00b b.n 80005ae <shell+0x10e>
8000596: e00a b.n 80005ae <shell+0x10e>
c[i] = '\0';
}
}
else{
print_chr(c[i]);
8000598: 463a mov r2, r7
800059a: 697b ldr r3, [r7, #20]
800059c: 4413 add r3, r2
800059e: 781b ldrb r3, [r3, #0]
80005a0: 4618 mov r0, r3
80005a2: f7ff fde9 bl 8000178 <print_chr>
i++;
80005a6: 697b ldr r3, [r7, #20]
80005a8: 3301 adds r3, #1
80005aa: 617b str r3, [r7, #20]
}
}
}
80005ac: e799 b.n 80004e2 <shell+0x42>
80005ae: e798 b.n 80004e2 <shell+0x42>
080005b0 <main>:
}
int main(void)
{
80005b0: b580 push {r7, lr}
80005b2: b082 sub sp, #8
80005b4: af00 add r7, sp, #0
usart_init();
80005b6: f7ff fd43 bl 8000040 <usart_init>
const char *str0 = "SHELL";
80005ba: f241 33e4 movw r3, #5092 ; 0x13e4
80005be: f6c0 0300 movt r3, #2048 ; 0x800
80005c2: 607b str r3, [r7, #4]
thread_create(shell, (void *) str0);
80005c4: f240 40a1 movw r0, #1185 ; 0x4a1
80005c8: f6c0 0000 movt r0, #2048 ; 0x800
80005cc: 6879 ldr r1, [r7, #4]
80005ce: f000 fc51 bl 8000e74 <thread_create>
/* SysTick configuration */
//*SYSTICK_LOAD = (CPU_CLOCK_HZ / TICK_RATE_HZ) - 1UL;
*SYSTICK_LOAD = 7200000;
80005d2: f24e 0314 movw r3, #57364 ; 0xe014
80005d6: f2ce 0300 movt r3, #57344 ; 0xe000
80005da: f44f 425d mov.w r2, #56576 ; 0xdd00
80005de: f2c0 026d movt r2, #109 ; 0x6d
80005e2: 601a str r2, [r3, #0]
*SYSTICK_VAL = 1;
80005e4: f24e 0318 movw r3, #57368 ; 0xe018
80005e8: f2ce 0300 movt r3, #57344 ; 0xe000
80005ec: 2201 movs r2, #1
80005ee: 601a str r2, [r3, #0]
*SYSTICK_CTRL = 0x07;
80005f0: f24e 0310 movw r3, #57360 ; 0xe010
80005f4: f2ce 0300 movt r3, #57344 ; 0xe000
80005f8: 2207 movs r2, #7
80005fa: 601a str r2, [r3, #0]
__asm__("cpsie i");
80005fc: b662 cpsie i
thread_start();
80005fe: f000 fae5 bl 8000bcc <thread_start>
return 0;
8000602: 2300 movs r3, #0
}
8000604: 4618 mov r0, r3
8000606: 3708 adds r7, #8
8000608: 46bd mov sp, r7
800060a: bd80 pop {r7, pc}
0800060c <reset_handler>:
extern uint32_t _estack;
void rcc_clock_init(void);
void reset_handler(void)
{
800060c: b580 push {r7, lr}
800060e: b086 sub sp, #24
8000610: af00 add r7, sp, #0
/* Copy the data segment initializers from flash to SRAM */
uint32_t *idata_begin = &_sidata;
8000612: f241 43f8 movw r3, #5368 ; 0x14f8
8000616: f6c0 0300 movt r3, #2048 ; 0x800
800061a: 617b str r3, [r7, #20]
uint32_t *data_begin = &_sdata;
800061c: f240 0300 movw r3, #0
8000620: f2c2 0300 movt r3, #8192 ; 0x2000
8000624: 613b str r3, [r7, #16]
uint32_t *data_end = &_edata;
8000626: f240 433c movw r3, #1084 ; 0x43c
800062a: f2c2 0300 movt r3, #8192 ; 0x2000
800062e: 60bb str r3, [r7, #8]
while (data_begin < data_end) *data_begin++ = *idata_begin++;
8000630: e007 b.n 8000642 <reset_handler+0x36>
8000632: 693b ldr r3, [r7, #16]
8000634: 1d1a adds r2, r3, #4
8000636: 613a str r2, [r7, #16]
8000638: 697a ldr r2, [r7, #20]
800063a: 1d11 adds r1, r2, #4
800063c: 6179 str r1, [r7, #20]
800063e: 6812 ldr r2, [r2, #0]
8000640: 601a str r2, [r3, #0]
8000642: 693a ldr r2, [r7, #16]
8000644: 68bb ldr r3, [r7, #8]
8000646: 429a cmp r2, r3
8000648: d3f3 bcc.n 8000632 <reset_handler+0x26>
/* Zero fill the bss segment. */
uint32_t *bss_begin = &_sbss;
800064a: f240 433c movw r3, #1084 ; 0x43c
800064e: f2c2 0300 movt r3, #8192 ; 0x2000
8000652: 60fb str r3, [r7, #12]
uint32_t *bss_end = &_ebss;
8000654: f241 43c4 movw r3, #5316 ; 0x14c4
8000658: f2c2 0300 movt r3, #8192 ; 0x2000
800065c: 607b str r3, [r7, #4]
while (bss_begin < bss_end) *bss_begin++ = 0;
800065e: e004 b.n 800066a <reset_handler+0x5e>
8000660: 68fb ldr r3, [r7, #12]
8000662: 1d1a adds r2, r3, #4
8000664: 60fa str r2, [r7, #12]
8000666: 2200 movs r2, #0
8000668: 601a str r2, [r3, #0]
800066a: 68fa ldr r2, [r7, #12]
800066c: 687b ldr r3, [r7, #4]
800066e: 429a cmp r2, r3
8000670: d3f6 bcc.n 8000660 <reset_handler+0x54>
/* Clock system intitialization */
rcc_clock_init();
8000672: f000 f809 bl 8000688 <rcc_clock_init>
main();
8000676: f7ff ff9b bl 80005b0 <main>
}
800067a: 3718 adds r7, #24
800067c: 46bd mov sp, r7
800067e: bd80 pop {r7, pc}
08000680 <default_handler>:
void default_handler(void)
{
8000680: b480 push {r7}
8000682: af00 add r7, sp, #0
while (1);
8000684: e7fe b.n 8000684 <default_handler+0x4>
8000686: bf00 nop
08000688 <rcc_clock_init>:
[0x0E] = (uint32_t *) pendsv_handler, /* pendsv handler */
[0x0F] = (uint32_t *) systick_handler /* systick handler */
};
void rcc_clock_init(void)
{
8000688: b480 push {r7}
800068a: b083 sub sp, #12
800068c: af00 add r7, sp, #0
/* Reset the RCC clock configuration to the default reset state(for debug purpose) */
/* Set HSION bit */
*RCC_CR |= (uint32_t) 0x00000001;
800068e: f44f 5380 mov.w r3, #4096 ; 0x1000
8000692: f2c4 0302 movt r3, #16386 ; 0x4002
8000696: f44f 5280 mov.w r2, #4096 ; 0x1000
800069a: f2c4 0202 movt r2, #16386 ; 0x4002
800069e: 6812 ldr r2, [r2, #0]
80006a0: f042 0201 orr.w r2, r2, #1
80006a4: 601a str r2, [r3, #0]
/* Reset SW, HPRE, PPRE1, PPRE2, ADCPRE and MCO bits */
*RCC_CFGR &= (uint32_t) 0xF8FF0000;
80006a6: f241 0204 movw r2, #4100 ; 0x1004
80006aa: f2c4 0202 movt r2, #16386 ; 0x4002
80006ae: f241 0304 movw r3, #4100 ; 0x1004
80006b2: f2c4 0302 movt r3, #16386 ; 0x4002
80006b6: 6819 ldr r1, [r3, #0]
80006b8: 2300 movs r3, #0
80006ba: f6cf 03ff movt r3, #63743 ; 0xf8ff
80006be: 400b ands r3, r1
80006c0: 6013 str r3, [r2, #0]
/* Reset HSEON, CSSON and PLLON bits */
*RCC_CR &= (uint32_t) 0xFEF6FFFF;
80006c2: f44f 5380 mov.w r3, #4096 ; 0x1000
80006c6: f2c4 0302 movt r3, #16386 ; 0x4002
80006ca: f44f 5280 mov.w r2, #4096 ; 0x1000
80006ce: f2c4 0202 movt r2, #16386 ; 0x4002
80006d2: 6812 ldr r2, [r2, #0]
80006d4: f022 7284 bic.w r2, r2, #17301504 ; 0x1080000
80006d8: f422 3280 bic.w r2, r2, #65536 ; 0x10000
80006dc: 601a str r2, [r3, #0]
/* Reset HSEBYP bit */
*RCC_CR &= (uint32_t) 0xFFFBFFFF;
80006de: f44f 5380 mov.w r3, #4096 ; 0x1000
80006e2: f2c4 0302 movt r3, #16386 ; 0x4002
80006e6: f44f 5280 mov.w r2, #4096 ; 0x1000