0
0
Fork 0

chore: Refactor build dependencies

This commit is contained in:
windowsair 2021-06-05 20:16:56 +08:00
parent b2c8a832cc
commit 9876edd6ef
34 changed files with 2168 additions and 2154 deletions

View File

@ -1,9 +1,6 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
#set(COMPONENT_DIRS "${IDF_PATH}/components ${PROJECT_PATH}/components")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/main)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp8266_dap)

View File

@ -1,4 +1,4 @@
set(COMPONENT_ADD_INCLUDEDIRS "config include $ENV{IDF_PATH}/components/esp8266/include/esp8266/ $ENV{IDF_PATH}//components/esp_ringbuf/include/")
set(COMPONENT_ADD_INCLUDEDIRS "config include $ENV{IDF_PATH}/components/esp8266/include/esp8266/ $ENV{IDF_PATH}/components/esp_ringbuf/include/")
set(COMPONENT_SRCS "./source/DAP.c ./source/DAP_vendor.c ./source/JTAG_DP.c ./source/SW_DP.c ./source/SWO.c ./source/uart_modify.c ./source/spi_op.c ./source/spi_switch.c ./source/dap_utility.c")

View File

@ -44,15 +44,20 @@
#include <stdint.h>
#include <string.h>
#include "cmsis_compiler.h"
#include "main/dap_configuration.h"
#include "main/timer.h"
#include "components/DAP/include/cmsis_compiler.h"
#include "components/DAP/include/gpio_op.h"
#include "components/DAP/include/spi_switch.h"
#include "gpio.h"
#include "gpio_struct.h"
#include "timer.h"
#include "esp8266/pin_mux_register.h"
#include "gpio_op.h"
#include "spi_switch.h"
#include "dap_configuration.h"
//**************************************************************************************************
/**
\defgroup DAP_Config_Debug_gr CMSIS-DAP Debug Unit Information

View File

@ -1,7 +1,8 @@
#ifndef __GPIO_OP_H__
#define __GPIO_OP_H__
#include "cmsis_compiler.h"
#include "components/DAP/include/cmsis_compiler.h"
#include "gpio.h"
#include "gpio_struct.h"
#include "timer_struct.h"

View File

@ -27,6 +27,7 @@ extern "C" {
#include "esp_err.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "freertos/semphr.h"

View File

@ -26,10 +26,10 @@
*---------------------------------------------------------------------------*/
#include <string.h>
#include "DAP_config.h"
#include "DAP.h"
#include "spi_switch.h"
#include "components/DAP/config/DAP_config.h"
#include "components/DAP/include/DAP.h"
#include "components/DAP/include/spi_switch.h"
#if (DAP_PACKET_SIZE < 64U)
@ -388,6 +388,8 @@ static uint32_t DAP_SWJ_Clock(const uint8_t *request, uint8_t *response) {
if (DAP_Data.debug_port != DAP_PORT_JTAG) {
DAP_SPI_Init();
SWD_TransferSpeed = kTransfer_SPI;
} else {
SWD_TransferSpeed = kTransfer_GPIO_fast;
}
DAP_Data.fast_clock = 1U;
DAP_Data.clock_delay = 1U;

View File

@ -25,8 +25,8 @@
*
*---------------------------------------------------------------------------*/
#include "DAP_config.h"
#include "DAP.h"
#include "components/DAP/config/DAP_config.h"
#include "components/DAP/include/DAP.h"
//**************************************************************************************************
/**

View File

@ -25,8 +25,8 @@
*
*---------------------------------------------------------------------------*/
#include "DAP_config.h"
#include "DAP.h"
#include "components/DAP/config/DAP_config.h"
#include "components/DAP/include/DAP.h"
// JTAG Macros

View File

@ -38,16 +38,16 @@
*
*---------------------------------------------------------------------------*/
#include "DAP_config.h"
#include "DAP.h"
#include "components/DAP/config/DAP_config.h"
#include "components/DAP/include/DAP.h"
#include "components/DAP/include/uart_modify.h"
#include "components/DAP/include/swo.h"
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "uart_modify.h"
#include "swo.h"
EventGroupHandle_t kSwoThreadEventGroup;

View File

@ -39,13 +39,14 @@
*
*/
#include <stdio.h>
#include "DAP_config.h"
#include "DAP.h"
#include "components/DAP/config/DAP_config.h"
#include "components/DAP/include/DAP.h"
#include "components/DAP/include/spi_op.h"
#include "components/DAP/include/spi_switch.h"
#include "components/DAP/include/dap_utility.h"
#include "spi_op.h"
#include "spi_switch.h"
#include "dap_utility.h"
// Debug
#define PRINT_SWD_PROTOCOL 0

View File

@ -1,4 +1,4 @@
#include "dap_utility.h"
#include "components/DAP/include/dap_utility.h"
const uint8_t kParityByteTable[256] =
{

View File

@ -14,10 +14,13 @@
#include <stdio.h>
#include <stdbool.h>
#include "main/dap_configuration.h"
#include "components/DAP/include/cmsis_compiler.h"
#include "components/DAP/include/spi_op.h"
#include "esp8266/spi_struct.h"
#include "cmsis_compiler.h"
#include "spi_op.h"
#include "dap_configuration.h"
#define DAP_SPI SPI1

View File

@ -12,14 +12,13 @@
*/
#include <stdbool.h>
#include "components/DAP/include/cmsis_compiler.h"
#include "components/DAP/include/spi_switch.h"
#include "esp8266/spi_struct.h"
#include "esp8266/pin_mux_register.h"
#include "esp8266/gpio_struct.h"
#include "cmsis_compiler.h"
#include "spi_switch.h"
#include "dap_configuration.h"
#define DAP_SPI SPI1

View File

@ -19,6 +19,11 @@
#include <stdlib.h>
#include <string.h>
#include "components/DAP/config/DAP_config.h"
#include "components/DAP/include/uart_modify.h"
#include "components/DAP/include/swo.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
@ -26,12 +31,9 @@
#include "freertos/ringbuf.h"
#include "freertos/event_groups.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_attr.h"
// SWO modify
#include "DAP_config.h"
#include "esp8266/uart_struct.h"
#include "esp8266/uart_register.h"
#include "esp8266/pin_mux_register.h"
@ -39,9 +41,6 @@
#include "esp8266/rom_functions.h"
#include "rom/ets_sys.h"
#include "uart_modify.h"
#include "swo.h"
#include "driver/uart_select.h"
#define portYIELD_FROM_ISR() taskYIELD()

View File

@ -1,4 +1,4 @@
set(COMPONENT_ADD_INCLUDEDIRS ". ../../main")
set(COMPONENT_SRCS "MSOS20Descriptors.c USB_handle.c USBd_config.c")
set(COMPONENT_SRCS "MSOS20_descriptor.c usb_handle.c usb_descriptor.c")
register_component()

View File

@ -1,5 +1,5 @@
/**
* @file MSOS20Descriptors.c
* @file MSOS20_descriptor.c
* @author windowsair
* @brief Store related data of Microsoft OS 2.0 descriptor
* @change: 2021-5-12 Add support for USB 3.0
@ -13,7 +13,8 @@
////TODO: refactoring into structure
#include <stdint.h>
#include "MSOS20Descriptors.h"
#include "components/USBIP/MSOS20_descriptor.h"
#define USBShort(ui16Value) ((ui16Value) & 0xff), ((ui16Value) >> 8) //((ui16Value) & 0xFF),(((ui16Value) >> 8) & 0xFF)

View File

@ -1,5 +1,5 @@
/**
* @file MSOS20Descriptors.h
* @file MSOS20_descriptor.h
* @author windowsair
* @brief
* @version 0.2
@ -9,10 +9,9 @@
*
*/
#ifndef __MSOS20DESCRIPTORS_H__
#define __MSOS20DESCRIPTORS_H__
#ifndef __MSOS20_DESCRIPTOR_H__
#define __MSOS20_DESCRIPTOR_H__
#include "dap_configuration.h"
#define kLengthOfMsOS20 0xA2

View File

@ -1,6 +1,6 @@
////TODO: refactoring into structure
/**
* @file USBd_config.c
* @file usb_descriptor.c
* @brief Standard USB Descriptor Definitions
* @change: 2020-1-23 : fix bugs
* 2021-5-12 : Add support for USB 3.0
@ -11,8 +11,9 @@
*/
#include <stdint.h>
#include <stdbool.h>
#include "USBd_config.h"
#include "usb_defs.h"
#include "components/USBIP/usb_descriptor.h"
#include "components/USBIP/usb_defs.h"
#define USBShort(ui16Value) ((ui16Value) & 0xff), ((ui16Value) >> 8)

View File

@ -1,7 +1,7 @@
#ifndef __USBD_CONFIG_H__
#define __USBD_CONFIG_H__
#ifndef __USB_DESCRIPTOR_H__
#define __USB_DESCRIPTOR_H__
#include "dap_configuration.h"
#include "main/dap_configuration.h"
// Vendor ID assigned by USB-IF (idVendor).
#define USBD0_DEV_DESC_IDVENDOR 0xC251

View File

@ -9,15 +9,17 @@
*/
#include <stdint.h>
#include <string.h>
#include "main/usbip_server.h"
#include "components/USBIP/usb_handle.h"
#include "components/USBIP/usb_descriptor.h"
#include "components/USBIP/MSOS20_descriptor.h"
#include "lwip/err.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
#include <lwip/netdb.h>
#include "USB_handle.h"
#include "USBd_config.h"
#include "usbip_server.h"
#include "usb_defs.h"
#include "MSOS20Descriptors.h"
const char *strings_list[] = {

View File

@ -1,7 +1,8 @@
#ifndef __USB_HANDLE_H__
#define __USB_HANDLE_H__
#include "usbip_defs.h"
#include "components/USBIP/usbip_defs.h"
void handleUSBControlRequest(usbip_stage2_header *header);
#endif

View File

@ -20,7 +20,8 @@
#define __USBIP_DEFS_H__
#include <stdint.h>
#include "usb_defs.h"
#include "components/USBIP/usb_defs.h"
#define USBIP_SYSFS_PATH_SIZE 256
#define USBIP_BUSID_SIZE 32

View File

@ -1,4 +1,4 @@
set(COMPONENT_ADD_INCLUDEDIRS ". $ENV{IDF_PATH}/components/esp8266/include/esp8266/ ../components/USBIP")
set(COMPONENT_ADD_INCLUDEDIRS "${PROJECT_PATH}")
set(COMPONENT_SRCS "main.c timer.c tcp_server.c usbip_server.c DAP_handle.c")
register_component()

View File

@ -13,13 +13,13 @@
#include <stdint.h>
#include <string.h>
#include "usbip_server.h"
#include "DAP_handle.h"
#include "DAP.h"
#include "esp_libc.h"
#include "USBd_config.h"
#include "swo.h"
#include "dap_configuration.h"
#include "main/usbip_server.h"
#include "main/DAP_handle.h"
#include "main/dap_configuration.h"
#include "components/USBIP/usb_descriptor.h"
#include "components/DAP/include/DAP.h"
#include "components/DAP/include/swo.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

View File

@ -1,7 +1,7 @@
#ifndef __DAP_HANDLE_H__
#define __DAP_HANDLE_H__
#include "usbip_defs.h"
#include "components/USBIP/usbip_defs.h"
void handle_dap_data_request(usbip_stage2_header *header, uint32_t length);
void handle_dap_data_response(usbip_stage2_header *header);

View File

@ -9,6 +9,11 @@
#include <string.h>
#include <stdint.h>
#include <sys/param.h>
#include "main/tcp_server.h"
#include "main/timer.h"
#include "main/wifi_configuration.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
@ -23,11 +28,6 @@
#include "lwip/sys.h"
#include <lwip/netdb.h>
#include "tcp_server.h"
#include "timer.h"
#include "wifi_configuration.h"
#include "DAP_config.h"
extern void DAP_Setup(void);
extern void DAP_Thread(void *argument);

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"

View File

@ -12,6 +12,10 @@
#include <string.h>
#include <stdint.h>
#include <sys/param.h>
#include "main/wifi_configuration.h"
#include "main/usbip_server.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
@ -26,9 +30,6 @@
#include "lwip/sys.h"
#include <lwip/netdb.h>
#include "wifi_configuration.h"
#include "usbip_server.h"
extern TaskHandle_t kDAPTaskHandle;
extern int kRestartDAPHandle;

View File

@ -12,12 +12,9 @@
#include <stdint.h>
#include <stdbool.h>
#include "timer.h"
#include "main/timer.h"
#include "hw_timer.h"
#include "timer_struct.h"
#include "cmsis_compiler.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"

View File

@ -1,17 +1,17 @@
#include <stdint.h>
#include <string.h>
#include "main/usbip_server.h"
#include "main/DAP_handle.h"
#include "components/USBIP/usb_handle.h"
#include "components/USBIP/usb_descriptor.h"
#include "lwip/err.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
#include <lwip/netdb.h>
#include "usbip_server.h"
#include "usbip_defs.h"
#include "usb_defs.h"
#include "USBd_config.h"
#include "DAP_handle.h"
#include "USB_handle.h"
#include "USBd_config.h"
// attach helper function
static int read_stage1_command(uint8_t *buffer, uint32_t length);

View File

@ -1,7 +1,9 @@
#ifndef __USBIP_SERVER_H__
#define __USBIP_SERVER_H__
#include <stdint.h>
#include "usbip_defs.h"
#include "components/USBIP/usbip_defs.h"
enum state_t
{
ACCEPTING,