蓝牙模块框架小雏形

This commit is contained in:
xqq27 2024-12-03 22:49:37 +08:00
parent 5f9f0ca4e1
commit 8c39e0bab9
5 changed files with 86 additions and 60 deletions

View File

@ -32,7 +32,8 @@
"mw_printf.h": "c", "mw_printf.h": "c",
"stdint.h": "c", "stdint.h": "c",
"misc.h": "c", "misc.h": "c",
"mw_bluetooth.h": "c" "mw_bluetooth.h": "c",
"hc06.h": "c"
}, },
"cmake.sourceDirectory": "E:/xqq/workspace/STM32F103RC-StdLibrary/Code/middleware/FreeRTOS/Kernel" "cmake.sourceDirectory": "E:/xqq/workspace/STM32F103RC-StdLibrary/Code/middleware/FreeRTOS/Kernel"
} }

View File

@ -1 +1,15 @@
#include "hc06.h" #include "hc06.h"
#define BLUETOOTH_USART (USART1)
#define BLUETOOTH_BAUD (9600u)
// TX
#define BLUETOOTH_TX_GPIO_PORT (GPIOA)
#define BLUETOOTH_TX_GPIO_PIN (GPIO_Pin_9)
// RX
#define BLUETOOTH_RX_GPIO_PORT (GPIOA)
#define BLUETOOTH_RX_GPIO_PIN (GPIO_Pin_10)
void hc06_init(void)
{
;
}

View File

@ -1,2 +1,11 @@
#include "mw_bluetooth.h" #include "mw_bluetooth.h"
// Initial the entity of bluetooth buf.
mw_bluetooth_t bluetooth_drv_buf[bluetooth_num];
mw_bluetooth_drv_init(void)
{
;
}

View File

@ -7,19 +7,18 @@ typedef enum
{ {
hc06 = 0, hc06 = 0,
led_num bluetooth_num
}bluetooth_type_enum; }bluetooth_type_enum;
typedef struct typedef struct
{ {
bluetooth_type_enum bluetooth_drv; bluetooth_type_enum bluetooth_drv;
void (*init)(void); void (*init)(void);
void (*deinit)(void);
int8_t (*send_bytes)(uint16_t bytes, uint8_t * txbuf); int8_t (*send_bytes)(uint16_t bytes, uint8_t * txbuf);
int8_t (*recv_bytes)(uint16_t bytes, uint8_t * rxbuf); int8_t (*recv_bytes)(uint16_t bytes, uint8_t * rxbuf);
void (*off)(void); }mw_bluetooth_t;
}mw_led_t;

View File

@ -703,8 +703,11 @@ Removing Unused input sections from the image.
Removing stm32f10x_wwdg.o(i.WWDG_SetCounter), (16 bytes). Removing stm32f10x_wwdg.o(i.WWDG_SetCounter), (16 bytes).
Removing stm32f10x_wwdg.o(i.WWDG_SetPrescaler), (24 bytes). Removing stm32f10x_wwdg.o(i.WWDG_SetPrescaler), (24 bytes).
Removing stm32f10x_wwdg.o(i.WWDG_SetWindowValue), (40 bytes). Removing stm32f10x_wwdg.o(i.WWDG_SetWindowValue), (40 bytes).
Removing mw_bluetooth.o(i.mw_bluetooth_drv_init), (2 bytes).
Removing mw_bluetooth.o(.bss), (20 bytes).
Removing hc06.o(i.hc06_init), (2 bytes).
466 unused section(s) (total 18860 bytes) removed from the image. 469 unused section(s) (total 18884 bytes) removed from the image.
============================================================================== ==============================================================================
@ -1115,62 +1118,62 @@ Memory Map of the image
Exec Addr Load Addr Size Type Attr Idx E Section Name Object Exec Addr Load Addr Size Type Attr Idx E Section Name Object
0x08000000 0x08000000 0x000000ec Data RO 417 RESET startup_stm32f10x_md.o 0x08000000 0x08000000 0x000000ec Data RO 417 RESET startup_stm32f10x_md.o
0x080000ec 0x080000ec 0x00000008 Code RO 3470 * !!!main c_w.l(__main.o) 0x080000ec 0x080000ec 0x00000008 Code RO 3485 * !!!main c_w.l(__main.o)
0x080000f4 0x080000f4 0x00000034 Code RO 3627 !!!scatter c_w.l(__scatter.o) 0x080000f4 0x080000f4 0x00000034 Code RO 3642 !!!scatter c_w.l(__scatter.o)
0x08000128 0x08000128 0x0000001a Code RO 3629 !!handler_copy c_w.l(__scatter_copy.o) 0x08000128 0x08000128 0x0000001a Code RO 3644 !!handler_copy c_w.l(__scatter_copy.o)
0x08000142 0x08000142 0x00000002 PAD 0x08000142 0x08000142 0x00000002 PAD
0x08000144 0x08000144 0x0000001c Code RO 3631 !!handler_zi c_w.l(__scatter_zi.o) 0x08000144 0x08000144 0x0000001c Code RO 3646 !!handler_zi c_w.l(__scatter_zi.o)
0x08000160 0x08000160 0x00000002 Code RO 3499 .ARM.Collect$$libinit$$00000000 c_w.l(libinit.o) 0x08000160 0x08000160 0x00000002 Code RO 3514 .ARM.Collect$$libinit$$00000000 c_w.l(libinit.o)
0x08000162 0x08000162 0x00000000 Code RO 3506 .ARM.Collect$$libinit$$00000002 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3521 .ARM.Collect$$libinit$$00000002 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3508 .ARM.Collect$$libinit$$00000004 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3523 .ARM.Collect$$libinit$$00000004 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3511 .ARM.Collect$$libinit$$0000000A c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3526 .ARM.Collect$$libinit$$0000000A c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3513 .ARM.Collect$$libinit$$0000000C c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3528 .ARM.Collect$$libinit$$0000000C c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3515 .ARM.Collect$$libinit$$0000000E c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3530 .ARM.Collect$$libinit$$0000000E c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3518 .ARM.Collect$$libinit$$00000011 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3533 .ARM.Collect$$libinit$$00000011 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3520 .ARM.Collect$$libinit$$00000013 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3535 .ARM.Collect$$libinit$$00000013 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3522 .ARM.Collect$$libinit$$00000015 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3537 .ARM.Collect$$libinit$$00000015 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3524 .ARM.Collect$$libinit$$00000017 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3539 .ARM.Collect$$libinit$$00000017 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3526 .ARM.Collect$$libinit$$00000019 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3541 .ARM.Collect$$libinit$$00000019 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3528 .ARM.Collect$$libinit$$0000001B c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3543 .ARM.Collect$$libinit$$0000001B c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3530 .ARM.Collect$$libinit$$0000001D c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3545 .ARM.Collect$$libinit$$0000001D c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3532 .ARM.Collect$$libinit$$0000001F c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3547 .ARM.Collect$$libinit$$0000001F c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3534 .ARM.Collect$$libinit$$00000021 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3549 .ARM.Collect$$libinit$$00000021 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3536 .ARM.Collect$$libinit$$00000023 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3551 .ARM.Collect$$libinit$$00000023 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3538 .ARM.Collect$$libinit$$00000025 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3553 .ARM.Collect$$libinit$$00000025 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3542 .ARM.Collect$$libinit$$0000002C c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3557 .ARM.Collect$$libinit$$0000002C c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3544 .ARM.Collect$$libinit$$0000002E c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3559 .ARM.Collect$$libinit$$0000002E c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3546 .ARM.Collect$$libinit$$00000030 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3561 .ARM.Collect$$libinit$$00000030 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000000 Code RO 3548 .ARM.Collect$$libinit$$00000032 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000000 Code RO 3563 .ARM.Collect$$libinit$$00000032 c_w.l(libinit2.o)
0x08000162 0x08000162 0x00000002 Code RO 3549 .ARM.Collect$$libinit$$00000033 c_w.l(libinit2.o) 0x08000162 0x08000162 0x00000002 Code RO 3564 .ARM.Collect$$libinit$$00000033 c_w.l(libinit2.o)
0x08000164 0x08000164 0x00000002 Code RO 3567 .ARM.Collect$$libshutdown$$00000000 c_w.l(libshutdown.o) 0x08000164 0x08000164 0x00000002 Code RO 3582 .ARM.Collect$$libshutdown$$00000000 c_w.l(libshutdown.o)
0x08000166 0x08000166 0x00000000 Code RO 3577 .ARM.Collect$$libshutdown$$00000002 c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000000 Code RO 3592 .ARM.Collect$$libshutdown$$00000002 c_w.l(libshutdown2.o)
0x08000166 0x08000166 0x00000000 Code RO 3579 .ARM.Collect$$libshutdown$$00000004 c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000000 Code RO 3594 .ARM.Collect$$libshutdown$$00000004 c_w.l(libshutdown2.o)
0x08000166 0x08000166 0x00000000 Code RO 3581 .ARM.Collect$$libshutdown$$00000006 c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000000 Code RO 3596 .ARM.Collect$$libshutdown$$00000006 c_w.l(libshutdown2.o)
0x08000166 0x08000166 0x00000000 Code RO 3584 .ARM.Collect$$libshutdown$$00000009 c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000000 Code RO 3599 .ARM.Collect$$libshutdown$$00000009 c_w.l(libshutdown2.o)
0x08000166 0x08000166 0x00000000 Code RO 3587 .ARM.Collect$$libshutdown$$0000000C c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000000 Code RO 3602 .ARM.Collect$$libshutdown$$0000000C c_w.l(libshutdown2.o)
0x08000166 0x08000166 0x00000000 Code RO 3589 .ARM.Collect$$libshutdown$$0000000E c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000000 Code RO 3604 .ARM.Collect$$libshutdown$$0000000E c_w.l(libshutdown2.o)
0x08000166 0x08000166 0x00000000 Code RO 3592 .ARM.Collect$$libshutdown$$00000011 c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000000 Code RO 3607 .ARM.Collect$$libshutdown$$00000011 c_w.l(libshutdown2.o)
0x08000166 0x08000166 0x00000002 Code RO 3593 .ARM.Collect$$libshutdown$$00000012 c_w.l(libshutdown2.o) 0x08000166 0x08000166 0x00000002 Code RO 3608 .ARM.Collect$$libshutdown$$00000012 c_w.l(libshutdown2.o)
0x08000168 0x08000168 0x00000000 Code RO 3474 .ARM.Collect$$rtentry$$00000000 c_w.l(__rtentry.o) 0x08000168 0x08000168 0x00000000 Code RO 3489 .ARM.Collect$$rtentry$$00000000 c_w.l(__rtentry.o)
0x08000168 0x08000168 0x00000000 Code RO 3476 .ARM.Collect$$rtentry$$00000002 c_w.l(__rtentry2.o) 0x08000168 0x08000168 0x00000000 Code RO 3491 .ARM.Collect$$rtentry$$00000002 c_w.l(__rtentry2.o)
0x08000168 0x08000168 0x00000006 Code RO 3488 .ARM.Collect$$rtentry$$00000004 c_w.l(__rtentry4.o) 0x08000168 0x08000168 0x00000006 Code RO 3503 .ARM.Collect$$rtentry$$00000004 c_w.l(__rtentry4.o)
0x0800016e 0x0800016e 0x00000000 Code RO 3478 .ARM.Collect$$rtentry$$00000009 c_w.l(__rtentry2.o) 0x0800016e 0x0800016e 0x00000000 Code RO 3493 .ARM.Collect$$rtentry$$00000009 c_w.l(__rtentry2.o)
0x0800016e 0x0800016e 0x00000004 Code RO 3479 .ARM.Collect$$rtentry$$0000000A c_w.l(__rtentry2.o) 0x0800016e 0x0800016e 0x00000004 Code RO 3494 .ARM.Collect$$rtentry$$0000000A c_w.l(__rtentry2.o)
0x08000172 0x08000172 0x00000000 Code RO 3481 .ARM.Collect$$rtentry$$0000000C c_w.l(__rtentry2.o) 0x08000172 0x08000172 0x00000000 Code RO 3496 .ARM.Collect$$rtentry$$0000000C c_w.l(__rtentry2.o)
0x08000172 0x08000172 0x00000008 Code RO 3482 .ARM.Collect$$rtentry$$0000000D c_w.l(__rtentry2.o) 0x08000172 0x08000172 0x00000008 Code RO 3497 .ARM.Collect$$rtentry$$0000000D c_w.l(__rtentry2.o)
0x0800017a 0x0800017a 0x00000002 Code RO 3503 .ARM.Collect$$rtexit$$00000000 c_w.l(rtexit.o) 0x0800017a 0x0800017a 0x00000002 Code RO 3518 .ARM.Collect$$rtexit$$00000000 c_w.l(rtexit.o)
0x0800017c 0x0800017c 0x00000000 Code RO 3551 .ARM.Collect$$rtexit$$00000002 c_w.l(rtexit2.o) 0x0800017c 0x0800017c 0x00000000 Code RO 3566 .ARM.Collect$$rtexit$$00000002 c_w.l(rtexit2.o)
0x0800017c 0x0800017c 0x00000004 Code RO 3552 .ARM.Collect$$rtexit$$00000003 c_w.l(rtexit2.o) 0x0800017c 0x0800017c 0x00000004 Code RO 3567 .ARM.Collect$$rtexit$$00000003 c_w.l(rtexit2.o)
0x08000180 0x08000180 0x00000006 Code RO 3553 .ARM.Collect$$rtexit$$00000004 c_w.l(rtexit2.o) 0x08000180 0x08000180 0x00000006 Code RO 3568 .ARM.Collect$$rtexit$$00000004 c_w.l(rtexit2.o)
0x08000186 0x08000186 0x00000002 PAD 0x08000186 0x08000186 0x00000002 PAD
0x08000188 0x08000188 0x00000040 Code RO 418 .text startup_stm32f10x_md.o 0x08000188 0x08000188 0x00000040 Code RO 418 .text startup_stm32f10x_md.o
0x080001c8 0x080001c8 0x00000002 Code RO 3466 .text c_w.l(use_no_semi_2.o) 0x080001c8 0x080001c8 0x00000002 Code RO 3481 .text c_w.l(use_no_semi_2.o)
0x080001ca 0x080001ca 0x00000006 Code RO 3468 .text c_w.l(heapauxi.o) 0x080001ca 0x080001ca 0x00000006 Code RO 3483 .text c_w.l(heapauxi.o)
0x080001d0 0x080001d0 0x00000002 Code RO 3472 .text c_w.l(use_no_semi.o) 0x080001d0 0x080001d0 0x00000002 Code RO 3487 .text c_w.l(use_no_semi.o)
0x080001d2 0x080001d2 0x0000004a Code RO 3490 .text c_w.l(sys_stackheap_outer.o) 0x080001d2 0x080001d2 0x0000004a Code RO 3505 .text c_w.l(sys_stackheap_outer.o)
0x0800021c 0x0800021c 0x00000012 Code RO 3492 .text c_w.l(exit.o) 0x0800021c 0x0800021c 0x00000012 Code RO 3507 .text c_w.l(exit.o)
0x0800022e 0x0800022e 0x00000002 PAD 0x0800022e 0x0800022e 0x00000002 PAD
0x08000230 0x08000230 0x00000008 Code RO 3500 .text c_w.l(libspace.o) 0x08000230 0x08000230 0x00000008 Code RO 3515 .text c_w.l(libspace.o)
0x08000238 0x08000238 0x00000116 Code RO 1597 i.GPIO_Init stm32f10x_gpio.o 0x08000238 0x08000238 0x00000116 Code RO 1597 i.GPIO_Init stm32f10x_gpio.o
0x0800034e 0x0800034e 0x00000004 Code RO 1604 i.GPIO_ResetBits stm32f10x_gpio.o 0x0800034e 0x0800034e 0x00000004 Code RO 1604 i.GPIO_ResetBits stm32f10x_gpio.o
0x08000352 0x08000352 0x00000004 Code RO 1605 i.GPIO_SetBits stm32f10x_gpio.o 0x08000352 0x08000352 0x00000004 Code RO 1605 i.GPIO_SetBits stm32f10x_gpio.o
@ -1210,7 +1213,7 @@ Memory Map of the image
0x08000940 0x08000940 0x0000003c Code RO 233 i.mw_led_drv_init mw_led.o 0x08000940 0x08000940 0x0000003c Code RO 233 i.mw_led_drv_init mw_led.o
0x0800097c 0x0800097c 0x00000028 Code RO 268 i.mw_printf_insert_data mw_printf.o 0x0800097c 0x0800097c 0x00000028 Code RO 268 i.mw_printf_insert_data mw_printf.o
0x080009a4 0x080009a4 0x00000010 Code RO 288 i.mw_soft_timer_user_systick_update mw_soft_timer.o 0x080009a4 0x080009a4 0x00000010 Code RO 288 i.mw_soft_timer_user_systick_update mw_soft_timer.o
0x080009b4 0x080009b4 0x00000020 Data RO 3625 Region$$Table anon$$obj.o 0x080009b4 0x080009b4 0x00000020 Data RO 3640 Region$$Table anon$$obj.o
Execution Region RW_IRAM1 (Exec base: 0x20000000, Load base: 0x080009d4, Size: 0x000006b8, Max: 0x00005000, ABSOLUTE) Execution Region RW_IRAM1 (Exec base: 0x20000000, Load base: 0x080009d4, Size: 0x000006b8, Max: 0x00005000, ABSOLUTE)
@ -1224,7 +1227,7 @@ Memory Map of the image
0x20000010 - 0x00000010 Zero RW 234 .bss mw_led.o 0x20000010 - 0x00000010 Zero RW 234 .bss mw_led.o
0x20000020 - 0x00000032 Zero RW 269 .bss mw_printf.o 0x20000020 - 0x00000032 Zero RW 269 .bss mw_printf.o
0x20000052 0x080009e4 0x00000002 PAD 0x20000052 0x080009e4 0x00000002 PAD
0x20000054 - 0x00000060 Zero RW 3501 .bss c_w.l(libspace.o) 0x20000054 - 0x00000060 Zero RW 3516 .bss c_w.l(libspace.o)
0x200000b4 0x080009e4 0x00000004 PAD 0x200000b4 0x080009e4 0x00000004 PAD
0x200000b8 - 0x00000200 Zero RW 416 HEAP startup_stm32f10x_md.o 0x200000b8 - 0x00000200 Zero RW 416 HEAP startup_stm32f10x_md.o
0x200002b8 - 0x00000400 Zero RW 415 STACK startup_stm32f10x_md.o 0x200002b8 - 0x00000400 Zero RW 415 STACK startup_stm32f10x_md.o