增加了一键下载(不调试)的支持,并更新了makefile,添加了make clean支持

This commit is contained in:
NeoZeng 2022-11-29 20:00:46 +08:00
parent a539072052
commit 6dd2f9c504
8 changed files with 114 additions and 69 deletions

28
.vscode/launch.json vendored
View File

@ -3,27 +3,29 @@
"configurations": [
// 使dap-link(线)
{
"name": "Debug-dap",
"name": "Debug-DAP",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}\\build\\basic_framework.elf", //
"executable": "${workspaceRoot}\\build\\${workspaceFolderBasename}.elf", // ,vscode
"request": "launch",
"type": "cortex-debug",
"device": "STM32F407IG", //使J-link GDB Server;GBD ServerSVD https://www.segger.com/downloads/supported-devices.php
"svdFile": ".\\STM32F407.svd", //svd https://github.com/posborne/cmsis-svd
//使J-link GDB Server;GBD ServerSVD
// https://www.segger.com/downloads/supported-devices.php
"device": "STM32F407IG",
//svd https://github.com/posborne/cmsis-svd
//C使svd
"svdFile": "STM32F407.svd",
"servertype": "openocd", //使GDB Server
"configFiles": [
".\\openocd.cfg", // ,,openocdshare/scripts
"openocd_dap.cfg", // ,,openocdshare/scripts
],
// path to your gcc-arm-none-eabi/arm-none-eabi-gdb.exe,cortex-debug,
// "gdbPath": "D:\\gcc-arm-none-eabi\\bin\\arm-none-eabi-gdb.exe",
//"preLaunchTask": "build task",//Build,使
"runToEntryPoint": "main" // main
//"preLaunchTask": "build task",//Build,使
},
// 使j-link
// 使j-link
{
"name": "Debug-jlink",
"name": "Debug-Jlink",
"cwd": "${workspaceFolder}",
"executable": "${workspaceRoot}\\build\\basic_framework.elf",
"executable": "${workspaceRoot}\\build\\${workspaceFolderBasename}.elf",
"request": "launch",
"type": "cortex-debug",
"device": "STM32F407IG",
@ -31,8 +33,8 @@
"showDevDebugOutput": "none",
"servertype": "jlink",
"interface": "swd",
"svdFile": ".\\STM32F407.svd",
"svdFile": "STM32F407.svd",
// "preLaunchTask": "build task",//Build,使
},
]
],
}

20
.vscode/tasks.json vendored
View File

@ -5,12 +5,30 @@
{
"label": "build task", //
"type": "shell", // ,mingw32-make,(CMD),shell
"command": "mingw32-make -j24",//
"command": "mingw32-make -j24",// ,线,4~8
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "download dap",
"type": "shell",
"command":"make download_dap",
"group": {
"kind": "build",
"isDefault": false,
},
},
{
"label": "download jlink",
"type": "shell",
"command":"make download_jlink",
"group": {
"kind": "build",
"isDefault": false,
}
},
]
}

View File

@ -42,6 +42,8 @@
#include "ins_task.h"
#include "can_comm.h"
#include "master_process.h"
#include "led_task.h"
#include "bsp_led.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -127,6 +129,7 @@ int main(void)
/* USER CODE BEGIN 2 */
RC_init(&huart3);
DWT_Init(168);
Motor_Init_Config_s config = {
.motor_type = GM6020,
.can_init_config = {
@ -146,6 +149,7 @@ int main(void)
RefereeInit(&huart6);
Vision_Recv_s* recv=VisionInit(&huart1);
Vision_Send_s send={.pitch=1,.roll=2,.yaw=3};
LED_init();
/* USER CODE END 2 */
/* Call init function for freertos objects (in freertos.c) */
@ -164,11 +168,12 @@ int main(void)
/* USER CODE END WHILE */
DJIMotorSetRef(djimotor, 10);
MotorControlTask();
HAL_Delay(10);
HAL_Delay(1);
CANCommSend(in, (uint8_t*)&tx);
tx+=1;
rx=(sdf*)CANCommGet(in);
VisionSend(&send);
led_RGB_flow_task();
// INS_Task();
/* USER CODE BEGIN 3 */
}

View File

@ -292,7 +292,18 @@ $(BUILD_DIR):
# clean up
#######################################
clean:
-rm -r -Force $(BUILD_DIR)
rmdir /q $(BUILD_DIR)
#######################################
# download without debugging
#######################################
OPENOCD_FLASH_START = 0x08000000 # 如果切换芯片可能需要修改此值
download_dap:
openocd -f openocd_dap.cfg -c init -c halt -c "flash write_image erase $(BUILD_DIR)/$(TARGET).hex $(OPENOCD_FLASH_START)" -c reset -c shutdown
download_jlink:
openocd -f openocd_jlink.cfg -c init -c halt -c "flash write_image erase $(BUILD_DIR)/$(TARGET).hex $(OPENOCD_FLASH_START)" -c reset -c shutdown
#######################################
# dependencies

View File

@ -42,9 +42,6 @@ void led_RGB_flow_task()
float alpha, red, green, blue;
uint32_t aRGB;
while (1)
{
for (i = 0; i < RGB_FLOW_COLOR_LENGHT; i++)
{
alpha = (RGB_flow_color[i] & 0xFF000000) >> 24;
@ -70,8 +67,7 @@ void led_RGB_flow_task()
aRGB = ((uint32_t)(alpha)) << 24 | ((uint32_t)(red)) << 16 | ((uint32_t)(green)) << 8 | ((uint32_t)(blue)) << 0;
aRGB_led_show(aRGB);
osDelay(1);
}
}
}
HAL_Delay(1);
}

View File

@ -73,7 +73,7 @@ void get_protocol_send_data(uint16_t send_id, //信号id
tx_buf[0] = PROTOCOL_CMD_ID;
tx_buf[1] = data_len & 0xff; // 低位在前
tx_buf[2] = (data_len >> 8) & 0xff; // 低位在前
tx_buf[3] = Get_CRC8_Check(&tx_buf[0], 3); //获取CRC8校验位
tx_buf[3] = crc_8(&tx_buf[0], 3); // 获取CRC8校验位
/*数据的信号id*/
tx_buf[4] = send_id & 0xff;
@ -90,7 +90,7 @@ void get_protocol_send_data(uint16_t send_id, //信号id
}
/*整包校验*/
crc16 = Get_CRC16_Check(&tx_buf[0], data_len + 6);
crc16 = crc_16(&tx_buf[0], data_len + 6);
tx_buf[data_len + 6] = crc16 & 0xff;
tx_buf[data_len + 7] = (crc16 >> 8) & 0xff;

13
openocd_jlink.cfg Normal file
View File

@ -0,0 +1,13 @@
# 选择调试器为jlink
source [find interface/jlink.cfg]
# source [find interface/jlink.cfg] #使用jlink硬件进行调试,注意其他地方也要更改
# OpenOCD作为GDB和硬件调试器的桥梁(为硬件提供抽象,把接口给GDB),支持多种硬件调试器.
# OpenOCD会自动在其根目录的share/openocd/scripts/interface里面寻找对应的配置文件
# 选择接口为SWD
transport select swd
# 选择目标芯片
source [find target/stm32f4x.cfg]
# OpenOCD会自动在其根目录的share/openocd/scripts/target里面寻找对应的配置文件