diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 000000000..28d4718b2 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,41 @@ +{ + "configurations": [ + { + "name": "FT900", + "includePath": [ + // Toolchain installed FT90X SDK. + "C:/Program Files (x86)/Bridgetek/FT9xx Toolchain/Toolchain/hardware/include", + // Submodule for FT90X SDK. + //"${workspaceFolder}/hw/mcu/bridgetek/ft9xx/hardware/Source/include", + // Board headers. + "${workspaceFolder}/hw/bsp/brtmm90x/boards/mm900evxb", + // Hardware abstraction headers. + "${workspaceFolder}/hw/", + // Local header files. + ".", + "${workspaceFolder}/src", + // Example headers. + "${workspaceFolder}/examples/device/cdc_msc/src" + //"${workspaceFolder}/examples/host/hid_controller/src" + ], + "defines": [ + "__FT900__", + "BOARD=mm900evxb", + //"FT32_PORT", "FT32_PORT_HEAP=4", // For FreeRTOS + "CFG_TUSB_MCU=OPT_MCU_FT90X", // For FT90x + //"CFG_TUSB_RHPORT0_MODE=(OPT_MODE_HOST|OPT_MODE_HIGH_SPEED)", + //"CFG_TUSB_RHPORT1_MODE=(OPT_MODE_DEVICE|OPT_MODE_HIGH_SPEED)", + //"BOARD_DEVICE_RHPORT_NUM=1", + //"BOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED", + "CFG_TUSB_DEBUG=0" + ], + "windowsSdkVersion": "10.0.18362.0", + "compilerPath": "C:/Program Files (x86)/Bridgetek/FT9xx Toolchain/Toolchain/tools/bin/ft32-elf-gcc", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "windows-gcc-x64", + "configurationProvider": "ms-vscode.makefile-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..7aa6e0616 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,32 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Debug TinyUSB CDC_MSC", + "type": "cppdbg", + "MIMode": "gdb", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "examples/device/program.elf", + //"program": "examples/device/cdc_msc/_build/mm900ev1b/cdc_msc.elf", + "preLaunchTask": "Build and Program (Memory)", + "target": "localhost:9998", + "remote": true, + "gdbpath": "C:/Program Files (x86)/Bridgetek/FT9xx Toolchain/Toolchain/tools/bin/ft32-elf-gdb.exe", + "stopAtEntry": true, + "environment": [], + "console": "externalTerminal", + "miDebuggerPath": "C:/Program Files (x86)/Bridgetek/FT9xx Toolchain/Toolchain/tools/bin/ft32-elf-gdb.exe", + //"miDebuggerArgs": "-x lib\\FreeRTOS\\.gdbinit-FreeRTOS-helpers", + "miDebuggerServerAddress": "localhost:9998", + "launchCompleteCommand": "None", + "debugServerPath": "C:\\Users\\gordon.mcnab\\AppData\\Local\\Programs\\Python\\Python37\\python.exe", + "debugServerArgs": + "\"C:/Program Files (x86)/Bridgetek/FT9xx Toolchain/Toolchain/utilities/gdb_bridge.py\" live pm", + //"rtos": "FreeRTOS", + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..b0aef0cf8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,17 @@ +{ + "files.associations": { + "tusb_option.h": "c", + "ft900.h": "c", + "ft900_usbd.h": "c", + "ft900_registers.h": "c", + "ft900_usbd_registers.h": "c", + "dcd.h": "c", + "stdint.h": "c", + "board.h": "c", + "ft900_ehci_registers.h": "c", + "stdint-gcc.h": "c", + "ft900_memctl.h": "c", + "stddef.h": "c" + }, + "cmake.configureOnOpen": true +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..459351c4f --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,176 @@ +{ + "version": "2.0.0", + + "options": { + "env": { + // Set this to the type of example. + // Choices can be "device" or "host". + "exampleType": "device", + // Set this to the name of the example. + // The name is the folder name in the examples directory. + "exampleName": "cdc_msc", + // Set this to the name of the board to target. + "boardName": "mm900evxb" + } + }, + + "inputs": [ + { + "type": "pickString", + "id": "pickExampleName", + "description": "Which example project do you want to use?", + "options": [ + "board_test", + "cdc_msc", + "hid_boot_interface", + "hid_composite", + + ], + "default": "board_test" + }, + { + "type": "pickString", + "id": "pickBoardName", + "description": "Which board type do you want to use?", + "options": [ + "mm900ev1b", + "mm900ev2b", + "mm900ev3b" + ], + "default": "mm900ev1b" + } + ], + + "tasks": [ + { + "label": "test env", + "type": "shell", + "command": "echo", + "args": [ + "$env:exampleName" + ], + "problemMatcher": [] + }, + { + "label": "Build and Program (Memory)", + "dependsOrder": "sequence", + "dependsOn": [ + "Build Project", + "Program Project (Memory)" + ], + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "copy", + "args": [ + "examples\\$env:exampleType\\$env:exampleName\\_build\\$env:boardName\\$env:exampleName.elf", + "examples\\$env:exampleType\\program.elf" + ], + "problemMatcher": { + "pattern": { + "regexp": "^Error:\\s+(.*)$", + "message": 1 + } + } + }, + { + "label": "Build Project", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "make.exe", + "args": [ + "-C", + "examples\\$env:exampleType\\$env:exampleName", + "BOARD=$env:boardName" + ], + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Rebuild Project", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "make.exe", + "args": [ + "-C", + "examples\\$env:exampleType\\$env:exampleName", + "BOARD=$env:boardName", + "-B" + ], + "problemMatcher": [ + "$gcc" + ], + "group": "build" + }, + { + "label": "Clean Project", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "make.exe", + "args": [ + "-C", + "examples\\$env:exampleType\\$env:exampleName", + "BOARD=$env:boardName", + "clean" + ], + "problemMatcher": [ + "$gcc" + ], + "group": "build" + }, + { + "label": "Program Project (Flash)", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "C:\\Program Files (x86)\\Bridgetek\\FT9xx Toolchain\\Toolchain\\programmer\\dist\\FT900Prog.exe", + "args": [ + "--loadflash", + "examples\\$env:exampleType\\$env:exampleName\\_build\\$env:boardName\\$env:exampleName.bin", + "--onewire", + "--noReset" + ], + "problemMatcher": { + "pattern": { + "regexp": "^Error:\\s+(.*)$", + "message": 1 + } + }, + "dependsOn": "${defaultBuildTask}" + }, + { + "label": "Program Project (Memory)", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "C:\\Program Files (x86)\\Bridgetek\\FT9xx Toolchain\\Toolchain\\programmer\\dist\\FT900Prog.exe", + "args": [ + "--loadpm", + "examples\\$env:exampleType\\$env:exampleName\\_build\\$env:boardName\\$env:exampleName.bin", + "--onewire", + "--noReset" + ], + "problemMatcher": { + "pattern": { + "regexp": "^Error:\\s+(.*)$", + "message": 1 + } + }, + "dependsOn": "${defaultBuildTask}" + } + ], +} \ No newline at end of file diff --git a/examples/make.mk b/examples/make.mk index 793c40aa2..e1cd0af2a 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -104,10 +104,11 @@ CFLAGS += \ -Wmissing-format-attribute \ -Wunreachable-code \ -Wcast-align \ - -Wcast-function-type \ -Wcast-qual \ -Wnull-dereference +# -Wcast-function-type \ + # Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -Og diff --git a/examples/rules.mk b/examples/rules.mk index 4cc35cb22..a12a75d60 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -84,7 +84,7 @@ OBJ_DIRS = $(sort $(dir $(OBJ))) $(OBJ): | $(OBJ_DIRS) $(OBJ_DIRS): ifeq ($(CMDEXE),1) - @$(MKDIR) $(subst /,\,$@) + -@$(MKDIR) $(subst /,\,$@) else @$(MKDIR) -p $@ endif @@ -207,7 +207,7 @@ debug-bmp: $(BUILD)/$(PROJECT).elf # Create binary directory $(BIN): - @$(MKDIR) -p $@ + -@$(MKDIR) -p $@ # Copy binaries .elf, .bin, .hex, .uf2 to BIN for upload # due to large size of combined artifacts, only uf2 is uploaded for now