master: operation-pannel + jenkins-linter
This commit is contained in:
parent
03706f8fa2
commit
4c68ea9d9d
@ -9,9 +9,15 @@ command -nargs=1 -complete=dir TopmodeGui call s:ProjectSet('topmode-gui', '<arg
|
||||
command -nargs=1 -complete=dir DigiFalc call s:ProjectSet('digifalc', '<args>')
|
||||
command -nargs=1 -complete=dir ServoBoard call s:ProjectSet('servoboard', '<args>')
|
||||
command -nargs=1 -complete=dir DlMotor call s:ProjectSet('dl-motor', '<args>')
|
||||
command -nargs=1 -complete=dir OperationPanelF1 call s:ProjectSet('operation-panel-f1', '<args>')
|
||||
command -nargs=1 -complete=dir OperationPanelF4 call s:ProjectSet('operation-panel-f4', '<args>')
|
||||
command -nargs=1 -complete=dir DeCoF call s:ProjectSet('decof', '<args>')
|
||||
command DeviceFirmwareUpdate call s:DeviceFirmwareUpdate()
|
||||
command -nargs=? -complete=file JenkinsLinter call s:Jenkins_linter('<args>')
|
||||
|
||||
function s:ProjectSet(project_type, project_base_dir)
|
||||
let g:project_type = a:project_type
|
||||
let g:jenkins_url = 'http://jenkins.toptica.com'
|
||||
|
||||
" directories
|
||||
if a:project_base_dir != ''
|
||||
@ -209,6 +215,31 @@ 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 $PATH = g:GccRoot.'/bin'.':'.$PATH
|
||||
elseif (g:project_type == 'operation-panel-f1')
|
||||
let g:stm32_target = 'STM32F10X'
|
||||
let s:Program = '/firmware/operation_panel_'.g:stm32_target.'.bin'
|
||||
let s:Elffile = '/firmware/operation_panel_'.g:stm32_target.'.elf'
|
||||
let s:makegoals = ['artifacts']
|
||||
let s:makeprg = 'cmake --build . --target'
|
||||
let g:GdbPort = '3333'
|
||||
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
|
||||
elseif (g:project_type == 'operation-panel-f4')
|
||||
let g:stm32_target = 'STM32F4XX'
|
||||
let s:Program = '/firmware/operation_panel_'.g:stm32_target.'.bin'
|
||||
let s:Elffile = '/firmware/operation_panel_'.g:stm32_target.'.elf'
|
||||
let s:makegoals = ['artifacts']
|
||||
let s:makeprg = 'cmake --build . --target'
|
||||
let g:GdbPort = '3333'
|
||||
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
|
||||
elseif (g:project_type == 'decof')
|
||||
let s:makegoals = ['all']
|
||||
let s:makeprg = 'cmake --build . --target'
|
||||
else
|
||||
echo "no project"
|
||||
endif
|
||||
@ -225,8 +256,10 @@ function s:ProjectSet(project_type, project_base_dir)
|
||||
" compiler
|
||||
compiler gcc
|
||||
let s:makeopts = ['-j3', 'VERBOSE=1']
|
||||
let g:Program = g:ProjectBuildDir.s:Program
|
||||
let g:Elffile = g:ProjectBuildDir.s:Elffile
|
||||
if exists("s:Program")
|
||||
let g:Program = g:ProjectBuildDir.s:Program
|
||||
let g:Elffile = g:ProjectBuildDir.s:Elffile
|
||||
endif
|
||||
command! -complete=custom,GetAllMakeCompletions -nargs=* MakeCmd call s:Make('<args>', 0)
|
||||
command! MakeTestBuild call s:MakeTestBuild()
|
||||
command! -nargs=* Ctest call s:Ctest('<args>', 0)
|
||||
@ -272,7 +305,7 @@ function s:ProjectSet(project_type, project_base_dir)
|
||||
|
||||
" little helpers
|
||||
command! -nargs=? BuildDirStash call s:BuildDirStash('<args>')
|
||||
command! -nargs=? BuildDirUnStash call s:BuildDirUnStash('<args>')
|
||||
command! -complete=custom,GetAllStashedBuildDirs -nargs=? BuildDirUnStash call s:BuildDirUnStash('<args>')
|
||||
|
||||
endfunction
|
||||
|
||||
@ -314,6 +347,9 @@ function s:Cmake(build_type, async_mode)
|
||||
call asyncrun#quickfix_toggle(10, 1)
|
||||
let args = ""
|
||||
let args .= " ../".g:ProjectSrcDirRel."/"
|
||||
if (g:project_type == 'decof')
|
||||
let args .= "/targets/simulator"
|
||||
endif
|
||||
let args .= " --graphviz=dependencies.dot"
|
||||
let args .= " -DCMAKE_BUILD_TYPE=".a:build_type
|
||||
let args .= " -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
|
||||
@ -331,6 +367,11 @@ function s:Cmake(build_type, async_mode)
|
||||
elseif ((g:project_type == 'digifalc') || (g:project_type == 'servoboard') || (g:project_type == 'dl-motor'))
|
||||
let args .= " -G Ninja"
|
||||
let args .= " -DCMAKE_TOOLCHAIN_FILE=../".g:ProjectSrcDirRel."/GNU\\ Arm\\ Embedded.toolchain.cmake"
|
||||
elseif ((g:project_type == 'operation-panel-f1') || (g:project_type == 'operation-panel-f4'))
|
||||
let args .= " -DCMAKE_TOOLCHAIN_FILE=../".g:ProjectSrcDirRel."/gnu-arm-none-eabi.toolchain.cmake"
|
||||
let args .= " -DOPC_TARGET=".g:stm32_target
|
||||
elseif (g:project_type == 'decof')
|
||||
let args .= " -DCMAKE_TOOLCHAIN_FILE=../".g:ProjectSrcDirRel."/ci/Toolchain-dlcpro-target.cmake"
|
||||
endif
|
||||
execute 'AsyncRun -mode='.a:async_mode.' -save=2 -cwd='.g:ProjectBuildDir.' @ cmake '.args
|
||||
endfunction
|
||||
@ -396,6 +437,9 @@ function s:DeviceStartGdbServer()
|
||||
" call s:Call_and_log('/opt/SEGGER/JLink/JLinkGDBServer -if SWD -device STM32H743ZI2 &')
|
||||
" call s:Call_and_log('/opt/SEGGER/JLink/JLinkGDBServer -if SWD -device STM32H743ZI &')
|
||||
call s:Call_and_log(s:jlink_path.'/JLinkGDBServer -if SWD -device STM32H743ZI &')
|
||||
elseif ((g:project_type == 'operation-panel-f1') || (g:project_type == 'operation-panel-f4'))
|
||||
call s:Call_and_log('pkill --full openocd')
|
||||
call s:Call_and_log('openocd -f interface/stlink.cfg -f target/'.s:stm_cfg.'.cfg &')
|
||||
else
|
||||
call s:Call_and_log('pkill --full gdbserver')
|
||||
call s:Call_and_log('ssh '.g:SshOpts.' root@'.g:DeviceIP.' "killall -q -9 gdbserver start-dc.sh '.fnamemodify(g:ProgramRemote, ':t').'"')
|
||||
@ -421,7 +465,7 @@ function s:SendToConque(command)
|
||||
endfunction
|
||||
|
||||
function s:SendToDebugger(command)
|
||||
if ((g:project_type == 'digifalc') || (g:project_type == 'servoboard') || (g:project_type == 'dl-motor'))
|
||||
if ((g:project_type == 'digifalc') || (g:project_type == 'servoboard') || (g:project_type == 'dl-motor') || (g:project_type == 'operation-panel-f1') || (g:project_type == 'operation-panel-f4'))
|
||||
call s:SendToTerm(a:command)
|
||||
else
|
||||
call s:SendToConque(a:command)
|
||||
@ -429,7 +473,7 @@ function s:SendToDebugger(command)
|
||||
endfunction
|
||||
|
||||
function s:StartDebugger(elffile, attach)
|
||||
if ((g:project_type == 'dlcpro-gui') ||(g:project_type == 'digifalc') || (g:project_type == 'servoboard') || (g:project_type == 'dl-motor'))
|
||||
if ((g:project_type == 'dlcpro-gui') ||(g:project_type == 'digifalc') || (g:project_type == 'servoboard') || (g:project_type == 'dl-motor') || (g:project_type == 'operation-panel-f1') || (g:project_type == 'operation-panel-f4'))
|
||||
if (a:attach == 0)
|
||||
Termdebug
|
||||
else
|
||||
@ -462,11 +506,18 @@ function s:DeviceDebug(attach)
|
||||
call s:SendToDebugger('set remote exec-file '.g:ProgramRemote)
|
||||
endif
|
||||
call s:SendToDebugger('file '.g:Elffile)
|
||||
" call s:SendToDebugger('y')
|
||||
" call s:SendToDebugger('y')
|
||||
sleep 3
|
||||
call s:SendToDebugger('break main')
|
||||
call s:SendToDebugger('run')
|
||||
" call s:SendToDebugger('y')
|
||||
if ((g:project_type == 'operation-panel-f1') || (g:project_type == 'operation-panel-f4'))
|
||||
call s:SendToDebugger('y')
|
||||
call s:SendToDebugger('monitor reset')
|
||||
call s:SendToDebugger('load')
|
||||
call s:SendToDebugger('break main')
|
||||
else
|
||||
call s:SendToDebugger('break main')
|
||||
call s:SendToDebugger('run')
|
||||
" call s:SendToDebugger('y')
|
||||
endif
|
||||
endif
|
||||
else
|
||||
call s:DeviceStartGdbServerAttach()
|
||||
@ -515,7 +566,7 @@ command -nargs=1 -complete=file DlcproRegtestDualDl1 call s:DlcproRegtest(g:Dlcp
|
||||
command -nargs=1 -complete=file DlcproRegtestShgPro call s:DlcproRegtest(g:DlcproRegtestShgProCmd('<args>'))
|
||||
|
||||
let g:DlcproRegtest_fast_restart = 1
|
||||
"let g:DlcproRegtest_marks = '"-m (not usb and not usbstick and not si1 and not servo_control and not eom and not cavity and not cell_spectroscopy)"'
|
||||
"let g:DlcproRegtest_marks = '"-m (no_crash_without_mc_fpga and not usb and not usbstick and not si1 and not servo_control and not eom and not cavity and not cell_spectroscopy)"'
|
||||
let g:DlcproRegtest_marks = ""
|
||||
let g:DlcproRegtest_lasertype = "DLpro"
|
||||
let g:DlcproRegtest_powerswitch_ip = ""
|
||||
@ -540,7 +591,7 @@ function s:DlcproRegtestCmd(ip, powerswitch_ip, powerplug, laser_count, laser_ty
|
||||
let archive_dir = g:ProjectBuildDir."/artifacts"
|
||||
let license_builddir = s:ProjectBaseDir.'/build.license'
|
||||
let licensetool = license_builddir."/libdlcprolicense/dlcprolicense-tool"
|
||||
let $JENKINS_URL = 'http://jenkins1muc.toptica.com'
|
||||
let $JENKINS_URL = g:jenkins_url
|
||||
|
||||
let test_cmd =
|
||||
\s:ProjectSrcDir."/test/python-env/bin/python -u -m pytest ".
|
||||
@ -666,6 +717,10 @@ function s:BuildDirUnStash(suffix)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function GetAllStashedBuildDirs(ArgLead, CmdLine, CursorPos)
|
||||
return system('ls '.s:ProjectBaseDir.' | grep build.')
|
||||
endfunction
|
||||
|
||||
" update PDH-firmware
|
||||
"/opt/app/bin/jamplayer -sm3 -aconfigure PDD.jam
|
||||
"/opt/app/bin/jamplayer -sm3 -aprogram PDD.jam
|
||||
@ -682,3 +737,36 @@ endfunction
|
||||
" Pandoc
|
||||
" ------
|
||||
command TopticaBeamer execute('!pandoc -s -t beamer -H toptica-style.tex -o %:r.pdf %')
|
||||
|
||||
" -----------------
|
||||
" Jenkins validator
|
||||
" -----------------
|
||||
function s:Jenkins_linter(jenkinsfile)
|
||||
if a:jenkinsfile == ''
|
||||
let jenkinsfile = expand("%")
|
||||
else
|
||||
let jenkinsfile = a:jenkinsfile
|
||||
endif
|
||||
|
||||
if !filereadable(jenkinsfile)
|
||||
echoerr("File not found: ".jenkinsfile)
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists("s:user")
|
||||
let s:user = input("jenkins-user:")
|
||||
endif
|
||||
if !exists("s:passwd")
|
||||
let s:passwd = inputsecret("password:")
|
||||
echo "\n"
|
||||
endif
|
||||
let user_pass = s:user.":".s:passwd
|
||||
|
||||
let out = system("curl --no-progress-meter --user '".user_pass."' -X POST -F 'jenkinsfile=<".jenkinsfile."' ".g:jenkins_url."/pipeline-model-converter/validate")
|
||||
if match(out, "HTTP ERROR 401") >= 0
|
||||
" Forget credentials on authorization error
|
||||
unlet s:user
|
||||
unlet s:passwd
|
||||
endif
|
||||
echo out
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user