From 4f1513d088d074ef5ec7880be240c448a1fb5333 Mon Sep 17 00:00:00 2001 From: Stefan Liebl Date: Thu, 25 Jan 2024 15:34:39 +0100 Subject: [PATCH] oselas gcc updates --- vimfiles.stefan/plugin/toptica.vim | 110 +++++++++++++++++++---------- 1 file changed, 71 insertions(+), 39 deletions(-) diff --git a/vimfiles.stefan/plugin/toptica.vim b/vimfiles.stefan/plugin/toptica.vim index 286fa7b..0be36b5 100644 --- a/vimfiles.stefan/plugin/toptica.vim +++ b/vimfiles.stefan/plugin/toptica.vim @@ -14,6 +14,10 @@ command -nargs=1 -complete=dir OperationPanelF4 call s:ProjectSet('operation-pan command -nargs=1 -complete=dir DeCoF call s:ProjectSet('decof', '') command DeviceFirmwareUpdate call s:DeviceFirmwareUpdate() command -nargs=? -complete=file JenkinsLinter call s:Jenkins_linter('') +command SetOselasGcc4 call s:set_oselas_gcc4() +command SetOselasGcc11 call s:set_oselas_gcc() + +let s:path_orig = $PATH function s:ProjectSet(project_type, project_base_dir) let g:project_type = a:project_type @@ -61,14 +65,41 @@ function s:ProjectSet(project_type, project_base_dir) let s:ProjectSrcDir = s:ProjectBaseDir.'/'.g:ProjectSrcDirRel let g:ProjectBuildDir = s:ProjectBaseDir.'/build' + let s:oselas_gcc4_lastname = 'arm-cortexa8-linux-gnueabi' + let s:oselas_gcc4_root = '/opt/OSELAS.Toolchain-2012.12.1/'.s:oselas_gcc4_lastname.'/'. + \'gcc-4.7.3-glibc-2.16.0-binutils-2.22-kernel-3.6-sanitized/' + let s:oselas_gcc_lastname = 'arm-v7a-linux-gnueabihf' + let s:oselas_gcc_root = '/opt/OSELAS.Toolchain-2021.07.0/'.s:oselas_gcc_lastname.'/'. + \'gcc-11.1.1-clang-12.0.0-glibc-2.33-binutils-2.36.1-kernel-5.12.4-sanitized/' + + function! s:set_oselas_gcc4() + let g:GccRoot = s:oselas_gcc4_root + " let g:termdebugger = s:oselas_gcc4_root . 'bin/'.s:oselas_gcc4_lastname.'-gdb' + let g:termdebugger = s:oselas_gcc_root . 'bin/'.s:oselas_gcc_lastname.'-gdb' + let g:oselas_gcc_solib_paths = s:oselas_gcc4_root.'/'.s:oselas_gcc4_lastname.'/lib/'.':'. + \ s:oselas_gcc4_root.'/sysroot-'.s:oselas_gcc4_lastname.'/lib/'.':'. + \ s:oselas_gcc4_root.'/sysroot-'.s:oselas_gcc4_lastname.'/usr/lib/' + " let $PATH = s:oselas_gcc4_root.'/sysroot-'.s:oselas_gcc4_lastname.'/usr/include'.':'.s:path_orig + let g:analyser = s:oselas_gcc_root . 'bin/'.s:oselas_gcc_lastname.'-gcc' + let g:new_compiler = ' -DNEW_COMPILER=OFF' + endfunction + + function! s:set_oselas_gcc() + let g:GccRoot = s:oselas_gcc_root + let g:termdebugger = s:oselas_gcc_root . 'bin/'.s:oselas_gcc_lastname.'-gdb' + let g:oselas_gcc_solib_paths = s:oselas_gcc_root.'/'.s:oselas_gcc_lastname.'/lib/'.':'. + \ s:oselas_gcc_root.'/sysroot-'.s:oselas_gcc_lastname.'/lib/'.':'. + \ s:oselas_gcc_root.'/sysroot-'.s:oselas_gcc_lastname.'/usr/lib/' + " let $PATH = s:oselas_gcc_root.'/sysroot-'.s:oselas_gcc_lastname.'/usr/include'.':'.s:path_orig + let g:analyser = s:oselas_gcc4_root . 'bin/'.s:oselas_gcc4_lastname.'-gcc' + let g:new_compiler = ' -DNEW_COMPILER=ON' + endfunction + " vim path execute 'cd '.s:ProjectSrcDir execute 'set path-=./**' execute 'set path+=' . s:ProjectSrcDir.'/**' execute 'set path+=' . g:ProjectBuildDir.'/**' - let s:oselas_include = '/sysroot-arm-cortexa8-linux-gnueabi/usr/include' - let s:oselas_gdb_4 = '/opt/OSELAS.Toolchain-2012.12.1/arm-cortexa8-linux-gnueabi/gcc-4.7.3-glibc-2.16.0-binutils-2.22-kernel-3.6-sanitized/bin/arm-cortexa8-linux-gnueabi-gdb' - let s:oselas_gdb = '/opt/OSELAS.Toolchain-2021.07.0/arm-v7a-linux-gnueabihf/gcc-11.1.1-clang-12.0.0-glibc-2.33-binutils-2.36.1-kernel-5.12.4-sanitized/bin/arm-v7a-linux-gnueabihf-gdb' let s:jlink_path = '/home/stefan/opt/SEGGER/JLink_Linux_V654a_x86_64' if (g:project_type == 'dlcpro') @@ -79,18 +110,15 @@ function s:ProjectSet(project_type, project_base_dir) set wildignore+=**/shg-firmware/** let s:makegoals = ['artifacts-firmware', 'artifacts-docu', 'artifacts', 'device-control', 'user-interface', 'doxygen', 'fw-updates', 'shg-firmware', 'can-updater', 'specalyser', 'docu-ul0', 'code-generation', 'dependency-graphs', 'decof', 'decof-sdk', 'clean', 'distclean', 'help', 'jamplayer', 'dlcpro-slot'] let s:makeprg = 'make' - let g:DeviceIP = 'DLC_PRO__040083' + let g:DeviceIP = 'dlc_pro__040083' let g:DebugRemote = v:true let g:GdbPort = '2345' - let g:GccRoot = "/opt/OSELAS.Toolchain-2012.12.1/arm-cortexa8-linux-gnueabi/gcc-4.7.3-glibc-2.16.0-binutils-2.22-kernel-3.6-sanitized" - let g:termdebugger = s:oselas_gdb let g:SshOpts = "" let g:SshOpts2 = "" - execute 'set path+=' . g:GccRoot . s:oselas_include + call s:set_oselas_gcc() command DlcproEmissionOn call s:DlcproEmission('1') command DlcproEmissionOff call s:DlcproEmission('0') command DlcproShutup call s:DlcproShutup() -" let g:ycm_clangd_args = ['--all-scopes-completion', '--header-insertion=iwyu', '--suggest-missing-includes', '--enable-config', '-isystem '.g:GccRoot . s:oselas_include] elseif (g:project_type == 'dlcpro-tui') let s:Program = '/user-interface/src/user-interface' let s:Elffile = s:Program @@ -99,15 +127,14 @@ function s:ProjectSet(project_type, project_base_dir) set wildignore+=**/shg-firmware/** let s:makegoals = ['artifacts-firmware', 'artifacts', 'device-control', 'user-interface', 'doxygen', 'fw-updates', 'shg-firmware', 'can-updater', 'specalyser', 'docu-ul0', 'code-generation', 'dependency-graphs', 'clean', 'distclean', 'help', 'jamplayer', 'dlcpro-slot'] let s:makeprg = 'make' - let g:DeviceIP = 'DLC_PRO__040083' + let g:DeviceIP = 'dlc_pro__040083' let g:DebugRemote = v:true let g:GdbPort = '2345' - let g:GccRoot = "/opt/OSELAS.Toolchain-2012.12.1/arm-cortexa8-linux-gnueabi/gcc-4.7.3-glibc-2.16.0-binutils-2.22-kernel-3.6-sanitized" - let g:termdebugger = s:oselas_gdb let g:SshOpts = "" let g:SshOpts2 = "" - execute 'set path+=' . g:GccRoot . s:oselas_include - command DlcproTuiStart execute('!cd user-interface/src && ../../../build/user-interface/src/user-interface&') + call s:set_oselas_gcc4() + " command DlcproTuiStart execute('!cd user-interface/src && ../../../build/user-interface/src/user-interface&') + command DlcProTuiStart call s:DlcproTuiStart() elseif (g:project_type == 'dlcpro-can') let s:Program = '/canopen/can-updater' let s:Elffile = s:Program @@ -116,15 +143,12 @@ function s:ProjectSet(project_type, project_base_dir) set wildignore+=**/shg-firmware/** let s:makegoals = [] let s:makeprg = 'make' - let g:DeviceIP = 'DLC_PRO__040083' + let g:DeviceIP = 'dlc_pro__040083' let g:DebugRemote = v:true let g:GdbPort = '2345' - let g:GccRoot = "/opt/OSELAS.Toolchain-2012.12.1/arm-cortexa8-linux-gnueabi/gcc-4.7.3-glibc-2.16.0-binutils-2.22-kernel-3.6-sanitized" - let g:termdebugger = s:oselas_gdb let g:SshOpts = "" let g:SshOpts2 = "" - execute 'set path+=' . g:GccRoot . s:oselas_include -" let g:ycm_clangd_args = ['-I'.g:GccRoot . s:oselas_include] + call s:set_oselas_gcc4() elseif (g:project_type == 'dlcpro-specalyser') let s:Program = '/specalyser/specalyser' let s:Elffile = s:Program @@ -133,15 +157,12 @@ function s:ProjectSet(project_type, project_base_dir) set wildignore+=**/shg-firmware/** let s:makegoals = [] let s:makeprg = 'make' - let g:DeviceIP = 'DLC_PRO__040083' + let g:DeviceIP = 'dlc_pro__040083' let g:DebugRemote = v:true let g:GdbPort = '2345' - let g:GccRoot = "/opt/OSELAS.Toolchain-2012.12.1/arm-cortexa8-linux-gnueabi/gcc-4.7.3-glibc-2.16.0-binutils-2.22-kernel-3.6-sanitized" - let g:termdebugger = s:oselas_gdb let g:SshOpts = "" let g:SshOpts2 = "" - execute 'set path+=' . g:GccRoot . s:oselas_include -" let g:ycm_clangd_args = ['-I'.g:GccRoot . s:oselas_include] + call s:set_oselas_gcc4() elseif (g:project_type == 'shg') let s:Program = '/shg-firmware/device-control/device-control-shg' let s:Elffile = s:Program @@ -150,15 +171,11 @@ function s:ProjectSet(project_type, project_base_dir) set wildignore+=**/firmware/src/device-control/** let s:makegoals = ['artifacts-firmware', 'artifacts', 'device-control', 'user-interface', 'doxygen', 'fw-updates', 'shg-firmware', 'can-updater', 'specalyser', 'docu-ul0', 'code-generation', 'dependency-graphs', 'clean', 'distclean', 'help', 'jamplayer', 'dlcpro-slot'] let s:makeprg = 'make' - let g:DeviceIP = 'DLC_PRO__040083' + let g:DeviceIP = 'dlc_pro__040083' let g:DebugRemote = v:true let g:GdbPort = '6666' - let g:GccRoot = "/opt/OSELAS.Toolchain-2012.12.1/arm-cortexa8-linux-gnueabi/gcc-4.7.3-glibc-2.16.0-binutils-2.22-kernel-3.6-sanitized" - let g:termdebugger = s:oselas_gdb let g:SshOpts = '-o ForwardAgent=yes -o ProxyCommand="ssh -o RemoteCommand=none -q -W shg:22 root@%h" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR' let g:SshOpts2 = "-L localhost:1998:localhost:1998 -L localhost:1999:localhost:1999" - execute 'set path+=' . g:GccRoot . s:oselas_include -" let g:ycm_clangd_args = ['-I'.g:GccRoot . s:oselas_include] elseif (g:project_type == 'dlcpro-gui') let s:Program = '/TOPAS_DLC_pro' let s:Elffile = s:Program @@ -175,13 +192,10 @@ function s:ProjectSet(project_type, project_base_dir) let g:DeviceIP = 'topmode_stefan' let g:DebugRemote = v:true let g:GdbPort = '2345' - let g:GccRoot = "/opt/OSELAS.Toolchain-2011.11.3/arm-cortexa8-linux-gnueabi/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized" - let g:termdebugger = s:oselas_gdb + let g:GccRoot = s:oselas_gcc4_root let g:SshOpts = "" let g:SshOpts2 = "" - execute 'set path+=' . g:GccRoot . s:oselas_include - let $PATH = $PATH.':'.g:GccRoot.'/bin' -" let g:ycm_clangd_args = ['-I'.g:GccRoot . s:oselas_include] + call s:set_oselas_gcc4() elseif (g:project_type == 'topmode-gui') let s:Program = '/TOPAS_Topmode' let s:Elffile = s:Program @@ -198,7 +212,7 @@ function s:ProjectSet(project_type, project_base_dir) let g:GdbPort = '2331' let g:GccRoot = '/opt/gcc-arm-none-eabi-8-2019-q3-update' let g:termdebugger = g:GccRoot.'/bin/arm-none-eabi-gdb' - let $PATH = $PATH.':'.g:GccRoot.'/bin' + let $PATH = g:GccRoot.'/bin'.':'.s:path_orig elseif (g:project_type == 'servoboard') let s:Program = '/servo-board-image.bin' let s:Elffile = '/application/servo-board.elf' @@ -208,7 +222,7 @@ function s:ProjectSet(project_type, project_base_dir) let g:GdbPort = '2331' let g:GccRoot = '/home/stefan/opt/gcc/gcc-arm-none-eabi-8-2019-q3-update' let g:termdebugger = g:GccRoot.'/bin/arm-none-eabi-gdb' - let $PATH = g:GccRoot.'/bin'.':'.$PATH + let $PATH = g:GccRoot.'/bin'.':'.s:path_orig elseif (g:project_type == 'dl-motor') let s:Program = '/dl-motor-image.bin' let s:Elffile = '/application/dl-motor.elf' @@ -218,7 +232,7 @@ function s:ProjectSet(project_type, project_base_dir) let g:GdbPort = '2331' let g:GccRoot = '/home/stefan/opt/gcc/gcc-arm-none-eabi-9-2020-q2-update' let g:termdebugger = g:GccRoot.'/bin/arm-none-eabi-gdb' - let $PATH = g:GccRoot.'/bin'.':'.$PATH + let $PATH = g:GccRoot.'/bin'.':'.s:path_orig elseif (g:project_type == 'operation-panel-f1') let g:stm32_target = 'STM32F10X' let s:Program = '/firmware/operation_panel_'.g:stm32_target.'.bin' @@ -230,7 +244,7 @@ function s:ProjectSet(project_type, project_base_dir) let g:GccRoot = '/home/stefan/opt/gcc/gcc-arm-none-eabi-9-2020-q2-update' let g:termdebugger = g:GccRoot.'/bin/arm-none-eabi-gdb' let s:stm_cfg = 'stm32f1x' - let $PATH = g:GccRoot.'/bin'.':'.$PATH + let $PATH = g:GccRoot.'/bin'.':'.s:path_orig elseif (g:project_type == 'operation-panel-f4') let g:stm32_target = 'STM32F4XX' let s:Program = '/firmware/operation_panel_'.g:stm32_target.'.bin' @@ -242,7 +256,7 @@ function s:ProjectSet(project_type, project_base_dir) let g:GccRoot = '/home/stefan/opt/gcc/gcc-arm-none-eabi-9-2020-q2-update' let g:termdebugger = g:GccRoot.'/bin/arm-none-eabi-gdb' let s:stm_cfg = 'stm32f4x' - let $PATH = g:GccRoot.'/bin'.':'.$PATH + let $PATH = g:GccRoot.'/bin'.':'.s:path_orig elseif (g:project_type == 'decof') let s:makegoals = ['all'] let s:makeprg = 'cmake --build . --target' @@ -382,6 +396,7 @@ function s:Cmake(options, async_mode) if (g:project_type == 'dlcpro') let args .= " -DCMAKE_TOOLCHAIN_FILE=../".g:ProjectSrcDirRel."/Toolchain-target.cmake" let args .= " -DBUILD_TARGET=target" + let args .= g:new_compiler elseif (g:project_type == 'dlcpro-tui') let args .= " -DBUILD_TARGET=simulation" let args .= " -DQT5_INSTALL_PATH=/usr/lib/x86_64-linux-gnu/qt5" @@ -461,6 +476,13 @@ function s:Call_and_log(cmd) return v:shell_error endfunction +function s:DlcproTuiStart() + let workdir = s:ProjectSrcDir . '/user-interface/src' + let cmd = g:ProjectBuildDir . '/user-interface/src/user-interface' + call asyncrun#quickfix_toggle(10, 1) + execute 'AsyncRun -mode=async -save=2 -cwd='.workdir.' @ ' . cmd +endfunction + "function s:CopyFirmware(command) " let command = 'bash '.s:GdbSlave.' -h '.g:DeviceIP.' '.a:command "" if a:command == 'update' || a:command == 'start-debug' @@ -482,6 +504,12 @@ function s:JLinkFlashProgram() call term_start(s:ProjectSrcDir.'/flash_firmware.py -j '.s:jlink_path.'/JLinkExe -a 0x8000000 '.g:Program) endfunction +function g:JLinkSWOviewer() + let cmd = s:jlink_path.'/JLinkSWOViewerCLExe -device STM32H743ZI -itmmask 0xffffffff -swofreq 450000' + call asyncrun#quickfix_toggle(10, 1) + execute 'AsyncRun -mode=async @ ' . cmd +endfunction + function s:DeviceUpdateProgramLinux() call s:Call_and_log('ssh -o RemoteCommand=none '.g:SshOpts.' root@'.g:DeviceIP.' "killall -q gdbserver start-dc.sh '.fnamemodify(g:ProgramRemote, ':t').'"') sleep 2 @@ -571,11 +599,15 @@ function s:DeviceDebug(attach) call s:DeviceStartGdbServer() sleep 1 call s:StartDebugger(g:Elffile, a:attach) + sleep 1 call s:SendToDebugger('target extended-remote localhost:'.g:GdbPort) + sleep 1 if exists("g:ProgramRemote") call s:SendToDebugger('set remote exec-file '.g:ProgramRemote) + sleep 1 endif call s:SendToDebugger('file '.g:Elffile) + call s:SendToDebugger('set solib-search-path '. g:oselas_gcc_solib_paths) if ((g:project_type == 'operation-panel-f1') || (g:project_type == 'operation-panel-f4')) call s:SendToDebugger('y') call s:SendToDebugger('monitor reset') @@ -583,6 +615,7 @@ function s:DeviceDebug(attach) call s:SendToDebugger('break main') else call s:SendToDebugger('break main') + sleep 1 call s:SendToDebugger('run') endif execute '2hide' @@ -596,7 +629,6 @@ function s:DeviceDebug(attach) call s:SendToDebugger('set substitute-path '.g:DlcproBasePath.' '.s:ProjectSrcDir) endif -" call s:SendToDebugger('set solib-search-path '.g:GccRoot.'/arm-cortexa8-linux-gnueabi/lib/'.':'.g:GccRoot.'/sysroot-arm-cortexa8-linux-gnueabi/lib/'.':'.g:GccRoot.'/sysroot-arm-cortexa8-linux-gnueabi/usr/lib/') " call s:SendToDebugger('set can-use-hw-watchpoints 0') endfunction