595驱动

This commit is contained in:
2021-09-17 23:08:12 +08:00
parent 0058af14cd
commit 12016bd7bc
5 changed files with 415 additions and 177 deletions
+281 -95
View File
@@ -5,45 +5,45 @@ Sections:
Idx Name Size VMA LMA File off Algn
0 .isr_vector 000000c0 08000000 08000000 00010000 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 000017f0 080000c0 080000c0 000100c0 2**2
1 .text 0000192c 080000c0 080000c0 000100c0 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .rodata 00000030 080018b0 080018b0 000118b0 2**2
2 .rodata 00000030 080019ec 080019ec 000119ec 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .ARM.extab 00000000 080018e0 080018e0 0002000c 2**0
3 .ARM.extab 00000000 08001a1c 08001a1c 0002000c 2**0
CONTENTS
4 .ARM 00000000 080018e0 080018e0 0002000c 2**0
4 .ARM 00000000 08001a1c 08001a1c 0002000c 2**0
CONTENTS
5 .preinit_array 00000000 080018e0 080018e0 0002000c 2**0
5 .preinit_array 00000000 08001a1c 08001a1c 0002000c 2**0
CONTENTS, ALLOC, LOAD, DATA
6 .init_array 00000004 080018e0 080018e0 000118e0 2**2
6 .init_array 00000004 08001a1c 08001a1c 00011a1c 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .fini_array 00000004 080018e4 080018e4 000118e4 2**2
7 .fini_array 00000004 08001a20 08001a20 00011a20 2**2
CONTENTS, ALLOC, LOAD, DATA
8 .data 0000000c 20000000 080018e8 00020000 2**2
8 .data 0000000c 20000000 08001a24 00020000 2**2
CONTENTS, ALLOC, LOAD, DATA
9 .bss 00000060 2000000c 080018f4 0002000c 2**2
9 .bss 00000060 2000000c 08001a30 0002000c 2**2
ALLOC
10 ._user_heap_stack 00000604 2000006c 080018f4 0002006c 2**0
10 ._user_heap_stack 00000604 2000006c 08001a30 0002006c 2**0
ALLOC
11 .ARM.attributes 00000028 00000000 00000000 0002000c 2**0
CONTENTS, READONLY
12 .debug_info 00004405 00000000 00000000 00020034 2**0
12 .debug_info 00004534 00000000 00000000 00020034 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
13 .debug_abbrev 0000116e 00000000 00000000 00024439 2**0
13 .debug_abbrev 000011f1 00000000 00000000 00024568 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
14 .debug_aranges 00000480 00000000 00000000 000255a8 2**3
14 .debug_aranges 00000488 00000000 00000000 00025760 2**3
CONTENTS, READONLY, DEBUGGING, OCTETS
15 .debug_ranges 000003d8 00000000 00000000 00025a28 2**3
15 .debug_ranges 000003e0 00000000 00000000 00025be8 2**3
CONTENTS, READONLY, DEBUGGING, OCTETS
16 .debug_macro 0000e729 00000000 00000000 00025e00 2**0
16 .debug_macro 0000e747 00000000 00000000 00025fc8 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
17 .debug_line 0000625a 00000000 00000000 00034529 2**0
17 .debug_line 000062da 00000000 00000000 0003470f 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
18 .debug_str 00056381 00000000 00000000 0003a783 2**0
18 .debug_str 000564d2 00000000 00000000 0003a9e9 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
19 .comment 00000053 00000000 00000000 00090b04 2**0
19 .comment 00000053 00000000 00000000 00090ebb 2**0
CONTENTS, READONLY
20 .debug_frame 00000e24 00000000 00000000 00090b58 2**2
20 .debug_frame 00000e44 00000000 00000000 00090f10 2**2
CONTENTS, READONLY, DEBUGGING, OCTETS
Disassembly of section .text:
@@ -65,7 +65,7 @@ Disassembly of section .text:
80000da: bd10 pop {r4, pc}
80000dc: 2000000c .word 0x2000000c
80000e0: 00000000 .word 0x00000000
80000e4: 08001898 .word 0x08001898
80000e4: 080019d4 .word 0x080019d4
080000e8 <frame_dummy>:
80000e8: 4b04 ldr r3, [pc, #16] ; (80000fc <frame_dummy+0x14>)
@@ -80,7 +80,7 @@ Disassembly of section .text:
80000fa: 46c0 nop ; (mov r8, r8)
80000fc: 00000000 .word 0x00000000
8000100: 20000010 .word 0x20000010
8000104: 08001898 .word 0x08001898
8000104: 080019d4 .word 0x080019d4
08000108 <__udivsi3>:
8000108: 2200 movs r2, #0
@@ -261,7 +261,7 @@ int main(void)
8000230: f000 f854 bl 80002dc <MX_ADC_Init>
/* USER CODE BEGIN 2 */
mymain();
8000234: f001 fb00 bl 8001838 <mymain>
8000234: f001 fb78 bl 8001928 <mymain>
/* USER CODE END 2 */
/* Infinite loop */
@@ -286,14 +286,14 @@ void SystemClock_Config(void)
8000246: 2330 movs r3, #48 ; 0x30
8000248: 001a movs r2, r3
800024a: 2100 movs r1, #0
800024c: f001 fb1c bl 8001888 <memset>
800024c: f001 fbba bl 80019c4 <memset>
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
8000250: 003b movs r3, r7
8000252: 0018 movs r0, r3
8000254: 2310 movs r3, #16
8000256: 001a movs r2, r3
8000258: 2100 movs r1, #0
800025a: f001 fb15 bl 8001888 <memset>
800025a: f001 fbb3 bl 80019c4 <memset>
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
@@ -405,7 +405,7 @@ static void MX_ADC_Init(void)
80002e6: 230c movs r3, #12
80002e8: 001a movs r2, r3
80002ea: 2100 movs r1, #0
80002ec: f001 facc bl 8001888 <memset>
80002ec: f001 fb6a bl 80019c4 <memset>
/* USER CODE BEGIN ADC_Init 1 */
/* USER CODE END ADC_Init 1 */
@@ -537,7 +537,7 @@ static void MX_GPIO_Init(void)
80003a0: 2314 movs r3, #20
80003a2: 001a movs r2, r3
80003a4: 2100 movs r1, #0
80003a6: f001 fa6f bl 8001888 <memset>
80003a6: f001 fb0d bl 80019c4 <memset>
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOF_CLK_ENABLE();
@@ -767,7 +767,7 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
80004de: 2314 movs r3, #20
80004e0: 001a movs r2, r3
80004e2: 2100 movs r1, #0
80004e4: f001 f9d0 bl 8001888 <memset>
80004e4: f001 fa6e bl 80019c4 <memset>
if(hadc->Instance==ADC1)
80004e8: 687b ldr r3, [r7, #4]
80004ea: 681b ldr r3, [r3, #0]
@@ -1030,7 +1030,7 @@ LoopFillZerobss:
80005be: f7ff ffe4 bl 800058a <SystemInit>
/* Call static constructors */
bl __libc_init_array
80005c2: f001 f93d bl 8001840 <__libc_init_array>
80005c2: f001 f9db bl 800197c <__libc_init_array>
/* Call the application's entry point.*/
bl main
80005c6: f7ff fe2b bl 8000220 <main>
@@ -1047,7 +1047,7 @@ LoopForever:
ldr r1, =_edata
80005d4: 2000000c .word 0x2000000c
ldr r2, =_sidata
80005d8: 080018e8 .word 0x080018e8
80005d8: 08001a24 .word 0x08001a24
ldr r2, =_sbss
80005dc: 2000000c .word 0x2000000c
ldr r4, =_ebss
@@ -4312,7 +4312,7 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, ui
800175c: 40021000 .word 0x40021000
8001760: 00001388 .word 0x00001388
8001764: fffff8ff .word 0xfffff8ff
8001768: 080018d0 .word 0x080018d0
8001768: 08001a0c .word 0x08001a0c
800176c: 20000000 .word 0x20000000
08001770 <HAL_RCC_GetSysClockFreq>:
@@ -4460,80 +4460,266 @@ uint32_t HAL_RCC_GetSysClockFreq(void)
8001822: b00f add sp, #60 ; 0x3c
8001824: bd90 pop {r4, r7, pc}
8001826: 46c0 nop ; (mov r8, r8)
8001828: 080018b0 .word 0x080018b0
800182c: 080018c0 .word 0x080018c0
8001828: 080019ec .word 0x080019ec
800182c: 080019fc .word 0x080019fc
8001830: 40021000 .word 0x40021000
8001834: 007a1200 .word 0x007a1200
08001838 <mymain>:
* Author: wuwenfeng
*/
#include "my_main.h"
08001838 <Send_to_595>:
#define MOTA(x) HAL_GPIO_WritePin(MOTA_GPIO_Port, MOTA_Pin, x);
#define MOTB(x) HAL_GPIO_WritePin(MOTB_GPIO_Port, MOTB_Pin, x);
void Send_to_595(char h,char l)
{
8001838: b580 push {r7, lr}
800183a: b084 sub sp, #16
800183c: af00 add r7, sp, #0
800183e: 0002 movs r2, r0
8001840: 1dfb adds r3, r7, #7
8001842: 701a strb r2, [r3, #0]
8001844: 1dbb adds r3, r7, #6
8001846: 1c0a adds r2, r1, #0
8001848: 701a strb r2, [r3, #0]
for(int a=0;a<8;a++)
800184a: 2300 movs r3, #0
800184c: 60fb str r3, [r7, #12]
800184e: e027 b.n 80018a0 <Send_to_595+0x68>
{
if((h<<a)&0x80)
8001850: 1dfb adds r3, r7, #7
8001852: 781a ldrb r2, [r3, #0]
8001854: 68fb ldr r3, [r7, #12]
8001856: 409a lsls r2, r3
8001858: 0013 movs r3, r2
800185a: 2280 movs r2, #128 ; 0x80
800185c: 4013 ands r3, r2
800185e: d007 beq.n 8001870 <Send_to_595+0x38>
{
HC595_DCK(1);
8001860: 2390 movs r3, #144 ; 0x90
8001862: 05db lsls r3, r3, #23
8001864: 2201 movs r2, #1
8001866: 2108 movs r1, #8
8001868: 0018 movs r0, r3
800186a: f7ff fb7b bl 8000f64 <HAL_GPIO_WritePin>
800186e: e006 b.n 800187e <Send_to_595+0x46>
}else
{
HC595_DCK(0);
8001870: 2390 movs r3, #144 ; 0x90
8001872: 05db lsls r3, r3, #23
8001874: 2200 movs r2, #0
8001876: 2108 movs r1, #8
8001878: 0018 movs r0, r3
800187a: f7ff fb73 bl 8000f64 <HAL_GPIO_WritePin>
}
HC595_SCK(1);
800187e: 2390 movs r3, #144 ; 0x90
8001880: 05db lsls r3, r3, #23
8001882: 2201 movs r2, #1
8001884: 2120 movs r1, #32
8001886: 0018 movs r0, r3
8001888: f7ff fb6c bl 8000f64 <HAL_GPIO_WritePin>
HC595_SCK(0);
800188c: 2390 movs r3, #144 ; 0x90
800188e: 05db lsls r3, r3, #23
8001890: 2200 movs r2, #0
8001892: 2120 movs r1, #32
8001894: 0018 movs r0, r3
8001896: f7ff fb65 bl 8000f64 <HAL_GPIO_WritePin>
for(int a=0;a<8;a++)
800189a: 68fb ldr r3, [r7, #12]
800189c: 3301 adds r3, #1
800189e: 60fb str r3, [r7, #12]
80018a0: 68fb ldr r3, [r7, #12]
80018a2: 2b07 cmp r3, #7
80018a4: ddd4 ble.n 8001850 <Send_to_595+0x18>
}
for(int a=0;a<8;a++)
80018a6: 2300 movs r3, #0
80018a8: 60bb str r3, [r7, #8]
80018aa: e027 b.n 80018fc <Send_to_595+0xc4>
{
if((l<<a)&0x80)
80018ac: 1dbb adds r3, r7, #6
80018ae: 781a ldrb r2, [r3, #0]
80018b0: 68bb ldr r3, [r7, #8]
80018b2: 409a lsls r2, r3
80018b4: 0013 movs r3, r2
80018b6: 2280 movs r2, #128 ; 0x80
80018b8: 4013 ands r3, r2
80018ba: d007 beq.n 80018cc <Send_to_595+0x94>
{
HC595_DCK(1);
80018bc: 2390 movs r3, #144 ; 0x90
80018be: 05db lsls r3, r3, #23
80018c0: 2201 movs r2, #1
80018c2: 2108 movs r1, #8
80018c4: 0018 movs r0, r3
80018c6: f7ff fb4d bl 8000f64 <HAL_GPIO_WritePin>
80018ca: e006 b.n 80018da <Send_to_595+0xa2>
}else
{
HC595_DCK(0);
80018cc: 2390 movs r3, #144 ; 0x90
80018ce: 05db lsls r3, r3, #23
80018d0: 2200 movs r2, #0
80018d2: 2108 movs r1, #8
80018d4: 0018 movs r0, r3
80018d6: f7ff fb45 bl 8000f64 <HAL_GPIO_WritePin>
}
HC595_SCK(1);
80018da: 2390 movs r3, #144 ; 0x90
80018dc: 05db lsls r3, r3, #23
80018de: 2201 movs r2, #1
80018e0: 2120 movs r1, #32
80018e2: 0018 movs r0, r3
80018e4: f7ff fb3e bl 8000f64 <HAL_GPIO_WritePin>
HC595_SCK(0);
80018e8: 2390 movs r3, #144 ; 0x90
80018ea: 05db lsls r3, r3, #23
80018ec: 2200 movs r2, #0
80018ee: 2120 movs r1, #32
80018f0: 0018 movs r0, r3
80018f2: f7ff fb37 bl 8000f64 <HAL_GPIO_WritePin>
for(int a=0;a<8;a++)
80018f6: 68bb ldr r3, [r7, #8]
80018f8: 3301 adds r3, #1
80018fa: 60bb str r3, [r7, #8]
80018fc: 68bb ldr r3, [r7, #8]
80018fe: 2b07 cmp r3, #7
8001900: ddd4 ble.n 80018ac <Send_to_595+0x74>
}
HC595_RCK(1);
8001902: 2390 movs r3, #144 ; 0x90
8001904: 05db lsls r3, r3, #23
8001906: 2201 movs r2, #1
8001908: 2110 movs r1, #16
800190a: 0018 movs r0, r3
800190c: f7ff fb2a bl 8000f64 <HAL_GPIO_WritePin>
HC595_RCK(0);
8001910: 2390 movs r3, #144 ; 0x90
8001912: 05db lsls r3, r3, #23
8001914: 2200 movs r2, #0
8001916: 2110 movs r1, #16
8001918: 0018 movs r0, r3
800191a: f7ff fb23 bl 8000f64 <HAL_GPIO_WritePin>
}
800191e: 46c0 nop ; (mov r8, r8)
8001920: 46bd mov sp, r7
8001922: b004 add sp, #16
8001924: bd80 pop {r7, pc}
...
08001928 <mymain>:
void mymain()
{
8001838: b580 push {r7, lr}
800183a: af00 add r7, sp, #0
8001928: b580 push {r7, lr}
800192a: af00 add r7, sp, #0
MOTA(0);
800192c: 4b12 ldr r3, [pc, #72] ; (8001978 <mymain+0x50>)
800192e: 2200 movs r2, #0
8001930: 2101 movs r1, #1
8001932: 0018 movs r0, r3
8001934: f7ff fb16 bl 8000f64 <HAL_GPIO_WritePin>
MOTB(0);
8001938: 4b0f ldr r3, [pc, #60] ; (8001978 <mymain+0x50>)
800193a: 2200 movs r2, #0
800193c: 2102 movs r1, #2
800193e: 0018 movs r0, r3
8001940: f7ff fb10 bl 8000f64 <HAL_GPIO_WritePin>
HC595_DCK(0);
8001944: 2390 movs r3, #144 ; 0x90
8001946: 05db lsls r3, r3, #23
8001948: 2200 movs r2, #0
800194a: 2108 movs r1, #8
800194c: 0018 movs r0, r3
800194e: f7ff fb09 bl 8000f64 <HAL_GPIO_WritePin>
HC595_RCK(0);
8001952: 2390 movs r3, #144 ; 0x90
8001954: 05db lsls r3, r3, #23
8001956: 2200 movs r2, #0
8001958: 2110 movs r1, #16
800195a: 0018 movs r0, r3
800195c: f7ff fb02 bl 8000f64 <HAL_GPIO_WritePin>
HC595_SCK(0);
8001960: 2390 movs r3, #144 ; 0x90
8001962: 05db lsls r3, r3, #23
8001964: 2200 movs r2, #0
8001966: 2120 movs r1, #32
8001968: 0018 movs r0, r3
800196a: f7ff fafb bl 8000f64 <HAL_GPIO_WritePin>
Send_to_595(0x00,0x00);
800196e: 2100 movs r1, #0
8001970: 2000 movs r0, #0
8001972: f7ff ff61 bl 8001838 <Send_to_595>
while(1)
800183c: e7fe b.n 800183c <mymain+0x4>
...
8001976: e7fe b.n 8001976 <mymain+0x4e>
8001978: 48001400 .word 0x48001400
08001840 <__libc_init_array>:
8001840: b570 push {r4, r5, r6, lr}
8001842: 2600 movs r6, #0
8001844: 4d0c ldr r5, [pc, #48] ; (8001878 <__libc_init_array+0x38>)
8001846: 4c0d ldr r4, [pc, #52] ; (800187c <__libc_init_array+0x3c>)
8001848: 1b64 subs r4, r4, r5
800184a: 10a4 asrs r4, r4, #2
800184c: 42a6 cmp r6, r4
800184e: d109 bne.n 8001864 <__libc_init_array+0x24>
8001850: 2600 movs r6, #0
8001852: f000 f821 bl 8001898 <_init>
8001856: 4d0a ldr r5, [pc, #40] ; (8001880 <__libc_init_array+0x40>)
8001858: 4c0a ldr r4, [pc, #40] ; (8001884 <__libc_init_array+0x44>)
800185a: 1b64 subs r4, r4, r5
800185c: 10a4 asrs r4, r4, #2
800185e: 42a6 cmp r6, r4
8001860: d105 bne.n 800186e <__libc_init_array+0x2e>
8001862: bd70 pop {r4, r5, r6, pc}
8001864: 00b3 lsls r3, r6, #2
8001866: 58eb ldr r3, [r5, r3]
8001868: 4798 blx r3
800186a: 3601 adds r6, #1
800186c: e7ee b.n 800184c <__libc_init_array+0xc>
800186e: 00b3 lsls r3, r6, #2
8001870: 58eb ldr r3, [r5, r3]
8001872: 4798 blx r3
8001874: 3601 adds r6, #1
8001876: e7f2 b.n 800185e <__libc_init_array+0x1e>
8001878: 080018e0 .word 0x080018e0
800187c: 080018e0 .word 0x080018e0
8001880: 080018e0 .word 0x080018e0
8001884: 080018e4 .word 0x080018e4
0800197c <__libc_init_array>:
800197c: b570 push {r4, r5, r6, lr}
800197e: 2600 movs r6, #0
8001980: 4d0c ldr r5, [pc, #48] ; (80019b4 <__libc_init_array+0x38>)
8001982: 4c0d ldr r4, [pc, #52] ; (80019b8 <__libc_init_array+0x3c>)
8001984: 1b64 subs r4, r4, r5
8001986: 10a4 asrs r4, r4, #2
8001988: 42a6 cmp r6, r4
800198a: d109 bne.n 80019a0 <__libc_init_array+0x24>
800198c: 2600 movs r6, #0
800198e: f000 f821 bl 80019d4 <_init>
8001992: 4d0a ldr r5, [pc, #40] ; (80019bc <__libc_init_array+0x40>)
8001994: 4c0a ldr r4, [pc, #40] ; (80019c0 <__libc_init_array+0x44>)
8001996: 1b64 subs r4, r4, r5
8001998: 10a4 asrs r4, r4, #2
800199a: 42a6 cmp r6, r4
800199c: d105 bne.n 80019aa <__libc_init_array+0x2e>
800199e: bd70 pop {r4, r5, r6, pc}
80019a0: 00b3 lsls r3, r6, #2
80019a2: 58eb ldr r3, [r5, r3]
80019a4: 4798 blx r3
80019a6: 3601 adds r6, #1
80019a8: e7ee b.n 8001988 <__libc_init_array+0xc>
80019aa: 00b3 lsls r3, r6, #2
80019ac: 58eb ldr r3, [r5, r3]
80019ae: 4798 blx r3
80019b0: 3601 adds r6, #1
80019b2: e7f2 b.n 800199a <__libc_init_array+0x1e>
80019b4: 08001a1c .word 0x08001a1c
80019b8: 08001a1c .word 0x08001a1c
80019bc: 08001a1c .word 0x08001a1c
80019c0: 08001a20 .word 0x08001a20
08001888 <memset>:
8001888: 0003 movs r3, r0
800188a: 1882 adds r2, r0, r2
800188c: 4293 cmp r3, r2
800188e: d100 bne.n 8001892 <memset+0xa>
8001890: 4770 bx lr
8001892: 7019 strb r1, [r3, #0]
8001894: 3301 adds r3, #1
8001896: e7f9 b.n 800188c <memset+0x4>
080019c4 <memset>:
80019c4: 0003 movs r3, r0
80019c6: 1882 adds r2, r0, r2
80019c8: 4293 cmp r3, r2
80019ca: d100 bne.n 80019ce <memset+0xa>
80019cc: 4770 bx lr
80019ce: 7019 strb r1, [r3, #0]
80019d0: 3301 adds r3, #1
80019d2: e7f9 b.n 80019c8 <memset+0x4>
08001898 <_init>:
8001898: b5f8 push {r3, r4, r5, r6, r7, lr}
800189a: 46c0 nop ; (mov r8, r8)
800189c: bcf8 pop {r3, r4, r5, r6, r7}
800189e: bc08 pop {r3}
80018a0: 469e mov lr, r3
80018a2: 4770 bx lr
080019d4 <_init>:
80019d4: b5f8 push {r3, r4, r5, r6, r7, lr}
80019d6: 46c0 nop ; (mov r8, r8)
80019d8: bcf8 pop {r3, r4, r5, r6, r7}
80019da: bc08 pop {r3}
80019dc: 469e mov lr, r3
80019de: 4770 bx lr
080018a4 <_fini>:
80018a4: b5f8 push {r3, r4, r5, r6, r7, lr}
80018a6: 46c0 nop ; (mov r8, r8)
80018a8: bcf8 pop {r3, r4, r5, r6, r7}
80018aa: bc08 pop {r3}
80018ac: 469e mov lr, r3
80018ae: 4770 bx lr
080019e0 <_fini>:
80019e0: b5f8 push {r3, r4, r5, r6, r7, lr}
80019e2: 46c0 nop ; (mov r8, r8)
80019e4: bcf8 pop {r3, r4, r5, r6, r7}
80019e6: bc08 pop {r3}
80019e8: 469e mov lr, r3
80019ea: 4770 bx lr