From f3ff40724abfdc4118f8bdec20a58b4f5794e33a Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 3 Jun 2021 22:34:49 -0700 Subject: [PATCH] simulator usability (#2794) * simulator * simulator is debuggable * s * format --- .vscode/launch.json | 112 ++++++++++++++----------- .vscode/tasks.json | 198 ++++++++++++++++++++++++-------------------- simulator/Makefile | 2 +- 3 files changed, 173 insertions(+), 139 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9ad160ec24..088c9a212a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -24,6 +24,24 @@ } ] }, + { + "name": "Debug simulator (gdb)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/simulator/build/rusefi_simulator", + "stopAtEntry": false, + "cwd": "${workspaceFolder}/simulator/", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, { "name": "Debug Unit Tests (lldb)", "type": "lldb", @@ -33,56 +51,56 @@ "cwd": "${workspaceFolder}/unit_tests/build/", }, { - "name": "Debug F40x", - "type": "cortex-debug", - "request": "launch", - "cwd": "${workspaceFolder}/firmware", - "executable": "${workspaceRoot}/firmware/build/rusefi.elf", - "device": "STM32F407V", - "v1": false, - "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32F405.svd", - "servertype": "openocd", - "configFiles": ["interface/stlink.cfg", "target/stm32f4x.cfg"], - "runToMain": true + "name": "Debug F40x", + "type": "cortex-debug", + "request": "launch", + "cwd": "${workspaceFolder}/firmware", + "executable": "${workspaceRoot}/firmware/build/rusefi.elf", + "device": "STM32F407V", + "v1": false, + "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32F405.svd", + "servertype": "openocd", + "configFiles": ["interface/stlink.cfg", "target/stm32f4x.cfg"], + "runToMain": true }, { - "name": "Debug F42x", - "type": "cortex-debug", - "request": "launch", - "cwd": "${workspaceFolder}/firmware", - "executable": "${workspaceRoot}/firmware/build/rusefi.elf", - "device": "STM32F429Z", - "v1": false, - "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32F427.svd", - "servertype": "openocd", - "configFiles": ["interface/stlink.cfg", "target/stm32f4x.cfg"], - "runToMain": true + "name": "Debug F42x", + "type": "cortex-debug", + "request": "launch", + "cwd": "${workspaceFolder}/firmware", + "executable": "${workspaceRoot}/firmware/build/rusefi.elf", + "device": "STM32F429Z", + "v1": false, + "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32F427.svd", + "servertype": "openocd", + "configFiles": ["interface/stlink.cfg", "target/stm32f4x.cfg"], + "runToMain": true }, { - "name": "Debug F7x6", - "type": "cortex-debug", - "request": "launch", - "cwd": "${workspaceFolder}/firmware", - "executable": "${workspaceRoot}/firmware/build/rusefi.elf", - "device": "STM32F767V", - "v1": false, - "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32F7x7.svd", - "servertype": "openocd", - "configFiles": ["interface/stlink.cfg", "target/stm32f7x.cfg"], - "runToMain": true - }, - { - "name": "Debug H743", - "type": "cortex-debug", - "request": "launch", - "cwd": "${workspaceFolder}/firmware", - "executable": "${workspaceRoot}/firmware/build/rusefi.elf", - "device": "STM32H743V", - "v1": false, - "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32H743x.svd", - "servertype": "openocd", - "configFiles": ["interface/stlink.cfg", "target/stm32h7x.cfg"], - "runToMain": true - } + "name": "Debug F7x6", + "type": "cortex-debug", + "request": "launch", + "cwd": "${workspaceFolder}/firmware", + "executable": "${workspaceRoot}/firmware/build/rusefi.elf", + "device": "STM32F767V", + "v1": false, + "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32F7x7.svd", + "servertype": "openocd", + "configFiles": ["interface/stlink.cfg", "target/stm32f7x.cfg"], + "runToMain": true + }, + { + "name": "Debug H743", + "type": "cortex-debug", + "request": "launch", + "cwd": "${workspaceFolder}/firmware", + "executable": "${workspaceRoot}/firmware/build/rusefi.elf", + "device": "STM32H743V", + "v1": false, + "svdFile": "${workspaceRoot}/firmware/ext/cmsis-svd/data/STMicro/STM32H743x.svd", + "servertype": "openocd", + "configFiles": ["interface/stlink.cfg", "target/stm32h7x.cfg"], + "runToMain": true + } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b23f2ef20e..d53fdf41d2 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,133 +3,149 @@ // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ - { - "label": "Build Firmware (Frankenso/default)", - "type": "shell", - "command": "make -j12", + { + "label": "Build Firmware (Frankenso/default)", + "type": "shell", + "command": "make -j12", "windows": { "command": "wsl bash -lc 'make -j12'" }, - "options": { - "cwd": "${workspaceRoot}/firmware" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } }, { - "label": "Build Firmware (Proteus F4)", - "type": "shell", - "command": "make -j12 PROJECT_BOARD=proteus", - "windows": { + "label": "Build Firmware (Proteus F4)", + "type": "shell", + "command": "make -j12 PROJECT_BOARD=proteus", + "windows": { "command": "wsl bash -lc 'make -j12 PROJECT_BOARD=proteus'" }, - "options": { - "cwd": "${workspaceRoot}/firmware" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } }, { - "label": "Build Firmware (Proteus F7)", - "type": "shell", - "command": "make -j16 PROJECT_BOARD=proteus PROJECT_CPU=ARCH_STM32F7", + "label": "Build Firmware (Proteus F7)", + "type": "shell", + "command": "make -j16 PROJECT_BOARD=proteus PROJECT_CPU=ARCH_STM32F7", "windows": { "command": "wsl bash -lc 'make -j12 PROJECT_BOARD=proteus PROJECT_CPU=ARCH_STM32F7'" }, - "options": { - "cwd": "${workspaceRoot}/firmware" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } }, { - "label": "Build Firmware (Proteus H7) EXPERIMENTAL", - "type": "shell", - "command": "make -j16 PROJECT_BOARD=proteus PROJECT_CPU=ARCH_STM32H7", + "label": "Build Firmware (Proteus H7) EXPERIMENTAL", + "type": "shell", + "command": "make -j16 PROJECT_BOARD=proteus PROJECT_CPU=ARCH_STM32H7", "windows": { "command": "wsl bash -lc 'make -j12 PROJECT_BOARD=proteus PROJECT_CPU=ARCH_STM32H7'" }, - "options": { - "cwd": "${workspaceRoot}/firmware" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } }, { - "label": "Build Firmware (hellen72)", - "type": "shell", - "command": "make -j16 PROJECT_BOARD=hellen/hellen72", + "label": "Build Firmware (hellen72)", + "type": "shell", + "command": "make -j16 PROJECT_BOARD=hellen/hellen72", "windows": { "command": "wsl bash -lc 'make -j12 PROJECT_BOARD=hellen/hellen72'" }, - "options": { - "cwd": "${workspaceRoot}/firmware" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } }, { - "label": "Build Firmware (microRusEfi F4)", - "type": "shell", - "command": "make -j12 PROJECT_BOARD=microrusefi", + "label": "Build Firmware (microRusEfi F4)", + "type": "shell", + "command": "make -j12 PROJECT_BOARD=microrusefi", "windows": { "command": "wsl bash -lc 'make -j12 PROJECT_BOARD=microrusefi'" }, - "options": { - "cwd": "${workspaceRoot}/firmware" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } }, { - "label": "Build Firmware (microRusEfi F7)", - "type": "shell", - "command": "make -j12 PROJECT_BOARD=microrusefi PROJECT_CPU=ARCH_STM32F7", + "label": "Build Firmware (microRusEfi F7)", + "type": "shell", + "command": "make -j12 PROJECT_BOARD=microrusefi PROJECT_CPU=ARCH_STM32F7", "windows": { "command": "wsl bash -lc 'make -j12 PROJECT_BOARD=microrusefi PROJECT_CPU=ARCH_STM32F7'" }, - "options": { - "cwd": "${workspaceRoot}/firmware" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "options": { + "cwd": "${workspaceRoot}/firmware" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } }, { - "label": "Build Unit Tests", - "type": "shell", - "command": "make -j12", + "label": "Build Unit Tests", + "type": "shell", + "command": "make -j12", "windows": { "command": "wsl make -j12" }, - "options": { - "cwd": "${workspaceRoot}/unit_tests" - }, - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } - } + "options": { + "cwd": "${workspaceRoot}/unit_tests" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Build Simulator", + "type": "shell", + "command": "make -j12", + "windows": { + "command": "wsl make -j12" + }, + "options": { + "cwd": "${workspaceRoot}/simulator" + }, + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + } ] } \ No newline at end of file diff --git a/simulator/Makefile b/simulator/Makefile index 19ba6eee49..799347c5af 100644 --- a/simulator/Makefile +++ b/simulator/Makefile @@ -34,7 +34,7 @@ ifeq ($(USE_OPT),) # this config producec a smaller binary file # 7.3 compiler would want -Wno-error=implicit-fallthrough while 6.4 does not know about it # see https://github.com/rusefi/rusefi/issues/517 - USE_OPT = -Wall -O2 -Wno-error=implicit-fallthrough -Wno-error=write-strings -Wno-error=strict-aliasing + USE_OPT = -Wall -Og -g -Wno-error=implicit-fallthrough -Wno-error=write-strings -Wno-error=strict-aliasing ifeq ($(OS),Windows_NT) else