Skip to content

Commit 21180f9

Browse files
author
sporty
committed
Updates
1 parent 7884df2 commit 21180f9

31 files changed

+1256
-3163
lines changed

.cproject

+68-65
Large diffs are not rendered by default.

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,15 @@ Debug/*.asm
3232
*.opt
3333
*.lst
3434
Debug/*.xml
35+
Debug/*.mk
3536
unittest/unittest
3637
Debug/makefile
38+
/Debug/
39+
40+
tags
41+
project.log
42+
43+
.launches
44+
.ycm_extra_conf.pyc
45+
46+

.launches/msp430-OTP.launch

-29
This file was deleted.

.nvimrc

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
" =====[ C++ formatting ]=====================================================
2+
set relativenumber
3+
set comments=://
4+
set noswapfile
5+
6+
nnoremap <silent><C-p> :ClearCtrlPCache<cr>\|:CtrlP /home/sporty/ws-ccs<cr>
7+
8+
augroup ChooseMakefile
9+
autocmd!
10+
autocmd BufEnter,BufRead,WinEnter * let &l:makeprg =
11+
\ "cd /home/sporty/ws-ccs/msp430-OTP/Debug/ && /home/sporty/ti/ccsv6/utils/bin/gmake -k all"
12+
autocmd BufEnter,BufRead,WinEnter *_test.cpp let &l:makeprg =
13+
\ 'make -f '.fnameescape(
14+
\ substitute(expand('%'), '\m_test\.cpp$', '.makefile', ''))
15+
augroup END
16+
17+
fu! SaveSess()
18+
execute 'mksession! .nvim/session.vim'
19+
endfunction
20+
21+
fu! RestoreSess()
22+
execute 'source .nvim/session.vim'
23+
if bufexists(1)
24+
for l in range(1, bufnr('$'))
25+
if bufwinnr(l) == -1
26+
exec 'sbuffer ' . l
27+
endif
28+
endfor
29+
endif
30+
endfunction
31+
32+
let g:ctrlsf_ignore_dir = ['.git', 'Debug', 'Release', 'Test']
33+
34+
" autocmd BufEnter,BufRead,WinEnter *
35+
" \ if expand('%:t') == 'main.cpp'
36+
" \| cd /home/sporty/ws-ccs/hw_1_5/Test/
37+
" \| let &l:makeprg = '/home/sporty/ti/ccsv6/utils/bin/gmake -k all'
38+
" \| else
39+
" \| cd /home/sporty/ws-ccs/hw_1_5
40+
" \| let &l:makeprg
41+
" \ = 'make -f '.fnameescape(
42+
" \ substitute(expand('%'), '\m_test\.cpp$', '.makefile', ''))
43+
44+
" fun! SetMakeprg()
45+
" if expand('%:t') == 'main.cpp'
46+
" let &l:makeprg = 'cd /home/sporty/ws-ccs/hw_1_5/Test/ && /home/sporty/ti/ccsv6/utils/bin/gmake -k all'
47+
" elseif expand('%:t') == *_test.cpp
48+
" cd '/home/sporty/ws-ccs/hw_1_5'
49+
" let &l:makeprg = 'make -f '.fnameescape(
50+
" \ substitute(expand('%'), '\m_test\.cpp$', '.makefile', ''))
51+
" endif
52+
" endfun
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
eclipse.preferences.version=1
2+
encoding//Debug/makefile=UTF-8
3+
encoding//Debug/otp/subdir_rules.mk=UTF-8
4+
encoding//Debug/otp/subdir_vars.mk=UTF-8
5+
encoding//Debug/src/subdir_rules.mk=UTF-8
6+
encoding//Debug/src/subdir_vars.mk=UTF-8

.vimrc

-2
This file was deleted.

.ycm_extra_conf.py

+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# This file is NOT licensed under the GPLv3, which is the license for the rest
2+
# of YouCompleteMe.
3+
#
4+
# Here's the license text for this file:
5+
#
6+
# This is free and unencumbered software released into the public domain.
7+
#
8+
# Anyone is free to copy, modify, publish, use, compile, sell, or
9+
# distribute this software, either in source code form or as a compiled
10+
# binary, for any purpose, commercial or non-commercial, and by any
11+
# means.
12+
#
13+
# In jurisdictions that recognize copyright laws, the author or authors
14+
# of this software dedicate any and all copyright interest in the
15+
# software to the public domain. We make this dedication for the benefit
16+
# of the public at large and to the detriment of our heirs and
17+
# successors. We intend this dedication to be an overt act of
18+
# relinquishment in perpetuity of all present and future rights to this
19+
# software under copyright law.
20+
#
21+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24+
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27+
# OTHER DEALINGS IN THE SOFTWARE.
28+
#
29+
# For more information, please refer to <http://unlicense.org/>
30+
31+
import os
32+
import ycm_core
33+
34+
prjroot="/home/sporty/ws-ccs/msp430-OTP"
35+
36+
# These are the compilation flags that will be used in case there's no
37+
# compilation database set (by default, one is not set).
38+
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
39+
flags = [
40+
'-g',
41+
'-Wall',
42+
'-Wextra',
43+
'-Werror',
44+
'-fsyntax-only',
45+
'-pthread',
46+
'-Wno-unknown-pragmas',
47+
'-DDEBUG',
48+
'-DTEST',
49+
'-D_BIC_SR(x)=',
50+
'-D_BIS_SR(x)=',
51+
'-D__MSP430F5335__',
52+
'-D__interrupt',
53+
# You 100% do NOT need -DUSE_CLANG_COMPLETER in your flags; only the YCM
54+
# source code needs it.
55+
'-DUSE_CLANG_COMPLETER',
56+
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
57+
# language to use when compiling headers. So it will guess. Badly. So C++
58+
# headers will be compiled as C headers. You don't want that so ALWAYS specify
59+
# a "-std=<something>".
60+
# For a C project, you would set this to something like 'c99' instead of
61+
# 'c++11'.
62+
'-std=c++03',
63+
# ...and the same thing goes for the magic -x option which specifies the
64+
# language that the files to be compiled are written in. This is mostly
65+
# relevant for c++ headers.
66+
# For a C project, you would set this to 'c' instead of 'c++'.
67+
'-x', 'c++',
68+
'-isystem', '/usr/local/include',
69+
'-isystem', '/usr/include/x86_64-linux-gnu',
70+
'-isystem', '/usr/include',
71+
'-isystem', '/usr/include/c++/4.9',
72+
'-isystem', '/usr/include/x86_64-linux-gnu/c++/4.9',
73+
'-isystem', '/usr/include/c++/4.9/backward',
74+
'-isystem', '/usr/lib/llvm-3.6/lib/clang/3.6.2/include',
75+
'-isystem', '/home/sporty/work/googletest/googletest/include',
76+
'-isystem', '/home/sporty/work/googletest/googlemock/include',
77+
'-isystem', '/home/sporty/ti/ccsv6/ccs_base/msp430/include',
78+
'-I', '.'
79+
]
80+
81+
# Set this to the absolute path to the folder (NOT the file!) containing the
82+
# compile_commands.json file to use that instead of 'flags'. See here for
83+
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
84+
#
85+
# You can get CMake to generate this file for you by adding:
86+
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
87+
# to your CMakeLists.txt file.
88+
#
89+
# Most projects will NOT need to set this to anything; you can just change the
90+
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
91+
compilation_database_folder = ''
92+
93+
if os.path.exists( compilation_database_folder ):
94+
database = ycm_core.CompilationDatabase( compilation_database_folder )
95+
else:
96+
database = None
97+
98+
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
99+
100+
def DirectoryOfThisScript():
101+
return os.path.dirname( os.path.abspath( __file__ ) )
102+
103+
104+
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
105+
if not working_directory:
106+
return list( flags )
107+
new_flags = []
108+
make_next_absolute = False
109+
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
110+
for flag in flags:
111+
new_flag = flag
112+
113+
if make_next_absolute:
114+
make_next_absolute = False
115+
if not flag.startswith( '/' ):
116+
new_flag = os.path.join( working_directory, flag )
117+
118+
for path_flag in path_flags:
119+
if flag == path_flag:
120+
make_next_absolute = True
121+
break
122+
123+
if flag.startswith( path_flag ):
124+
path = flag[ len( path_flag ): ]
125+
new_flag = path_flag + os.path.join( working_directory, path )
126+
break
127+
128+
if new_flag:
129+
new_flags.append( new_flag )
130+
return new_flags
131+
132+
133+
def IsHeaderFile( filename ):
134+
extension = os.path.splitext( filename )[ 1 ]
135+
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
136+
137+
138+
def GetCompilationInfoForFile( filename ):
139+
# The compilation_commands.json file generated by CMake does not have entries
140+
# for header files. So we do our best by asking the db for flags for a
141+
# corresponding source file, if any. If one exists, the flags for that file
142+
# should be good enough.
143+
if IsHeaderFile( filename ):
144+
basename = os.path.splitext( filename )[ 0 ]
145+
for extension in SOURCE_EXTENSIONS:
146+
replacement_file = basename + extension
147+
if os.path.exists( replacement_file ):
148+
compilation_info = database.GetCompilationInfoForFile(
149+
replacement_file )
150+
if compilation_info.compiler_flags_:
151+
return compilation_info
152+
return None
153+
return database.GetCompilationInfoForFile( filename )
154+
155+
156+
def FlagsForFile( filename, **kwargs ):
157+
if database:
158+
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
159+
# python list, but a "list-like" StringVec object
160+
compilation_info = GetCompilationInfoForFile( filename )
161+
if not compilation_info:
162+
return None
163+
164+
final_flags = MakeRelativePathsInFlagsAbsolute(
165+
compilation_info.compiler_flags_,
166+
compilation_info.compiler_working_dir_ )
167+
168+
# NOTE: This is just for YouCompleteMe; it's highly likely that your project
169+
# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
170+
# ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
171+
try:
172+
final_flags.remove( '-stdlib=libc++' )
173+
except ValueError:
174+
pass
175+
else:
176+
relative_to = DirectoryOfThisScript()
177+
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
178+
179+
return {
180+
'flags': final_flags,
181+
'do_cache': True
182+
}

Debug/.gitignore

-1
This file was deleted.

0 commit comments

Comments
 (0)