-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathmain.lst
executable file
·5442 lines (5030 loc) · 207 KB
/
main.lst
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
main.elf: file format elf32-littlearm
Disassembly of section .text:
08000000 <vector_table>:
8000000: 00 50 00 20 8d 0f 00 08 6b 10 00 08 65 10 00 08 .P. ....k...e...
8000010: 65 10 00 08 65 10 00 08 65 10 00 08 00 00 00 00 e...e...e.......
...
800002c: 6b 10 00 08 6b 10 00 08 00 00 00 00 6b 10 00 08 k...k.......k...
800003c: 81 11 00 08 65 10 00 08 65 10 00 08 65 10 00 08 ....e...e...e...
800004c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800005c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800006c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800007c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800008c: 65 10 00 08 81 03 00 08 65 10 00 08 65 10 00 08 e.......e...e...
800009c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
80000ac: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
80000bc: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
80000cc: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
80000dc: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
80000ec: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
80000fc: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800010c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800011c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800012c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800013c: 65 10 00 08 65 10 00 08 65 10 00 08 65 10 00 08 e...e...e...e...
800014c: 65 10 00 08 e...
08000150 <clock_setup>:
static uint8_t usbd_control_buffer[256];
/* Set STM32 to 72 MHz. */
static void clock_setup(void)
{
8000150: b580 push {r7, lr}
8000152: af00 add r7, sp, #0
rcc_clock_setup_in_hse_8mhz_out_72mhz();
8000154: f001 f90e bl 8001374 <rcc_clock_setup_in_hse_8mhz_out_72mhz>
rcc_periph_clock_enable(RCC_GPIOC);
8000158: f44f 7041 mov.w r0, #772 ; 0x304
800015c: f001 f950 bl 8001400 <rcc_periph_clock_enable>
rcc_periph_clock_enable(RCC_USB);
8000160: f240 3097 movw r0, #919 ; 0x397
8000164: f001 f94c bl 8001400 <rcc_periph_clock_enable>
// GPIOA, AFIO clocks are handled by st_init();
}
8000168: bf00 nop
800016a: bd80 pop {r7, pc}
0800016c <main>:
int main(void)
{
800016c: b580 push {r7, lr}
800016e: b082 sub sp, #8
8000170: af02 add r7, sp, #8
/* Hardware config starts */
clock_setup();
8000172: f7ff ffed bl 8000150 <clock_setup>
systick_init();
8000176: f000 ffe9 bl 800114c <systick_init>
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
800017a: f44f 5300 mov.w r3, #8192 ; 0x2000
800017e: 2200 movs r2, #0
8000180: 2101 movs r1, #1
8000182: 4812 ldr r0, [pc, #72] ; (80001cc <main+0x60>)
8000184: f001 f80a bl 800119c <gpio_set_mode>
gpio_clear(GPIOC, GPIO13);
8000188: f44f 5100 mov.w r1, #8192 ; 0x2000
800018c: 480f ldr r0, [pc, #60] ; (80001cc <main+0x60>)
800018e: f001 f836 bl 80011fe <gpio_clear>
/* Hardware config ends */
//----------------------------------------------------------
st_init();
8000192: f000 fd35 bl 8000c00 <st_init>
//rotating display to potrait mode
//st_rotate_display(1);
// Filling the display with some color
st_fill_screen(ST_COLOR_NAVY);
8000196: 200f movs r0, #15
8000198: f000 fcc0 bl 8000b1c <st_fill_screen>
st_draw_string_withbg(10, 200, "Tiny Monitor v1.0", ST_COLOR_CYAN, ST_COLOR_BLACK, &font_fixedsys_mono_24);
800019c: 4b0c ldr r3, [pc, #48] ; (80001d0 <main+0x64>)
800019e: 9301 str r3, [sp, #4]
80001a0: 2300 movs r3, #0
80001a2: 9300 str r3, [sp, #0]
80001a4: f240 73ff movw r3, #2047 ; 0x7ff
80001a8: 4a0a ldr r2, [pc, #40] ; (80001d4 <main+0x68>)
80001aa: 21c8 movs r1, #200 ; 0xc8
80001ac: 200a movs r0, #10
80001ae: f000 fb83 bl 80008b8 <st_draw_string_withbg>
st_draw_string(10, 10, "Connect USB...", 0xffff, &font_fixedsys_mono_24);
80001b2: 4b07 ldr r3, [pc, #28] ; (80001d0 <main+0x64>)
80001b4: 9300 str r3, [sp, #0]
80001b6: f64f 73ff movw r3, #65535 ; 0xffff
80001ba: 4a07 ldr r2, [pc, #28] ; (80001d8 <main+0x6c>)
80001bc: 210a movs r1, #10
80001be: 200a movs r0, #10
80001c0: f000 fb5e bl 8000880 <st_draw_string>
// Init USB at the end so MCU can start sending data to display as soon as USB is present
usb_init();
80001c4: f000 f80a bl 80001dc <usb_init>
while (1)
80001c8: e7fe b.n 80001c8 <main+0x5c>
80001ca: bf00 nop
80001cc: 40011000 .word 0x40011000
80001d0: 08003d34 .word 0x08003d34
80001d4: 08003d3c .word 0x08003d3c
80001d8: 08003d50 .word 0x08003d50
080001dc <usb_init>:
return 0;
}
void usb_init()
{
80001dc: b580 push {r7, lr}
80001de: b084 sub sp, #16
80001e0: af04 add r7, sp, #16
// reset USB peripheral
rcc_periph_reset_pulse(RST_USB);
80001e2: f240 2017 movw r0, #535 ; 0x217
80001e6: f001 f919 bl 800141c <rcc_periph_reset_pulse>
// Pull USB D+ (A12) low for 80ms to trigger device reenumeration
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO12);
80001ea: f44f 5380 mov.w r3, #4096 ; 0x1000
80001ee: 2200 movs r2, #0
80001f0: 2101 movs r1, #1
80001f2: 4816 ldr r0, [pc, #88] ; (800024c <usb_init+0x70>)
80001f4: f000 ffd2 bl 800119c <gpio_set_mode>
gpio_clear(GPIOA, GPIO12);
80001f8: f44f 5180 mov.w r1, #4096 ; 0x1000
80001fc: 4813 ldr r0, [pc, #76] ; (800024c <usb_init+0x70>)
80001fe: f000 fffe bl 80011fe <gpio_clear>
delay(80);
8000202: 2050 movs r0, #80 ; 0x50
8000204: f000 ff88 bl 8001118 <delay>
usb_init_serial_num();
8000208: f000 ff36 bl 8001078 <usb_init_serial_num>
// create USB device
usb_device = usbd_init(&st_usbfs_v1_usb_driver, &usb_device_desc, usb_config_descs,
800020c: f44f 7380 mov.w r3, #256 ; 0x100
8000210: 9302 str r3, [sp, #8]
8000212: 4b0f ldr r3, [pc, #60] ; (8000250 <usb_init+0x74>)
8000214: 9301 str r3, [sp, #4]
8000216: 2304 movs r3, #4
8000218: 9300 str r3, [sp, #0]
800021a: 4b0e ldr r3, [pc, #56] ; (8000254 <usb_init+0x78>)
800021c: 4a0e ldr r2, [pc, #56] ; (8000258 <usb_init+0x7c>)
800021e: 490f ldr r1, [pc, #60] ; (800025c <usb_init+0x80>)
8000220: 480f ldr r0, [pc, #60] ; (8000260 <usb_init+0x84>)
8000222: f001 f951 bl 80014c8 <usbd_init>
8000226: 4603 mov r3, r0
8000228: 4a0e ldr r2, [pc, #56] ; (8000264 <usb_init+0x88>)
800022a: 6013 str r3, [r2, #0]
usb_desc_strings, sizeof(usb_desc_strings) / sizeof(usb_desc_strings[0]),
usbd_control_buffer, sizeof(usbd_control_buffer));
// Set callback for config calls
usbd_register_set_config_callback(usb_device, usb_set_config);
800022c: 4b0d ldr r3, [pc, #52] ; (8000264 <usb_init+0x88>)
800022e: 681b ldr r3, [r3, #0]
8000230: 490d ldr r1, [pc, #52] ; (8000268 <usb_init+0x8c>)
8000232: 4618 mov r0, r3
8000234: f001 fd3e bl 8001cb4 <usbd_register_set_config_callback>
//register_wcid_desc(usb_device);
// Enable interrupt
nvic_set_priority(NVIC_USB_LP_CAN_RX0_IRQ, 2 << 6);
8000238: 2180 movs r1, #128 ; 0x80
800023a: 2014 movs r0, #20
800023c: f001 fe2c bl 8001e98 <nvic_set_priority>
nvic_enable_irq(NVIC_USB_LP_CAN_RX0_IRQ);
8000240: 2014 movs r0, #20
8000242: f001 fe1b bl 8001e7c <nvic_enable_irq>
}
8000246: bf00 nop
8000248: 46bd mov sp, r7
800024a: bd80 pop {r7, pc}
800024c: 40010800 .word 0x40010800
8000250: 20000014 .word 0x20000014
8000254: 08003dc8 .word 0x08003dc8
8000258: 08003e20 .word 0x08003e20
800025c: 08003e30 .word 0x08003e30
8000260: 08003e58 .word 0x08003e58
8000264: 20000010 .word 0x20000010
8000268: 0800026d .word 0x0800026d
0800026c <usb_set_config>:
// Called when the host connects to the device and selects a configuration
void usb_set_config(usbd_device *usbd_dev, __attribute__((unused)) uint16_t wValue)
{
800026c: b580 push {r7, lr}
800026e: b084 sub sp, #16
8000270: af02 add r7, sp, #8
8000272: 6078 str r0, [r7, #4]
8000274: 460b mov r3, r1
8000276: 807b strh r3, [r7, #2]
usbd_ep_setup(usbd_dev, EP_DATA_OUT, USB_ENDPOINT_ATTR_BULK, BULK_MAX_PACKET_SIZE, usb_data_received);
8000278: 4b11 ldr r3, [pc, #68] ; (80002c0 <usb_set_config+0x54>)
800027a: 9300 str r3, [sp, #0]
800027c: 2340 movs r3, #64 ; 0x40
800027e: 2202 movs r2, #2
8000280: 2101 movs r1, #1
8000282: 6878 ldr r0, [r7, #4]
8000284: f001 f94c bl 8001520 <usbd_ep_setup>
usbd_ep_setup(usbd_dev, 0x82, USB_ENDPOINT_ATTR_ISOCHRONOUS, BULK_MAX_PACKET_SIZE, nullptr);
8000288: 2300 movs r3, #0
800028a: 9300 str r3, [sp, #0]
800028c: 2340 movs r3, #64 ; 0x40
800028e: 2201 movs r2, #1
8000290: 2182 movs r1, #130 ; 0x82
8000292: 6878 ldr r0, [r7, #4]
8000294: f001 f944 bl 8001520 <usbd_ep_setup>
usbd_register_control_callback(usb_device,
8000298: 4b0a ldr r3, [pc, #40] ; (80002c4 <usb_set_config+0x58>)
800029a: 6818 ldr r0, [r3, #0]
800029c: 4b0a ldr r3, [pc, #40] ; (80002c8 <usb_set_config+0x5c>)
800029e: 227f movs r2, #127 ; 0x7f
80002a0: 2141 movs r1, #65 ; 0x41
80002a2: f001 fa2b bl 80016fc <usbd_register_control_callback>
USB_REQ_TYPE_VENDOR | USB_REQ_TYPE_INTERFACE,
USB_REQ_TYPE_TYPE | USB_REQ_TYPE_RECIPIENT,
prepare_to_receive_stream);
st_draw_string(10, 40, "USB connected. Config is set...", 0xffff, &font_fixedsys_mono_24);
80002a6: 4b09 ldr r3, [pc, #36] ; (80002cc <usb_set_config+0x60>)
80002a8: 9300 str r3, [sp, #0]
80002aa: f64f 73ff movw r3, #65535 ; 0xffff
80002ae: 4a08 ldr r2, [pc, #32] ; (80002d0 <usb_set_config+0x64>)
80002b0: 2128 movs r1, #40 ; 0x28
80002b2: 200a movs r0, #10
80002b4: f000 fae4 bl 8000880 <st_draw_string>
}
80002b8: bf00 nop
80002ba: 3708 adds r7, #8
80002bc: 46bd mov sp, r7
80002be: bd80 pop {r7, pc}
80002c0: 08000345 .word 0x08000345
80002c4: 20000010 .word 0x20000010
80002c8: 080002d5 .word 0x080002d5
80002cc: 08003d34 .word 0x08003d34
80002d0: 08003d60 .word 0x08003d60
080002d4 <prepare_to_receive_stream>:
// Called when host sends control transfer.
// If host sends wValue=0x88 and bRequest=0x33, we'll prepare to receive streams
static enum usbd_request_return_codes prepare_to_receive_stream(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, usbd_control_complete_callback *complete)
{
80002d4: b580 push {r7, lr}
80002d6: b088 sub sp, #32
80002d8: af02 add r7, sp, #8
80002da: 60f8 str r0, [r7, #12]
80002dc: 60b9 str r1, [r7, #8]
80002de: 607a str r2, [r7, #4]
80002e0: 603b str r3, [r7, #0]
if (req->bRequest == 0x33 && req->wIndex == 0 && req->wValue == 0x88)
80002e2: 68bb ldr r3, [r7, #8]
80002e4: 785b ldrb r3, [r3, #1]
80002e6: 2b33 cmp r3, #51 ; 0x33
80002e8: d123 bne.n 8000332 <prepare_to_receive_stream+0x5e>
80002ea: 68bb ldr r3, [r7, #8]
80002ec: 889b ldrh r3, [r3, #4]
80002ee: b29b uxth r3, r3
80002f0: 2b00 cmp r3, #0
80002f2: d11e bne.n 8000332 <prepare_to_receive_stream+0x5e>
80002f4: 68bb ldr r3, [r7, #8]
80002f6: 885b ldrh r3, [r3, #2]
80002f8: b29b uxth r3, r3
80002fa: 2b88 cmp r3, #136 ; 0x88
80002fc: d119 bne.n 8000332 <prepare_to_receive_stream+0x5e>
{
st_draw_string(10, 100, "Connected to host software...", 0xffff, &font_fixedsys_mono_24);
80002fe: 4b0f ldr r3, [pc, #60] ; (800033c <prepare_to_receive_stream+0x68>)
8000300: 9300 str r3, [sp, #0]
8000302: f64f 73ff movw r3, #65535 ; 0xffff
8000306: 4a0e ldr r2, [pc, #56] ; (8000340 <prepare_to_receive_stream+0x6c>)
8000308: 2164 movs r1, #100 ; 0x64
800030a: 200a movs r0, #10
800030c: f000 fab8 bl 8000880 <st_draw_string>
// after writing string, prepare the display for drawing
// Once we set the address window, we can fill the screen continuously without calling it again
st_set_address_window(0, 0, 239, 239);
8000310: 23ef movs r3, #239 ; 0xef
8000312: 22ef movs r2, #239 ; 0xef
8000314: 2100 movs r1, #0
8000316: 2000 movs r0, #0
8000318: f000 f83e bl 8000398 <st_set_address_window>
uint8_t ack_buff[1] = {0xAA}; //0xAA is the magic number that the python script is expecting
800031c: 23aa movs r3, #170 ; 0xaa
800031e: 753b strb r3, [r7, #20]
// Send host 0xAA to let know that we're ready
usbd_ep_write_packet(usbd_dev, 0x82, ack_buff, 1);
8000320: f107 0214 add.w r2, r7, #20
8000324: 2301 movs r3, #1
8000326: 2182 movs r1, #130 ; 0x82
8000328: 68f8 ldr r0, [r7, #12]
800032a: f001 f919 bl 8001560 <usbd_ep_write_packet>
return USBD_REQ_HANDLED;
800032e: 2301 movs r3, #1
8000330: e000 b.n 8000334 <prepare_to_receive_stream+0x60>
}
return USBD_REQ_NEXT_CALLBACK;
8000332: 2302 movs r3, #2
}
8000334: 4618 mov r0, r3
8000336: 3718 adds r7, #24
8000338: 46bd mov sp, r7
800033a: bd80 pop {r7, pc}
800033c: 08003d34 .word 0x08003d34
8000340: 08003d80 .word 0x08003d80
08000344 <usb_data_received>:
// Called when data has been received
void usb_data_received(__attribute__((unused)) usbd_device *usbd_dev, __attribute__((unused)) uint8_t ep)
{
8000344: b580 push {r7, lr}
8000346: b094 sub sp, #80 ; 0x50
8000348: af00 add r7, sp, #0
800034a: 6078 str r0, [r7, #4]
800034c: 460b mov r3, r1
800034e: 70fb strb r3, [r7, #3]
// Retrieve USB data (has side effect of setting endpoint to VALID)
uint8_t packet[BULK_MAX_PACKET_SIZE] __attribute__((aligned(4)));
int len = usbd_ep_read_packet(usb_device, EP_DATA_OUT, packet, sizeof(packet));
8000350: 4b0a ldr r3, [pc, #40] ; (800037c <usb_data_received+0x38>)
8000352: 6818 ldr r0, [r3, #0]
8000354: f107 020c add.w r2, r7, #12
8000358: 2340 movs r3, #64 ; 0x40
800035a: 2101 movs r1, #1
800035c: f001 f907 bl 800156e <usbd_ep_read_packet>
8000360: 4603 mov r3, r0
8000362: 64fb str r3, [r7, #76] ; 0x4c
st_fill_color_array(packet, len);
8000364: 6cfa ldr r2, [r7, #76] ; 0x4c
8000366: f107 030c add.w r3, r7, #12
800036a: 4611 mov r1, r2
800036c: 4618 mov r0, r3
800036e: f000 fb71 bl 8000a54 <st_fill_color_array>
// GPIOC_ODR ^= GPIO13;
//usbd_ep_nak_set(usbd_dev, EP_DATA_OUT, 1);
//usbd_ep_nak_set(usbd_dev, EP_DATA_OUT, 0);
}
8000372: bf00 nop
8000374: 3750 adds r7, #80 ; 0x50
8000376: 46bd mov sp, r7
8000378: bd80 pop {r7, pc}
800037a: bf00 nop
800037c: 20000010 .word 0x20000010
08000380 <usb_lp_can_rx0_isr>:
// USB interrupt handler
void usb_lp_can_rx0_isr()
{
8000380: b580 push {r7, lr}
8000382: af00 add r7, sp, #0
usbd_poll(usb_device);
8000384: 4b03 ldr r3, [pc, #12] ; (8000394 <usb_lp_can_rx0_isr+0x14>)
8000386: 681b ldr r3, [r3, #0]
8000388: 4618 mov r0, r3
800038a: f001 f8c5 bl 8001518 <usbd_poll>
/* GPIOC_ODR ^= GPIO13; */
800038e: bf00 nop
8000390: bd80 pop {r7, pc}
8000392: bf00 nop
8000394: 20000010 .word 0x20000010
08000398 <st_set_address_window>:
* @param y1 start row address.
* @param x2 end column address.
* @param y2 end row address.
*/
void st_set_address_window(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
{
8000398: b490 push {r4, r7}
800039a: b084 sub sp, #16
800039c: af00 add r7, sp, #0
800039e: 4604 mov r4, r0
80003a0: 4608 mov r0, r1
80003a2: 4611 mov r1, r2
80003a4: 461a mov r2, r3
80003a6: 4623 mov r3, r4
80003a8: 80fb strh r3, [r7, #6]
80003aa: 4603 mov r3, r0
80003ac: 80bb strh r3, [r7, #4]
80003ae: 460b mov r3, r1
80003b0: 807b strh r3, [r7, #2]
80003b2: 4613 mov r3, r2
80003b4: 803b strh r3, [r7, #0]
80003b6: 232a movs r3, #42 ; 0x2a
80003b8: 737b strb r3, [r7, #13]
__attribute__((always_inline)) static inline void _st_write_command_8bit(uint8_t cmd)
{
#ifdef ST_RELEASE_WHEN_IDLE
CS_ACTIVE;
#endif
ST_DC_CMD;
80003ba: 4b82 ldr r3, [pc, #520] ; (80005c4 <st_set_address_window+0x22c>)
80003bc: 2204 movs r2, #4
80003be: 801a strh r2, [r3, #0]
ST_WRITE_8BIT(cmd);
80003c0: 4a81 ldr r2, [pc, #516] ; (80005c8 <st_set_address_window+0x230>)
80003c2: 7b7b ldrb r3, [r7, #13]
80003c4: 6013 str r3, [r2, #0]
80003c6: bf00 nop
80003c8: bf00 nop
80003ca: bf00 nop
80003cc: bf00 nop
80003ce: bf00 nop
80003d0: bf00 nop
80003d2: bf00 nop
80003d4: bf00 nop
80003d6: bf00 nop
80003d8: bf00 nop
80003da: bf00 nop
80003dc: bf00 nop
80003de: bf00 nop
80003e0: bf00 nop
80003e2: bf00 nop
80003e4: bf00 nop
80003e6: bf00 nop
80003e8: bf00 nop
80003ea: bf00 nop
80003ec: bf00 nop
#ifdef ST_RELEASE_WHEN_IDLE
CS_IDLE;
#endif
}
80003ee: bf00 nop
_st_write_command_8bit(ST7789_CASET);
#ifdef ST_RELEASE_WHEN_IDLE
ST_CS_ACTIVE;
#endif
ST_DC_DAT;
80003f0: 4b76 ldr r3, [pc, #472] ; (80005cc <st_set_address_window+0x234>)
80003f2: 2204 movs r2, #4
80003f4: 601a str r2, [r3, #0]
ST_WRITE_8BIT((uint8_t)(x1 >> 8));
80003f6: 88fb ldrh r3, [r7, #6]
80003f8: 0a1b lsrs r3, r3, #8
80003fa: b29b uxth r3, r3
80003fc: b2da uxtb r2, r3
80003fe: 4b72 ldr r3, [pc, #456] ; (80005c8 <st_set_address_window+0x230>)
8000400: 601a str r2, [r3, #0]
8000402: bf00 nop
8000404: bf00 nop
8000406: bf00 nop
8000408: bf00 nop
800040a: bf00 nop
800040c: bf00 nop
800040e: bf00 nop
8000410: bf00 nop
8000412: bf00 nop
8000414: bf00 nop
8000416: bf00 nop
8000418: bf00 nop
800041a: bf00 nop
800041c: bf00 nop
800041e: bf00 nop
8000420: bf00 nop
8000422: bf00 nop
8000424: bf00 nop
8000426: bf00 nop
8000428: bf00 nop
ST_WRITE_8BIT((uint8_t)x1);
800042a: 88fb ldrh r3, [r7, #6]
800042c: b2da uxtb r2, r3
800042e: 4b66 ldr r3, [pc, #408] ; (80005c8 <st_set_address_window+0x230>)
8000430: 601a str r2, [r3, #0]
8000432: bf00 nop
8000434: bf00 nop
8000436: bf00 nop
8000438: bf00 nop
800043a: bf00 nop
800043c: bf00 nop
800043e: bf00 nop
8000440: bf00 nop
8000442: bf00 nop
8000444: bf00 nop
8000446: bf00 nop
8000448: bf00 nop
800044a: bf00 nop
800044c: bf00 nop
800044e: bf00 nop
8000450: bf00 nop
8000452: bf00 nop
8000454: bf00 nop
8000456: bf00 nop
8000458: bf00 nop
ST_WRITE_8BIT((uint8_t)(x2 >> 8));
800045a: 887b ldrh r3, [r7, #2]
800045c: 0a1b lsrs r3, r3, #8
800045e: b29b uxth r3, r3
8000460: b2da uxtb r2, r3
8000462: 4b59 ldr r3, [pc, #356] ; (80005c8 <st_set_address_window+0x230>)
8000464: 601a str r2, [r3, #0]
8000466: bf00 nop
8000468: bf00 nop
800046a: bf00 nop
800046c: bf00 nop
800046e: bf00 nop
8000470: bf00 nop
8000472: bf00 nop
8000474: bf00 nop
8000476: bf00 nop
8000478: bf00 nop
800047a: bf00 nop
800047c: bf00 nop
800047e: bf00 nop
8000480: bf00 nop
8000482: bf00 nop
8000484: bf00 nop
8000486: bf00 nop
8000488: bf00 nop
800048a: bf00 nop
800048c: bf00 nop
ST_WRITE_8BIT((uint8_t)x2);
800048e: 887b ldrh r3, [r7, #2]
8000490: b2da uxtb r2, r3
8000492: 4b4d ldr r3, [pc, #308] ; (80005c8 <st_set_address_window+0x230>)
8000494: 601a str r2, [r3, #0]
8000496: bf00 nop
8000498: bf00 nop
800049a: bf00 nop
800049c: bf00 nop
800049e: bf00 nop
80004a0: bf00 nop
80004a2: bf00 nop
80004a4: bf00 nop
80004a6: bf00 nop
80004a8: bf00 nop
80004aa: bf00 nop
80004ac: bf00 nop
80004ae: bf00 nop
80004b0: bf00 nop
80004b2: bf00 nop
80004b4: bf00 nop
80004b6: bf00 nop
80004b8: bf00 nop
80004ba: bf00 nop
80004bc: bf00 nop
80004be: 232b movs r3, #43 ; 0x2b
80004c0: 73bb strb r3, [r7, #14]
ST_DC_CMD;
80004c2: 4b40 ldr r3, [pc, #256] ; (80005c4 <st_set_address_window+0x22c>)
80004c4: 2204 movs r2, #4
80004c6: 801a strh r2, [r3, #0]
ST_WRITE_8BIT(cmd);
80004c8: 4a3f ldr r2, [pc, #252] ; (80005c8 <st_set_address_window+0x230>)
80004ca: 7bbb ldrb r3, [r7, #14]
80004cc: 6013 str r3, [r2, #0]
80004ce: bf00 nop
80004d0: bf00 nop
80004d2: bf00 nop
80004d4: bf00 nop
80004d6: bf00 nop
80004d8: bf00 nop
80004da: bf00 nop
80004dc: bf00 nop
80004de: bf00 nop
80004e0: bf00 nop
80004e2: bf00 nop
80004e4: bf00 nop
80004e6: bf00 nop
80004e8: bf00 nop
80004ea: bf00 nop
80004ec: bf00 nop
80004ee: bf00 nop
80004f0: bf00 nop
80004f2: bf00 nop
80004f4: bf00 nop
}
80004f6: bf00 nop
_st_write_command_8bit(ST7789_RASET);
#ifdef ST_RELEASE_WHEN_IDLE
ST_CS_ACTIVE;
#endif
ST_DC_DAT;
80004f8: 4b34 ldr r3, [pc, #208] ; (80005cc <st_set_address_window+0x234>)
80004fa: 2204 movs r2, #4
80004fc: 601a str r2, [r3, #0]
ST_WRITE_8BIT((uint8_t)(y1 >> 8));
80004fe: 88bb ldrh r3, [r7, #4]
8000500: 0a1b lsrs r3, r3, #8
8000502: b29b uxth r3, r3
8000504: b2da uxtb r2, r3
8000506: 4b30 ldr r3, [pc, #192] ; (80005c8 <st_set_address_window+0x230>)
8000508: 601a str r2, [r3, #0]
800050a: bf00 nop
800050c: bf00 nop
800050e: bf00 nop
8000510: bf00 nop
8000512: bf00 nop
8000514: bf00 nop
8000516: bf00 nop
8000518: bf00 nop
800051a: bf00 nop
800051c: bf00 nop
800051e: bf00 nop
8000520: bf00 nop
8000522: bf00 nop
8000524: bf00 nop
8000526: bf00 nop
8000528: bf00 nop
800052a: bf00 nop
800052c: bf00 nop
800052e: bf00 nop
8000530: bf00 nop
ST_WRITE_8BIT((uint8_t)y1);
8000532: 88bb ldrh r3, [r7, #4]
8000534: b2da uxtb r2, r3
8000536: 4b24 ldr r3, [pc, #144] ; (80005c8 <st_set_address_window+0x230>)
8000538: 601a str r2, [r3, #0]
800053a: bf00 nop
800053c: bf00 nop
800053e: bf00 nop
8000540: bf00 nop
8000542: bf00 nop
8000544: bf00 nop
8000546: bf00 nop
8000548: bf00 nop
800054a: bf00 nop
800054c: bf00 nop
800054e: bf00 nop
8000550: bf00 nop
8000552: bf00 nop
8000554: bf00 nop
8000556: bf00 nop
8000558: bf00 nop
800055a: bf00 nop
800055c: bf00 nop
800055e: bf00 nop
8000560: bf00 nop
ST_WRITE_8BIT((uint8_t)(y2 >> 8));
8000562: 883b ldrh r3, [r7, #0]
8000564: 0a1b lsrs r3, r3, #8
8000566: b29b uxth r3, r3
8000568: b2da uxtb r2, r3
800056a: 4b17 ldr r3, [pc, #92] ; (80005c8 <st_set_address_window+0x230>)
800056c: 601a str r2, [r3, #0]
800056e: bf00 nop
8000570: bf00 nop
8000572: bf00 nop
8000574: bf00 nop
8000576: bf00 nop
8000578: bf00 nop
800057a: bf00 nop
800057c: bf00 nop
800057e: bf00 nop
8000580: bf00 nop
8000582: bf00 nop
8000584: bf00 nop
8000586: bf00 nop
8000588: bf00 nop
800058a: bf00 nop
800058c: bf00 nop
800058e: bf00 nop
8000590: bf00 nop
8000592: bf00 nop
8000594: bf00 nop
ST_WRITE_8BIT((uint8_t)y2);
8000596: 883b ldrh r3, [r7, #0]
8000598: b2da uxtb r2, r3
800059a: 4b0b ldr r3, [pc, #44] ; (80005c8 <st_set_address_window+0x230>)
800059c: 601a str r2, [r3, #0]
800059e: bf00 nop
80005a0: bf00 nop
80005a2: bf00 nop
80005a4: bf00 nop
80005a6: bf00 nop
80005a8: bf00 nop
80005aa: bf00 nop
80005ac: bf00 nop
80005ae: bf00 nop
80005b0: bf00 nop
80005b2: bf00 nop
80005b4: bf00 nop
80005b6: bf00 nop
80005b8: bf00 nop
80005ba: bf00 nop
80005bc: bf00 nop
80005be: bf00 nop
80005c0: bf00 nop
80005c2: e005 b.n 80005d0 <st_set_address_window+0x238>
80005c4: 40010814 .word 0x40010814
80005c8: 4001300c .word 0x4001300c
80005cc: 40010810 .word 0x40010810
80005d0: bf00 nop
80005d2: bf00 nop
80005d4: 232c movs r3, #44 ; 0x2c
80005d6: 73fb strb r3, [r7, #15]
ST_DC_CMD;
80005d8: 4b0f ldr r3, [pc, #60] ; (8000618 <st_set_address_window+0x280>)
80005da: 2204 movs r2, #4
80005dc: 801a strh r2, [r3, #0]
ST_WRITE_8BIT(cmd);
80005de: 4a0f ldr r2, [pc, #60] ; (800061c <st_set_address_window+0x284>)
80005e0: 7bfb ldrb r3, [r7, #15]
80005e2: 6013 str r3, [r2, #0]
80005e4: bf00 nop
80005e6: bf00 nop
80005e8: bf00 nop
80005ea: bf00 nop
80005ec: bf00 nop
80005ee: bf00 nop
80005f0: bf00 nop
80005f2: bf00 nop
80005f4: bf00 nop
80005f6: bf00 nop
80005f8: bf00 nop
80005fa: bf00 nop
80005fc: bf00 nop
80005fe: bf00 nop
8000600: bf00 nop
8000602: bf00 nop
8000604: bf00 nop
8000606: bf00 nop
8000608: bf00 nop
800060a: bf00 nop
}
800060c: bf00 nop
_st_write_command_8bit(ST7789_RAMWR);
}
800060e: bf00 nop
8000610: 3710 adds r7, #16
8000612: 46bd mov sp, r7
8000614: bc90 pop {r4, r7}
8000616: 4770 bx lr
8000618: 40010814 .word 0x40010814
800061c: 4001300c .word 0x4001300c
08000620 <_st_render_glyph>:
/*
* Render a character glyph on the display. Called by `_st_draw_string_main()`
* User need NOT call it
*/
void _st_render_glyph(uint16_t x, uint16_t y, uint16_t fore_color, uint16_t back_color, const tImage *glyph, uint8_t is_bg)
{
8000620: b590 push {r4, r7, lr}
8000622: b08b sub sp, #44 ; 0x2c
8000624: af00 add r7, sp, #0
8000626: 4604 mov r4, r0
8000628: 4608 mov r0, r1
800062a: 4611 mov r1, r2
800062c: 461a mov r2, r3
800062e: 4623 mov r3, r4
8000630: 80fb strh r3, [r7, #6]
8000632: 4603 mov r3, r0
8000634: 80bb strh r3, [r7, #4]
8000636: 460b mov r3, r1
8000638: 807b strh r3, [r7, #2]
800063a: 4613 mov r3, r2
800063c: 803b strh r3, [r7, #0]
uint16_t width = 0, height = 0;
800063e: 2300 movs r3, #0
8000640: 81fb strh r3, [r7, #14]
8000642: 2300 movs r3, #0
8000644: 81bb strh r3, [r7, #12]
width = glyph->width;
8000646: 6bbb ldr r3, [r7, #56] ; 0x38
8000648: 889b ldrh r3, [r3, #4]
800064a: 81fb strh r3, [r7, #14]
height = glyph->height;
800064c: 6bbb ldr r3, [r7, #56] ; 0x38
800064e: 88db ldrh r3, [r3, #6]
8000650: 81bb strh r3, [r7, #12]
uint16_t temp_x = x;
8000652: 88fb ldrh r3, [r7, #6]
8000654: 84fb strh r3, [r7, #38] ; 0x26
uint16_t temp_y = y;
8000656: 88bb ldrh r3, [r7, #4]
8000658: 84bb strh r3, [r7, #36] ; 0x24
uint8_t mask = 0x80;
800065a: 2380 movs r3, #128 ; 0x80
800065c: 72fb strb r3, [r7, #11]
uint8_t bit_counter = 0;
800065e: 2300 movs r3, #0
8000660: f887 3023 strb.w r3, [r7, #35] ; 0x23
const uint8_t *glyph_data_ptr = (const uint8_t *)(glyph->data);
8000664: 6bbb ldr r3, [r7, #56] ; 0x38
8000666: 681b ldr r3, [r3, #0]
8000668: 61fb str r3, [r7, #28]
uint8_t glyph_data = 0;
800066a: 2300 movs r3, #0
800066c: 76fb strb r3, [r7, #27]
// font bitmaps are stored in column major order (scanned from left-to-right, not the conventional top-to-bottom)
// as font glyphs have heigher height than width, this scanning saves some storage.
// So, we also render in left-to-right manner.
// Along x axis (width)
for (int i = 0; i < width; i++)
800066e: 2300 movs r3, #0
8000670: 617b str r3, [r7, #20]
8000672: e043 b.n 80006fc <_st_render_glyph+0xdc>
{
// Along y axis (height)
for (int j = 0; j < height; j++)
8000674: 2300 movs r3, #0
8000676: 613b str r3, [r7, #16]
8000678: e031 b.n 80006de <_st_render_glyph+0xbe>
{
// load new data only when previous byte (or word, depends on glyph->dataSize) is completely traversed by the mask
// bit_counter = 0 means glyph_data is completely traversed by the mask
if (bit_counter == 0)
800067a: f897 3023 ldrb.w r3, [r7, #35] ; 0x23
800067e: 2b00 cmp r3, #0
8000680: d108 bne.n 8000694 <_st_render_glyph+0x74>
{
glyph_data = *glyph_data_ptr++;
8000682: 69fb ldr r3, [r7, #28]
8000684: 1c5a adds r2, r3, #1
8000686: 61fa str r2, [r7, #28]
8000688: 781b ldrb r3, [r3, #0]
800068a: 76fb strb r3, [r7, #27]
bit_counter = glyph->dataSize;
800068c: 6bbb ldr r3, [r7, #56] ; 0x38
800068e: 7a1b ldrb r3, [r3, #8]
8000690: f887 3023 strb.w r3, [r7, #35] ; 0x23
}
// Decrement bit counter
bit_counter--;
8000694: f897 3023 ldrb.w r3, [r7, #35] ; 0x23
8000698: 3b01 subs r3, #1
800069a: f887 3023 strb.w r3, [r7, #35] ; 0x23
//If pixel is blank
if (glyph_data & mask)
800069e: 7efa ldrb r2, [r7, #27]
80006a0: 7afb ldrb r3, [r7, #11]
80006a2: 4013 ands r3, r2
80006a4: b2db uxtb r3, r3
80006a6: 2b00 cmp r3, #0
80006a8: d00a beq.n 80006c0 <_st_render_glyph+0xa0>
{
//Has background color (not transparent bg)
if (is_bg)
80006aa: f897 303c ldrb.w r3, [r7, #60] ; 0x3c
80006ae: 2b00 cmp r3, #0
80006b0: d00c beq.n 80006cc <_st_render_glyph+0xac>
{
st_draw_pixel(temp_x, temp_y, back_color);
80006b2: 883a ldrh r2, [r7, #0]
80006b4: 8cb9 ldrh r1, [r7, #36] ; 0x24
80006b6: 8cfb ldrh r3, [r7, #38] ; 0x26
80006b8: 4618 mov r0, r3
80006ba: f000 fa55 bl 8000b68 <st_draw_pixel>
80006be: e005 b.n 80006cc <_st_render_glyph+0xac>
}
//if pixel is not blank
else
{
st_draw_pixel(temp_x, temp_y, fore_color);
80006c0: 887a ldrh r2, [r7, #2]
80006c2: 8cb9 ldrh r1, [r7, #36] ; 0x24
80006c4: 8cfb ldrh r3, [r7, #38] ; 0x26
80006c6: 4618 mov r0, r3
80006c8: f000 fa4e bl 8000b68 <st_draw_pixel>
}
glyph_data <<= 1;
80006cc: 7efb ldrb r3, [r7, #27]
80006ce: 005b lsls r3, r3, #1
80006d0: 76fb strb r3, [r7, #27]
temp_y++;
80006d2: 8cbb ldrh r3, [r7, #36] ; 0x24
80006d4: 3301 adds r3, #1
80006d6: 84bb strh r3, [r7, #36] ; 0x24
for (int j = 0; j < height; j++)
80006d8: 693b ldr r3, [r7, #16]
80006da: 3301 adds r3, #1
80006dc: 613b str r3, [r7, #16]
80006de: 89bb ldrh r3, [r7, #12]
80006e0: 693a ldr r2, [r7, #16]
80006e2: 429a cmp r2, r3
80006e4: dbc9 blt.n 800067a <_st_render_glyph+0x5a>
}
//New col starts. So, row is set to initial value and col is increased by one
temp_y = y;
80006e6: 88bb ldrh r3, [r7, #4]
80006e8: 84bb strh r3, [r7, #36] ; 0x24
temp_x++;
80006ea: 8cfb ldrh r3, [r7, #38] ; 0x26
80006ec: 3301 adds r3, #1
80006ee: 84fb strh r3, [r7, #38] ; 0x26
//Reset the bit counter cause we're moving to next column, so we start with a new byte
bit_counter = 0;
80006f0: 2300 movs r3, #0
80006f2: f887 3023 strb.w r3, [r7, #35] ; 0x23
for (int i = 0; i < width; i++)
80006f6: 697b ldr r3, [r7, #20]
80006f8: 3301 adds r3, #1
80006fa: 617b str r3, [r7, #20]
80006fc: 89fb ldrh r3, [r7, #14]
80006fe: 697a ldr r2, [r7, #20]
8000700: 429a cmp r2, r3
8000702: dbb7 blt.n 8000674 <_st_render_glyph+0x54>
}
}
8000704: bf00 nop
8000706: bf00 nop
8000708: 372c adds r7, #44 ; 0x2c
800070a: 46bd mov sp, r7
800070c: bd90 pop {r4, r7, pc}
...
08000710 <_st_draw_string_main>:
* is_bg=1 : Text will habe background color, is_bg=0 : Text will have transparent background
* User need NOT call it.
*/
void _st_draw_string_main(uint16_t x, uint16_t y, char *str, uint16_t fore_color, uint16_t back_color, const tFont *font, uint8_t is_bg)
{
8000710: b590 push {r4, r7, lr}
8000712: b08b sub sp, #44 ; 0x2c
8000714: af02 add r7, sp, #8
8000716: 60ba str r2, [r7, #8]
8000718: 461a mov r2, r3
800071a: 4603 mov r3, r0
800071c: 81fb strh r3, [r7, #14]
800071e: 460b mov r3, r1
8000720: 81bb strh r3, [r7, #12]
8000722: 4613 mov r3, r2
8000724: 80fb strh r3, [r7, #6]
uint16_t x_temp = x;
8000726: 89fb ldrh r3, [r7, #14]
8000728: 83fb strh r3, [r7, #30]
uint16_t y_temp = y;
800072a: 89bb ldrh r3, [r7, #12]
800072c: 83bb strh r3, [r7, #28]
uint8_t x_padding = 0;
800072e: 2300 movs r3, #0
8000730: 75bb strb r3, [r7, #22]
uint8_t y_padding = 0;
8000732: 2300 movs r3, #0
8000734: 757b strb r3, [r7, #21]
const tImage *img = NULL;
8000736: 2300 movs r3, #0
8000738: 61bb str r3, [r7, #24]
uint16_t width = 0, height = 0;
800073a: 2300 movs r3, #0
800073c: 827b strh r3, [r7, #18]
800073e: 2300 movs r3, #0
8000740: 823b strh r3, [r7, #16]
while (*str)
8000742: e08d b.n 8000860 <_st_draw_string_main+0x150>
{
if (*str == '\n')
8000744: 68bb ldr r3, [r7, #8]
8000746: 781b ldrb r3, [r3, #0]
8000748: 2b0a cmp r3, #10
800074a: d10d bne.n 8000768 <_st_draw_string_main+0x58>
{
x_temp = x; //go to first col
800074c: 89fb ldrh r3, [r7, #14]
800074e: 83fb strh r3, [r7, #30]