cancel
Showing results for 
Search instead for 
Did you mean: 

PC lint without plugin in AC6 compiler Eclipse

Shail Shah
Associate II
Posted on October 13, 2017 at 06:51

Hello,

Kindly provide any reference material how to integrate PC lint without plugin.

Kindly provide steps to be perform to do lint in eclipse.

Thanks and regards,

Shail Shah

#ac6 #gnu-c-compiler-(gcc) #sw4stm32-eclipse #compiler
3 REPLIES 3
Erwan YVIN
ST Employee
Posted on October 13, 2017 at 11:08

Hello Shail ,

For eclipse point of view,

you should be the same spirit between ac6 eclipse , SPC5Studio (Automotive) or all eclipse based on CDT.

  1. First , update your makefile or CDT Settings by adding your checking target

Example below :

# lint-nt must be accessible from your PATH
LINT_TOOL = lint-nt
LINT_OPTIONS = pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt
define AWK_CMD =
/search starts/{inc=1; next}/End of search list./{inc=0; next}{if (inc>0) { a = $$1; printf(gensub(/(.*)$$/, '--i\\\\1', 'g', a)) }}
endef
define GET_INCLUDE_PATHS_CMD = 
$(shell $(TRGT)cpp -v 2>&1 | gawk '$(AWK_CMD)' > pclint/gcc-include-path.lnt)
endef
misra: pclint/gcc-include-path.lnt pclint/lint_cmac.h pclint/lint_cppmac.h
@echo
@echo Start MISRA Check...
@echo ${LINT_TOOL} ${LINT_OPTIONS} $(subst \,/,$(IINCDIR)) $(subst \,/,$(SRC)) > misra.txt
${LINT_TOOL} ${LINT_OPTIONS} $(subst \,/,$(IINCDIR)) $(subst \,/,$(SRC)) >> misra.txt
@echo 
@echo See results in misra.txt
.PHONY: pclint/gcc-include-path.lnt
pclint/gcc-include-path.lnt:
@echo
@echo Generate pclint/gcc-include-path.lnt for current compiler 
@$(GET_INCLUDE_PATHS_CMD)
.PHONY: pclint/lint_cmac.h
pclint/lint_cmac.h:
@echo
@echo Generate pclint/lint_cmac.h for current compiler 
@touch t.c 
@$(TRGT)gcc -E -dM t.c > pclint/lint_cmac.h
@rm t.c
.PHONY: pclint/lint_cppmac.h
pclint/lint_cppmac.h:
@echo
@echo Generate pclint/lint_cppmac.h for current compiler
@touch t.cpp 
@$(TRGT)g++ -E -dM t.cpp > pclint/lint_cppmac.h
@rm t.cpp
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

2. In Eclipse, Create your corresponding target in Make Targets ==> Create

Best regards

Erwan

Posted on October 23, 2017 at 07:47

Hello,

Thanks for your reply.

How to update the makefile or CDT Settings?

should we need to run batch file for that?

if possible kindly explain steps?

Posted on October 24, 2017 at 13:14

Hello Shail ,

i recommend you to go in this following link

http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_o_home.htm

  (CDT Section)

       Best regards

                         Erwan