From acf93052b2858d62631fc9ebd5833570266e48e7 Mon Sep 17 00:00:00 2001 From: NeoZeng Date: Sat, 19 Nov 2022 15:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E6=85=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 2 +- Makefile | 17 +++++++---------- VSCode+Ozone使用方法.md | 1 + application/APP层应用编写指引.md | 7 +++++++ application/robot.c | 0 application/robot.h | 10 ++++++++++ bsp/bsp_led.c | 2 +- bsp/struct_typedef.h | 5 +++++ 8 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 application/APP层应用编写指引.md create mode 100644 application/robot.c create mode 100644 application/robot.h diff --git a/.vscode/settings.json b/.vscode/settings.json index b95b67e..a1c3110 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -49,5 +49,5 @@ "segger_rtt_conf.h": "c", "segger_rtt.h": "c", "bsp_log.h": "c" - } + }, } \ No newline at end of file diff --git a/Makefile b/Makefile index acb0154..af148d3 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,6 @@ HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_ HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \ HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT_printf.c \ HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT.c \ -\ \ bsp/bsp_dwt.c \ bsp/bsp_temperature.c \ bsp/bsp_led.c \ @@ -106,7 +105,6 @@ bsp/bsp_buzzer.c \ bsp/bsp_usart.c \ bsp/bsp_log.c \ bsp/bsp_init.c \ -\ \ modules/algorithm/controller.c \ modules/algorithm/kalman_filter.c \ modules/algorithm/QuaternionEKF.c \ @@ -129,7 +127,6 @@ modules/master_machine/seasky_protocol.c \ modules/algorithm/crc8.c \ modules/algorithm/crc16.c \ modules/can_comm/can_comm.c \ -\ \ application/gimbal.c \ application/chassis.c \ application/shoot.c \ @@ -144,7 +141,7 @@ HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT_ASM_ARMv7M.s ####################################### # binaries ####################################### -PREFIX = arm-none-eabi- +PREFIX = ccache arm-none-eabi- # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) # either it can be added to the PATH environment variable. ifdef GCC_PATH @@ -189,7 +186,7 @@ C_DEFS = \ -DARM_MATH_ROUNDING # AS includes -AS_INCLUDES = +AS_INCLUDES = -IHAL_N_Middlewares/Inc # C includes C_INCLUDES = \ @@ -263,14 +260,14 @@ vpath %.s $(sort $(dir $(ASM_SOURCES))) # 以下是编译命令,命令之前被粉色高亮的@就是静默输出的指令.删除前面的@会将输出显示到命令行. # 如@$(CC) -c $(CFLAGS) ...... 去掉第一个@即可. $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) - @$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ + $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) - @$(AS) -c $(CFLAGS) $< -o $@ + $(AS) -c $(CFLAGS) $< -o $@ $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile - @$(CC) $(OBJECTS) $(LDFLAGS) -o $@ - @$(SZ) $@ + $(CC) $(OBJECTS) $(LDFLAGS) -o $@ + $(SZ) $@ $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) $(HEX) $< $@ @@ -279,7 +276,7 @@ $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) $(BIN) $< $@ $(BUILD_DIR): - @mkdir $@ + mkdir $@ ####################################### # clean up diff --git a/VSCode+Ozone使用方法.md b/VSCode+Ozone使用方法.md index 99a3c97..bc95983 100644 --- a/VSCode+Ozone使用方法.md +++ b/VSCode+Ozone使用方法.md @@ -71,6 +71,7 @@ CubeMX进行初始化 --> VSCode编写代/进行编译/简单调试 --> Ozone变 2. C语言的内存模型 3. C语言标准,动态链接库和静态编译的区别,一些编译器的常用选项 4. STM32F4系列的DBG外设工作原理 +5. GDB调试器、硬件调试器和DBG的关系 ### 编译全过程 diff --git a/application/APP层应用编写指引.md b/application/APP层应用编写指引.md new file mode 100644 index 0000000..3c0bcbf --- /dev/null +++ b/application/APP层应用编写指引.md @@ -0,0 +1,7 @@ +# APP层应用编写指引 + +

neozng1@hnu.edu.cn

+ +## robot_cmd + +机器人命令模块是对整个机器人的抽象,对于单板控制整车的情况, \ No newline at end of file diff --git a/application/robot.c b/application/robot.c new file mode 100644 index 0000000..e69de29 diff --git a/application/robot.h b/application/robot.h new file mode 100644 index 0000000..edf2f9f --- /dev/null +++ b/application/robot.h @@ -0,0 +1,10 @@ +#ifndef ROBOT_H +#define ROBOT_H + +#define GIMBAL_BOARD + +void RobotInit(); + +void RobotTask(); + +#endif \ No newline at end of file diff --git a/bsp/bsp_led.c b/bsp/bsp_led.c index 6fa11cb..4ea7104 100644 --- a/bsp/bsp_led.c +++ b/bsp/bsp_led.c @@ -2,7 +2,7 @@ #include "main.h" extern TIM_HandleTypeDef htim5; -static tmp_output_level = 0; +static uint8_t tmp_output_level = 0; void LED_init() { diff --git a/bsp/struct_typedef.h b/bsp/struct_typedef.h index e80ba2b..87e7917 100644 --- a/bsp/struct_typedef.h +++ b/bsp/struct_typedef.h @@ -1,6 +1,11 @@ #ifndef STRUCT_TYPEDEF_H #define STRUCT_TYPEDEF_H + +#ifndef __PACKED +#define __packed __attribute__((pakced)) +#endif // !__PACKED + typedef signed char int8_t; typedef signed short int int16_t;