diff --git a/board/bootstub_declarations.h b/board/bootstub_declarations.h index 5cdec508e70..c641d16385d 100644 --- a/board/bootstub_declarations.h +++ b/board/bootstub_declarations.h @@ -2,8 +2,6 @@ void print(const char *a){ UNUSED(a); } void puth(uint8_t i){ UNUSED(i); } void puth2(uint8_t i){ UNUSED(i); } -void puth4(uint8_t i){ UNUSED(i); } -void hexdump(const void *a, int l){ UNUSED(a); UNUSED(l); } typedef struct board board; typedef struct harness_configuration harness_configuration; void pwm_init(TIM_TypeDef *TIM, uint8_t channel); diff --git a/board/can_comms.h b/board/can_comms.h index c8f071abd57..35d78d013d2 100644 --- a/board/can_comms.h +++ b/board/can_comms.h @@ -116,7 +116,9 @@ void refresh_can_tx_slots_available(void) { if (can_tx_check_min_slots_free(MAX_CAN_MSGS_PER_USB_BULK_TRANSFER)) { can_tx_comms_resume_usb(); } + #ifdef ENABLE_SPI if (can_tx_check_min_slots_free(MAX_CAN_MSGS_PER_SPI_BULK_TRANSFER)) { can_tx_comms_resume_spi(); } + #endif } diff --git a/board/drivers/can_common.h b/board/drivers/can_common.h index 3a829c69ab6..d34751ebf74 100644 --- a/board/drivers/can_common.h +++ b/board/drivers/can_common.h @@ -191,9 +191,11 @@ void can_set_orientation(bool flipped) { bus_config[2].can_num_lookup = flipped ? 0U : 2U; } +#ifdef FINAL_PROVISIONING // only used in jungle final provisioning void can_set_forwarding(uint8_t from, uint8_t to) { bus_config[from].forwarding_bus = to; } +#endif void ignition_can_hook(CANPacket_t *to_push) { int bus = GET_BUS(to_push); diff --git a/board/drivers/gpio.h b/board/drivers/gpio.h index 0b8fc091b1f..aea604254e2 100644 --- a/board/drivers/gpio.h +++ b/board/drivers/gpio.h @@ -10,11 +10,6 @@ #define OUTPUT_TYPE_PUSH_PULL 0U #define OUTPUT_TYPE_OPEN_DRAIN 1U -typedef struct { - GPIO_TypeDef * const bank; - uint8_t pin; -} gpio_t; - void set_gpio_mode(GPIO_TypeDef *GPIO, unsigned int pin, unsigned int mode) { ENTER_CRITICAL(); uint32_t tmp = GPIO->MODER; @@ -68,6 +63,12 @@ int get_gpio_input(const GPIO_TypeDef *GPIO, unsigned int pin) { return (GPIO->IDR & (1UL << pin)) == (1UL << pin); } +#ifdef PANDA_JUNGLE +typedef struct { + GPIO_TypeDef * const bank; + uint8_t pin; +} gpio_t; + void gpio_set_all_output(gpio_t *pins, uint8_t num_pins, bool enabled) { for (uint8_t i = 0; i < num_pins; i++) { set_gpio_output(pins[i].bank, pins[i].pin, enabled); @@ -79,6 +80,7 @@ void gpio_set_bitmask(gpio_t *pins, uint8_t num_pins, uint32_t bitmask) { set_gpio_output(pins[i].bank, pins[i].pin, (bitmask >> i) & 1U); } } +#endif // Detection with internal pullup #define PULL_EFFECTIVE_DELAY 4096 diff --git a/board/drivers/spi.h b/board/drivers/spi.h index 61ae2aba9d6..012bfb42877 100644 --- a/board/drivers/spi.h +++ b/board/drivers/spi.h @@ -140,7 +140,10 @@ void spi_rx_done(void) { response_len = 1U; } else { // response: NACK and reset state machine - print("- incorrect header sync or checksum "); hexdump(spi_buf_rx, SPI_HEADER_SIZE); + print("- incorrect header sync or checksum "); + #ifdef DEBUG_SPI + hexdump(spi_buf_rx, SPI_HEADER_SIZE); + #endif spi_buf_tx[0] = SPI_NACK; next_rx_state = SPI_STATE_HEADER_NACK; response_len = 1U; @@ -192,12 +195,14 @@ void spi_rx_done(void) { } else { // Checksum was incorrect response_ack = false; - print("- incorrect data checksum "); - puth4(spi_data_len_mosi); + print("SPI: incorrect data checksum "); + #ifdef DEBUG_SPI + PUTH(spi_data_len_mosi); print("\n"); hexdump(spi_buf_rx, SPI_HEADER_SIZE); hexdump(&(spi_buf_rx[SPI_HEADER_SIZE]), MIN(spi_data_len_mosi, 64)); print("\n"); + #endif } if (!response_ack) { diff --git a/board/drivers/uart.h b/board/drivers/uart.h index 4836889779b..8f07ebb52bf 100644 --- a/board/drivers/uart.h +++ b/board/drivers/uart.h @@ -165,6 +165,7 @@ void puth2(unsigned int i) { puthx(i, 2U); } +#ifdef DEBUG void puth4(unsigned int i) { puthx(i, 4U); } @@ -179,3 +180,4 @@ void hexdump(const void *a, int l) { } print("\n"); } +#endif diff --git a/board/main_comms.h b/board/main_comms.h index 4c5d5096247..8d12abddbb0 100644 --- a/board/main_comms.h +++ b/board/main_comms.h @@ -29,6 +29,9 @@ int get_health_pkt(void *dat) { health->heartbeat_lost_pkt = heartbeat_lost; health->safety_rx_checks_invalid_pkt = safety_rx_checks_invalid; +#ifndef ENABLE_SPI + uint16_t spi_checksum_error_count = 0; +#endif health->spi_checksum_error_count_pkt = spi_checksum_error_count; health->fault_status_pkt = fault_status; diff --git a/board/safety.h b/board/safety.h index 048d7cca489..4400a3eacfd 100644 --- a/board/safety.h +++ b/board/safety.h @@ -107,6 +107,7 @@ void gen_crc_lookup_table_8(uint8_t poly, uint8_t crc_lut[]) { } } +#ifdef CANFD //only used in canfd hyundai void gen_crc_lookup_table_16(uint16_t poly, uint16_t crc_lut[]) { for (uint16_t i = 0; i < 256U; i++) { uint16_t crc = i << 8U; @@ -120,6 +121,7 @@ void gen_crc_lookup_table_16(uint16_t poly, uint16_t crc_lut[]) { crc_lut[i] = crc; } } +#endif bool msg_allowed(const CANPacket_t *to_send, const CanMsg msg_list[], int len) { int addr = GET_ADDR(to_send); diff --git a/board/stm32f4/peripherals.h b/board/stm32f4/peripherals.h index 711f1b82a0e..04832536d6c 100644 --- a/board/stm32f4/peripherals.h +++ b/board/stm32f4/peripherals.h @@ -14,11 +14,13 @@ void gpio_spi_init(void) { register_set_bits(&(GPIOA->OSPEEDR), GPIO_OSPEEDER_OSPEEDR4 | GPIO_OSPEEDER_OSPEEDR5 | GPIO_OSPEEDER_OSPEEDR6 | GPIO_OSPEEDER_OSPEEDR7); } +#ifdef BOOTSTUB void gpio_usart2_init(void) { // A2,A3: USART 2 for debugging set_gpio_alternate(GPIOA, 2, GPIO_AF7_USART2); set_gpio_alternate(GPIOA, 3, GPIO_AF7_USART2); } +#endif // Common GPIO initialization void common_init_gpio(void) { @@ -41,12 +43,14 @@ void common_init_gpio(void) { set_gpio_alternate(GPIOB, 9, GPIO_AF8_CAN1); } +#ifdef BOOTSTUB void flasher_peripherals_init(void) { RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN; RCC->APB2ENR |= RCC_APB2ENR_SPI1EN; RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN; RCC->APB1ENR |= RCC_APB1ENR_USART2EN; } +#else // Peripheral initialization void peripherals_init(void) { @@ -84,6 +88,7 @@ void peripherals_init(void) { RCC->APB1ENR |= RCC_APB1ENR_TIM6EN; // interrupt timer RCC->APB2ENR |= RCC_APB2ENR_TIM9EN; // slow loop } +#endif void enable_interrupt_timer(void) { register_set_bits(&(RCC->APB1ENR), RCC_APB1ENR_TIM6EN); // Enable interrupt timer peripheral diff --git a/board/stm32f4/stm32f4_config.h b/board/stm32f4/stm32f4_config.h index 677a389ea7e..ffca898c5de 100644 --- a/board/stm32f4/stm32f4_config.h +++ b/board/stm32f4/stm32f4_config.h @@ -1,5 +1,5 @@ -#include "stm32f4/inc/stm32f4xx.h" -#include "stm32f4/inc/stm32f4xx_hal_gpio_ex.h" +#include "stm32f4xx.h" +#include "stm32f4xx_hal_gpio_ex.h" #define MCU_IDCODE 0x463U // from the linker script @@ -56,8 +56,10 @@ #include "stm32f4/board.h" #include "stm32f4/clock.h" +#ifdef ENABLE_SPI #include "drivers/spi.h" #include "stm32f4/llspi.h" +#endif #if !defined(BOOTSTUB) #include "drivers/uart.h" diff --git a/board/stm32h7/llspi.h b/board/stm32h7/llspi.h index 903f6a5ecc0..10886f0ef2c 100644 --- a/board/stm32h7/llspi.h +++ b/board/stm32h7/llspi.h @@ -48,6 +48,7 @@ void llspi_miso_dma(uint8_t *addr, int len) { register_set_bits(&(SPI4->CR1), SPI_CR1_SPE); } +#ifdef ENABLE_SPI // master -> panda DMA finished void DMA2_Stream2_IRQ_Handler(void) { // Clear interrupt flag @@ -104,3 +105,4 @@ void llspi_init(void) { NVIC_EnableIRQ(DMA2_Stream3_IRQn); NVIC_EnableIRQ(SPI4_IRQn); } +#endif diff --git a/board/stm32h7/peripherals.h b/board/stm32h7/peripherals.h index b60f19016d7..22c3775d323 100644 --- a/board/stm32h7/peripherals.h +++ b/board/stm32h7/peripherals.h @@ -13,11 +13,13 @@ void gpio_spi_init(void) { register_set_bits(&(GPIOE->OSPEEDR), GPIO_OSPEEDR_OSPEED11 | GPIO_OSPEEDR_OSPEED12 | GPIO_OSPEEDR_OSPEED13 | GPIO_OSPEEDR_OSPEED14); } +#ifdef BOOTSTUB void gpio_usart2_init(void) { // A2,A3: USART 2 for debugging set_gpio_alternate(GPIOA, 2, GPIO_AF7_USART2); set_gpio_alternate(GPIOA, 3, GPIO_AF7_USART2); } +#endif void gpio_uart7_init(void) { // E7,E8: UART 7 for debugging @@ -78,6 +80,7 @@ void common_init_gpio(void) { set_gpio_alternate(GPIOG, 10, GPIO_AF2_FDCAN3); } +#ifdef BOOTSTUB void flasher_peripherals_init(void) { RCC->AHB1ENR |= RCC_AHB1ENR_USB1OTGHSEN; @@ -85,7 +88,7 @@ void flasher_peripherals_init(void) { RCC->APB2ENR |= RCC_APB2ENR_SPI4EN; RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN; } - +#else // Peripheral initialization void peripherals_init(void) { // enable GPIO(A,B,C,D,E,F,G,H) @@ -126,12 +129,12 @@ void peripherals_init(void) { RCC->APB1LENR |= RCC_APB1LENR_TIM7EN; // DMA trigger timer RCC->APB2ENR |= RCC_APB2ENR_TIM8EN; // tick timer RCC->APB1LENR |= RCC_APB1LENR_TIM12EN; // slow loop - -#ifdef PANDA_JUNGLE + #ifdef PANDA_JUNGLE RCC->AHB3ENR |= RCC_AHB3ENR_SDMMC1EN; // SDMMC RCC->AHB4ENR |= RCC_AHB4ENR_ADC3EN; // Enable ADC3 clocks -#endif + #endif } +#endif void enable_interrupt_timer(void) { register_set_bits(&(RCC->APB1LENR), RCC_APB1LENR_TIM6EN); // Enable interrupt timer peripheral diff --git a/board/stm32h7/stm32h7_config.h b/board/stm32h7/stm32h7_config.h index 320dae67a79..4d865b9073f 100644 --- a/board/stm32h7/stm32h7_config.h +++ b/board/stm32h7/stm32h7_config.h @@ -1,5 +1,5 @@ -#include "stm32h7/inc/stm32h7xx.h" -#include "stm32h7/inc/stm32h7xx_hal_gpio_ex.h" +#include "stm32h7xx.h" +#include "stm32h7xx_hal_gpio_ex.h" #define MCU_IDCODE 0x483U // from the linker script @@ -83,8 +83,10 @@ separate IRQs for RX and TX. #include "stm32h7/llusb.h" +#ifdef ENABLE_SPI #include "drivers/spi.h" #include "stm32h7/llspi.h" +#endif void early_gpio_float(void) { RCC->AHB4ENR = RCC_AHB4ENR_GPIOAEN | RCC_AHB4ENR_GPIOBEN | RCC_AHB4ENR_GPIOCEN | RCC_AHB4ENR_GPIODEN | RCC_AHB4ENR_GPIOEEN | RCC_AHB4ENR_GPIOFEN | RCC_AHB4ENR_GPIOGEN | RCC_AHB4ENR_GPIOHEN; diff --git a/tests/misra/checkers.txt b/tests/misra/checkers.txt index 1192e6f4a81..109f17b024d 100644 --- a/tests/misra/checkers.txt +++ b/tests/misra/checkers.txt @@ -5,7 +5,440 @@ Cppcheck checkers list from test_misra.sh: TEST variant options: ---project=/compile_commands.json --enable=all --addon=misra -i/crypto/rsa.c -i/crypto/sha.c --suppress=*:*crypto/* --disable=unusedFunction +--enable=all --disable=unusedFunction --addon=misra -DPANDA -DUID_BASE /board/main.c -DSTM32F4 -DSTM32F413xx -I /board/stm32f4/inc/ + + +Critical errors +--------------- +No critical errors, all files were checked. +Important: Analysis is still not guaranteed to be 'complete' it is possible there are false negatives. + + +Open source checkers +-------------------- +Yes Check64BitPortability::pointerassignment +Yes CheckAssert::assertWithSideEffects +Yes CheckAutoVariables::assignFunctionArg +Yes CheckAutoVariables::autoVariables +Yes CheckAutoVariables::checkVarLifetime +No CheckBool::checkAssignBoolToFloat require:style,c++ +Yes CheckBool::checkAssignBoolToPointer +No CheckBool::checkBitwiseOnBoolean require:style,inconclusive +Yes CheckBool::checkComparisonOfBoolExpressionWithInt +No CheckBool::checkComparisonOfBoolWithBool require:style,c++ +No CheckBool::checkComparisonOfBoolWithInt require:warning,c++ +No CheckBool::checkComparisonOfFuncReturningBool require:style,c++ +Yes CheckBool::checkIncrementBoolean +Yes CheckBool::pointerArithBool +Yes CheckBool::returnValueOfFunctionReturningBool +No CheckBoost::checkBoostForeachModification +Yes CheckBufferOverrun::analyseWholeProgram +Yes CheckBufferOverrun::argumentSize +Yes CheckBufferOverrun::arrayIndex +Yes CheckBufferOverrun::arrayIndexThenCheck +Yes CheckBufferOverrun::bufferOverflow +Yes CheckBufferOverrun::negativeArraySize +Yes CheckBufferOverrun::objectIndex +Yes CheckBufferOverrun::pointerArithmetic +No CheckBufferOverrun::stringNotZeroTerminated require:warning,inconclusive +Yes CheckClass::analyseWholeProgram +No CheckClass::checkConst require:style,inconclusive +No CheckClass::checkConstructors require:style,warning +No CheckClass::checkCopyConstructors require:warning +No CheckClass::checkDuplInheritedMembers require:warning +No CheckClass::checkExplicitConstructors require:style +No CheckClass::checkMemset +No CheckClass::checkMissingOverride require:style,c++03 +No CheckClass::checkReturnByReference require:performance +No CheckClass::checkSelfInitialization +No CheckClass::checkThisUseAfterFree require:warning +No CheckClass::checkUnsafeClassRefMember require:warning,safeChecks +No CheckClass::checkUselessOverride require:style +No CheckClass::checkVirtualFunctionCallInConstructor require:warning +No CheckClass::initializationListUsage require:performance +No CheckClass::initializerListOrder require:style,inconclusive +No CheckClass::operatorEqRetRefThis require:style +No CheckClass::operatorEqToSelf require:warning +No CheckClass::privateFunctions require:style +No CheckClass::thisSubtraction require:warning +No CheckClass::virtualDestructor +Yes CheckCondition::alwaysTrueFalse +Yes CheckCondition::assignIf +Yes CheckCondition::checkAssignmentInCondition +Yes CheckCondition::checkBadBitmaskCheck +Yes CheckCondition::checkCompareValueOutOfTypeRange +Yes CheckCondition::checkDuplicateConditionalAssign +Yes CheckCondition::checkIncorrectLogicOperator +Yes CheckCondition::checkInvalidTestForOverflow +Yes CheckCondition::checkModuloAlwaysTrueFalse +Yes CheckCondition::checkPointerAdditionResultNotNull +Yes CheckCondition::clarifyCondition +Yes CheckCondition::comparison +Yes CheckCondition::duplicateCondition +Yes CheckCondition::multiCondition +Yes CheckCondition::multiCondition2 +No CheckExceptionSafety::checkCatchExceptionByValue require:style +No CheckExceptionSafety::checkRethrowCopy require:style +No CheckExceptionSafety::deallocThrow require:warning +No CheckExceptionSafety::destructors require:warning +No CheckExceptionSafety::nothrowThrows +No CheckExceptionSafety::rethrowNoCurrentException +No CheckExceptionSafety::unhandledExceptionSpecification require:style,inconclusive +Yes CheckFunctions::checkIgnoredReturnValue +Yes CheckFunctions::checkMathFunctions +Yes CheckFunctions::checkMissingReturn +Yes CheckFunctions::checkProhibitedFunctions +Yes CheckFunctions::invalidFunctionUsage +Yes CheckFunctions::memsetInvalid2ndParam +Yes CheckFunctions::memsetZeroBytes +No CheckFunctions::returnLocalStdMove require:performance,c++11 +Yes CheckFunctions::useStandardLibrary +No CheckIO::checkCoutCerrMisusage require:c +Yes CheckIO::checkFileUsage +Yes CheckIO::checkWrongPrintfScanfArguments +Yes CheckIO::invalidScanf +Yes CheckLeakAutoVar::check +No CheckMemoryLeakInClass::check +Yes CheckMemoryLeakInFunction::checkReallocUsage +Yes CheckMemoryLeakNoVar::check +No CheckMemoryLeakNoVar::checkForUnsafeArgAlloc +Yes CheckMemoryLeakStructMember::check +Yes CheckNullPointer::analyseWholeProgram +Yes CheckNullPointer::arithmetic +Yes CheckNullPointer::nullConstantDereference +Yes CheckNullPointer::nullPointer +No CheckOther::checkAccessOfMovedVariable require:c++11,warning +Yes CheckOther::checkCastIntToCharAndBack +Yes CheckOther::checkCharVariable +Yes CheckOther::checkComparePointers +Yes CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse +Yes CheckOther::checkConstPointer +No CheckOther::checkConstVariable require:style,c++ +No CheckOther::checkDuplicateBranch require:style,inconclusive +Yes CheckOther::checkDuplicateExpression +Yes CheckOther::checkEvaluationOrder +Yes CheckOther::checkFuncArgNamesDifferent +No CheckOther::checkIncompleteArrayFill require:warning,portability,inconclusive +Yes CheckOther::checkIncompleteStatement +No CheckOther::checkInterlockedDecrement require:windows-platform +Yes CheckOther::checkInvalidFree +Yes CheckOther::checkKnownArgument +Yes CheckOther::checkKnownPointerToBool +No CheckOther::checkMisusedScopedObject require:style,c++ +Yes CheckOther::checkModuloOfOne +Yes CheckOther::checkNanInArithmeticExpression +Yes CheckOther::checkNegativeBitwiseShift +Yes CheckOther::checkOverlappingWrite +No CheckOther::checkPassByReference require:performance,c++ +Yes CheckOther::checkRedundantAssignment +No CheckOther::checkRedundantCopy require:c++,performance,inconclusive +Yes CheckOther::checkRedundantPointerOp +Yes CheckOther::checkShadowVariables +Yes CheckOther::checkSignOfUnsignedVariable +No CheckOther::checkSuspiciousCaseInSwitch require:warning,inconclusive +No CheckOther::checkSuspiciousSemicolon require:warning,inconclusive +Yes CheckOther::checkUnreachableCode +Yes CheckOther::checkUnusedLabel +Yes CheckOther::checkVarFuncNullUB +Yes CheckOther::checkVariableScope +Yes CheckOther::checkZeroDivision +Yes CheckOther::clarifyCalculation +Yes CheckOther::clarifyStatement +Yes CheckOther::invalidPointerCast +Yes CheckOther::redundantBitwiseOperationInSwitch +No CheckOther::warningOldStylePointerCast require:style,c++ +No CheckPostfixOperator::postfixOperator require:performance +Yes CheckSizeof::checkSizeofForArrayParameter +Yes CheckSizeof::checkSizeofForNumericParameter +Yes CheckSizeof::checkSizeofForPointerSize +Yes CheckSizeof::sizeofCalculation +Yes CheckSizeof::sizeofFunction +Yes CheckSizeof::sizeofVoid +Yes CheckSizeof::sizeofsizeof +No CheckSizeof::suspiciousSizeofCalculation require:warning,inconclusive +No CheckStl::checkDereferenceInvalidIterator require:warning +No CheckStl::checkDereferenceInvalidIterator2 +No CheckStl::checkFindInsert require:performance +No CheckStl::checkMutexes require:warning +No CheckStl::erase +No CheckStl::eraseIteratorOutOfBounds +No CheckStl::if_find require:warning,performance +No CheckStl::invalidContainer +No CheckStl::iterators +No CheckStl::knownEmptyContainer require:style +No CheckStl::misMatchingContainerIterator +No CheckStl::misMatchingContainers +No CheckStl::missingComparison require:warning +No CheckStl::negativeIndex +No CheckStl::outOfBounds +No CheckStl::outOfBoundsIndexExpression +No CheckStl::redundantCondition require:style +No CheckStl::size require:performance,c++03 +No CheckStl::stlBoundaries +No CheckStl::stlOutOfBounds +No CheckStl::string_c_str +No CheckStl::useStlAlgorithm require:style +No CheckStl::uselessCalls require:performance,warning +Yes CheckString::checkAlwaysTrueOrFalseStringCompare +Yes CheckString::checkIncorrectStringCompare +Yes CheckString::checkSuspiciousStringCompare +Yes CheckString::overlappingStrcmp +Yes CheckString::sprintfOverlappingData +Yes CheckString::strPlusChar +Yes CheckString::stringLiteralWrite +Yes CheckType::checkFloatToIntegerOverflow +Yes CheckType::checkIntegerOverflow +Yes CheckType::checkLongCast +Yes CheckType::checkSignConversion +Yes CheckType::checkTooBigBitwiseShift +Yes CheckUninitVar::check +Yes CheckUninitVar::valueFlowUninit +Yes CheckUnusedFunctions::check +Yes CheckUnusedVar::checkFunctionVariableUsage +Yes CheckUnusedVar::checkStructMemberUsage +Yes CheckVaarg::va_list_usage +Yes CheckVaarg::va_start_argument + + +Premium checkers +---------------- +Not available, Cppcheck Premium is not used + + +Autosar +------- +Not available, Cppcheck Premium is not used + + +Cert C +------ +Not available, Cppcheck Premium is not used + + +Cert C++ +-------- +Not available, Cppcheck Premium is not used + + +Misra C 2012 +------------ +Yes Misra C 2012: 1.1 +Yes Misra C 2012: 1.2 +Yes Misra C 2012: 1.3 +Yes Misra C 2012: 1.4 amendment:2 +No Misra C 2012: 1.5 amendment:3 require:premium +Yes Misra C 2012: 2.1 +Yes Misra C 2012: 2.2 +Yes Misra C 2012: 2.3 +Yes Misra C 2012: 2.4 +Yes Misra C 2012: 2.5 +Yes Misra C 2012: 2.6 +Yes Misra C 2012: 2.7 +Yes Misra C 2012: 2.8 +Yes Misra C 2012: 3.1 +Yes Misra C 2012: 3.2 +Yes Misra C 2012: 4.1 +Yes Misra C 2012: 4.2 +Yes Misra C 2012: 5.1 +Yes Misra C 2012: 5.2 +Yes Misra C 2012: 5.3 +Yes Misra C 2012: 5.4 +Yes Misra C 2012: 5.5 +Yes Misra C 2012: 5.6 +Yes Misra C 2012: 5.7 +Yes Misra C 2012: 5.8 +Yes Misra C 2012: 5.9 +Yes Misra C 2012: 6.1 +Yes Misra C 2012: 6.2 +No Misra C 2012: 6.3 +Yes Misra C 2012: 7.1 +Yes Misra C 2012: 7.2 +Yes Misra C 2012: 7.3 +Yes Misra C 2012: 7.4 +No Misra C 2012: 7.5 +No Misra C 2012: 7.6 +Yes Misra C 2012: 8.1 +Yes Misra C 2012: 8.2 +No Misra C 2012: 8.3 +Yes Misra C 2012: 8.4 +Yes Misra C 2012: 8.5 +Yes Misra C 2012: 8.6 +Yes Misra C 2012: 8.7 +Yes Misra C 2012: 8.8 +Yes Misra C 2012: 8.9 +Yes Misra C 2012: 8.10 +Yes Misra C 2012: 8.11 +Yes Misra C 2012: 8.12 +Yes Misra C 2012: 8.13 +Yes Misra C 2012: 8.14 +No Misra C 2012: 8.15 +No Misra C 2012: 8.16 +No Misra C 2012: 8.17 +Yes Misra C 2012: 9.1 +Yes Misra C 2012: 9.2 +Yes Misra C 2012: 9.3 +Yes Misra C 2012: 9.4 +Yes Misra C 2012: 9.5 +No Misra C 2012: 9.6 +No Misra C 2012: 9.7 +Yes Misra C 2012: 10.1 +Yes Misra C 2012: 10.2 +Yes Misra C 2012: 10.3 +Yes Misra C 2012: 10.4 +Yes Misra C 2012: 10.5 +Yes Misra C 2012: 10.6 +Yes Misra C 2012: 10.7 +Yes Misra C 2012: 10.8 +Yes Misra C 2012: 11.1 +Yes Misra C 2012: 11.2 +Yes Misra C 2012: 11.3 +Yes Misra C 2012: 11.4 +Yes Misra C 2012: 11.5 +Yes Misra C 2012: 11.6 +Yes Misra C 2012: 11.7 +Yes Misra C 2012: 11.8 +Yes Misra C 2012: 11.9 +No Misra C 2012: 11.10 +Yes Misra C 2012: 12.1 +Yes Misra C 2012: 12.2 +Yes Misra C 2012: 12.3 +Yes Misra C 2012: 12.4 +Yes Misra C 2012: 12.5 amendment:1 +No Misra C 2012: 12.6 amendment:4 require:premium +Yes Misra C 2012: 13.1 +No Misra C 2012: 13.2 +Yes Misra C 2012: 13.3 +Yes Misra C 2012: 13.4 +Yes Misra C 2012: 13.5 +Yes Misra C 2012: 13.6 +Yes Misra C 2012: 14.1 +Yes Misra C 2012: 14.2 +Yes Misra C 2012: 14.3 +Yes Misra C 2012: 14.4 +Yes Misra C 2012: 15.1 +Yes Misra C 2012: 15.2 +Yes Misra C 2012: 15.3 +Yes Misra C 2012: 15.4 +Yes Misra C 2012: 15.5 +Yes Misra C 2012: 15.6 +Yes Misra C 2012: 15.7 +Yes Misra C 2012: 16.1 +Yes Misra C 2012: 16.2 +Yes Misra C 2012: 16.3 +Yes Misra C 2012: 16.4 +Yes Misra C 2012: 16.5 +Yes Misra C 2012: 16.6 +Yes Misra C 2012: 16.7 +Yes Misra C 2012: 17.1 +Yes Misra C 2012: 17.2 +Yes Misra C 2012: 17.3 +No Misra C 2012: 17.4 +Yes Misra C 2012: 17.5 +Yes Misra C 2012: 17.6 +Yes Misra C 2012: 17.7 +Yes Misra C 2012: 17.8 +No Misra C 2012: 17.9 +No Misra C 2012: 17.10 +No Misra C 2012: 17.11 +No Misra C 2012: 17.12 +No Misra C 2012: 17.13 +Yes Misra C 2012: 18.1 +Yes Misra C 2012: 18.2 +Yes Misra C 2012: 18.3 +Yes Misra C 2012: 18.4 +Yes Misra C 2012: 18.5 +Yes Misra C 2012: 18.6 +Yes Misra C 2012: 18.7 +Yes Misra C 2012: 18.8 +No Misra C 2012: 18.9 +No Misra C 2012: 18.10 +Yes Misra C 2012: 19.1 +Yes Misra C 2012: 19.2 +Yes Misra C 2012: 20.1 +Yes Misra C 2012: 20.2 +Yes Misra C 2012: 20.3 +Yes Misra C 2012: 20.4 +Yes Misra C 2012: 20.5 +Yes Misra C 2012: 20.6 +Yes Misra C 2012: 20.7 +Yes Misra C 2012: 20.8 +Yes Misra C 2012: 20.9 +Yes Misra C 2012: 20.10 +Yes Misra C 2012: 20.11 +Yes Misra C 2012: 20.12 +Yes Misra C 2012: 20.13 +Yes Misra C 2012: 20.14 +Yes Misra C 2012: 21.1 +Yes Misra C 2012: 21.2 +Yes Misra C 2012: 21.3 +Yes Misra C 2012: 21.4 +Yes Misra C 2012: 21.5 +Yes Misra C 2012: 21.6 +Yes Misra C 2012: 21.7 +Yes Misra C 2012: 21.8 +Yes Misra C 2012: 21.9 +Yes Misra C 2012: 21.10 +Yes Misra C 2012: 21.11 +Yes Misra C 2012: 21.12 +Yes Misra C 2012: 21.13 amendment:1 +Yes Misra C 2012: 21.14 amendment:1 +Yes Misra C 2012: 21.15 amendment:1 +Yes Misra C 2012: 21.16 amendment:1 +Yes Misra C 2012: 21.17 amendment:1 +Yes Misra C 2012: 21.18 amendment:1 +Yes Misra C 2012: 21.19 amendment:1 +Yes Misra C 2012: 21.20 amendment:1 +Yes Misra C 2012: 21.21 amendment:3 +No Misra C 2012: 21.22 amendment:3 require:premium +No Misra C 2012: 21.23 amendment:3 require:premium +No Misra C 2012: 21.24 amendment:3 require:premium +No Misra C 2012: 21.25 amendment:4 require:premium +No Misra C 2012: 21.26 amendment:4 require:premium +Yes Misra C 2012: 22.1 +Yes Misra C 2012: 22.2 +Yes Misra C 2012: 22.3 +Yes Misra C 2012: 22.4 +Yes Misra C 2012: 22.5 +Yes Misra C 2012: 22.6 +Yes Misra C 2012: 22.7 amendment:1 +Yes Misra C 2012: 22.8 amendment:1 +Yes Misra C 2012: 22.9 amendment:1 +Yes Misra C 2012: 22.10 amendment:1 +No Misra C 2012: 22.11 amendment:4 require:premium +No Misra C 2012: 22.12 amendment:4 require:premium +No Misra C 2012: 22.13 amendment:4 require:premium +No Misra C 2012: 22.14 amendment:4 require:premium +No Misra C 2012: 22.15 amendment:4 require:premium +No Misra C 2012: 22.16 amendment:4 require:premium +No Misra C 2012: 22.17 amendment:4 require:premium +No Misra C 2012: 22.18 amendment:4 require:premium +No Misra C 2012: 22.19 amendment:4 require:premium +No Misra C 2012: 22.20 amendment:4 require:premium +No Misra C 2012: 23.1 amendment:3 require:premium +No Misra C 2012: 23.2 amendment:3 require:premium +No Misra C 2012: 23.3 amendment:3 require:premium +No Misra C 2012: 23.4 amendment:3 require:premium +No Misra C 2012: 23.5 amendment:3 require:premium +No Misra C 2012: 23.6 amendment:3 require:premium +No Misra C 2012: 23.7 amendment:3 require:premium +No Misra C 2012: 23.8 amendment:3 require:premium + + +Misra C++ 2008 +-------------- +Not available, Cppcheck Premium is not used + + +Misra C++ 2023 +-------------- +Not available, Cppcheck Premium is not used + + + + + +TEST variant options: +--enable=all --disable=unusedFunction --addon=misra -DPANDA -DUID_BASE /board/main.c -DSTM32H7 -DSTM32H725xx -I /board/stm32h7/inc/ Critical errors @@ -432,3 +865,237 @@ Not available, Cppcheck Premium is not used Misra C++ 2023 -------------- Not available, Cppcheck Premium is not used + + + + + +TEST variant options: +--enable=unusedFunction --suppress=unknownMacro --force -UDEBUG -UDEBUG_COMMS -UDEBUG_FAULTS -UDEBUG_FAN -UDEBUG_SPI -UDEBUG_UART -UDEBUG_USB /board/main.c -DPANDA -UPANDA_JUNGLE + + +Critical errors +--------------- +No critical errors, all files were checked. +Important: Analysis is still not guaranteed to be 'complete' it is possible there are false negatives. + + +Open source checkers +-------------------- +No Check64BitPortability::pointerassignment require:portability +No CheckAssert::assertWithSideEffects require:warning +No CheckAutoVariables::assignFunctionArg require:style,warning +Yes CheckAutoVariables::autoVariables +Yes CheckAutoVariables::checkVarLifetime +No CheckBool::checkAssignBoolToFloat require:style,c++ +Yes CheckBool::checkAssignBoolToPointer +No CheckBool::checkBitwiseOnBoolean require:style,inconclusive +No CheckBool::checkComparisonOfBoolExpressionWithInt require:warning +No CheckBool::checkComparisonOfBoolWithBool require:style,c++ +No CheckBool::checkComparisonOfBoolWithInt require:warning,c++ +No CheckBool::checkComparisonOfFuncReturningBool require:style,c++ +No CheckBool::checkIncrementBoolean require:style +Yes CheckBool::pointerArithBool +No CheckBool::returnValueOfFunctionReturningBool require:style +No CheckBoost::checkBoostForeachModification +Yes CheckBufferOverrun::analyseWholeProgram +No CheckBufferOverrun::argumentSize require:warning +Yes CheckBufferOverrun::arrayIndex +No CheckBufferOverrun::arrayIndexThenCheck +Yes CheckBufferOverrun::bufferOverflow +Yes CheckBufferOverrun::negativeArraySize +Yes CheckBufferOverrun::objectIndex +No CheckBufferOverrun::pointerArithmetic require:portability +No CheckBufferOverrun::stringNotZeroTerminated require:warning,inconclusive +Yes CheckClass::analyseWholeProgram +No CheckClass::checkConst require:style,inconclusive +No CheckClass::checkConstructors require:style,warning +No CheckClass::checkCopyConstructors require:warning +No CheckClass::checkDuplInheritedMembers require:warning +No CheckClass::checkExplicitConstructors require:style +No CheckClass::checkMemset +No CheckClass::checkMissingOverride require:style,c++03 +No CheckClass::checkReturnByReference require:performance +No CheckClass::checkSelfInitialization +No CheckClass::checkThisUseAfterFree require:warning +No CheckClass::checkUnsafeClassRefMember require:warning,safeChecks +No CheckClass::checkUselessOverride require:style +No CheckClass::checkVirtualFunctionCallInConstructor require:warning +No CheckClass::initializationListUsage require:performance +No CheckClass::initializerListOrder require:style,inconclusive +No CheckClass::operatorEqRetRefThis require:style +No CheckClass::operatorEqToSelf require:warning +No CheckClass::privateFunctions require:style +No CheckClass::thisSubtraction require:warning +No CheckClass::virtualDestructor +No CheckCondition::alwaysTrueFalse require:style +No CheckCondition::assignIf require:style +No CheckCondition::checkAssignmentInCondition require:style +No CheckCondition::checkBadBitmaskCheck require:style +No CheckCondition::checkCompareValueOutOfTypeRange require:style,platform +No CheckCondition::checkDuplicateConditionalAssign require:style +No CheckCondition::checkIncorrectLogicOperator require:style,warning +No CheckCondition::checkInvalidTestForOverflow require:warning +No CheckCondition::checkModuloAlwaysTrueFalse require:warning +No CheckCondition::checkPointerAdditionResultNotNull require:warning +No CheckCondition::clarifyCondition require:style +No CheckCondition::comparison require:style +No CheckCondition::duplicateCondition require:style +No CheckCondition::multiCondition require:style +No CheckCondition::multiCondition2 require:warning +No CheckExceptionSafety::checkCatchExceptionByValue require:style +No CheckExceptionSafety::checkRethrowCopy require:style +No CheckExceptionSafety::deallocThrow require:warning +No CheckExceptionSafety::destructors require:warning +No CheckExceptionSafety::nothrowThrows +No CheckExceptionSafety::rethrowNoCurrentException +No CheckExceptionSafety::unhandledExceptionSpecification require:style,inconclusive +No CheckFunctions::checkIgnoredReturnValue require:style,warning +No CheckFunctions::checkMathFunctions require:style,warning,c99,c++11 +Yes CheckFunctions::checkMissingReturn +Yes CheckFunctions::checkProhibitedFunctions +Yes CheckFunctions::invalidFunctionUsage +No CheckFunctions::memsetInvalid2ndParam require:warning,portability +No CheckFunctions::memsetZeroBytes require:warning +No CheckFunctions::returnLocalStdMove require:performance,c++11 +No CheckFunctions::useStandardLibrary require:style +No CheckIO::checkCoutCerrMisusage require:c +Yes CheckIO::checkFileUsage +Yes CheckIO::checkWrongPrintfScanfArguments +No CheckIO::invalidScanf +Yes CheckLeakAutoVar::check +No CheckMemoryLeakInClass::check +Yes CheckMemoryLeakInFunction::checkReallocUsage +Yes CheckMemoryLeakNoVar::check +No CheckMemoryLeakNoVar::checkForUnsafeArgAlloc +Yes CheckMemoryLeakStructMember::check +Yes CheckNullPointer::analyseWholeProgram +Yes CheckNullPointer::arithmetic +Yes CheckNullPointer::nullConstantDereference +Yes CheckNullPointer::nullPointer +No CheckOther::checkAccessOfMovedVariable require:c++11,warning +No CheckOther::checkCastIntToCharAndBack require:warning +No CheckOther::checkCharVariable require:warning,portability +Yes CheckOther::checkComparePointers +No CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse require:warning +No CheckOther::checkConstPointer require:style +No CheckOther::checkConstVariable require:style,c++ +No CheckOther::checkDuplicateBranch require:style,inconclusive +No CheckOther::checkDuplicateExpression require:style,warning +Yes CheckOther::checkEvaluationOrder +No CheckOther::checkFuncArgNamesDifferent require:style,warning,inconclusive +No CheckOther::checkIncompleteArrayFill require:warning,portability,inconclusive +No CheckOther::checkIncompleteStatement require:warning +No CheckOther::checkInterlockedDecrement require:windows-platform +Yes CheckOther::checkInvalidFree +No CheckOther::checkKnownArgument require:style +No CheckOther::checkKnownPointerToBool require:style +No CheckOther::checkMisusedScopedObject require:style,c++ +No CheckOther::checkModuloOfOne require:style +No CheckOther::checkNanInArithmeticExpression require:style +Yes CheckOther::checkNegativeBitwiseShift +Yes CheckOther::checkOverlappingWrite +No CheckOther::checkPassByReference require:performance,c++ +No CheckOther::checkRedundantAssignment require:style +No CheckOther::checkRedundantCopy require:c++,performance,inconclusive +No CheckOther::checkRedundantPointerOp require:style +No CheckOther::checkShadowVariables require:style +No CheckOther::checkSignOfUnsignedVariable require:style +No CheckOther::checkSuspiciousCaseInSwitch require:warning,inconclusive +No CheckOther::checkSuspiciousSemicolon require:warning,inconclusive +No CheckOther::checkUnreachableCode require:style +No CheckOther::checkUnusedLabel require:style,warning +No CheckOther::checkVarFuncNullUB require:portability +No CheckOther::checkVariableScope require:style,notclang +Yes CheckOther::checkZeroDivision +No CheckOther::clarifyCalculation require:style +No CheckOther::clarifyStatement require:warning +No CheckOther::invalidPointerCast require:portability +No CheckOther::redundantBitwiseOperationInSwitch require:warning +No CheckOther::warningOldStylePointerCast require:style,c++ +No CheckPostfixOperator::postfixOperator require:performance +No CheckSizeof::checkSizeofForArrayParameter require:warning +No CheckSizeof::checkSizeofForNumericParameter require:warning +No CheckSizeof::checkSizeofForPointerSize require:warning +No CheckSizeof::sizeofCalculation require:warning +No CheckSizeof::sizeofFunction require:warning +No CheckSizeof::sizeofVoid require:portability +No CheckSizeof::sizeofsizeof require:warning +No CheckSizeof::suspiciousSizeofCalculation require:warning,inconclusive +No CheckStl::checkDereferenceInvalidIterator require:warning +No CheckStl::checkDereferenceInvalidIterator2 +No CheckStl::checkFindInsert require:performance +No CheckStl::checkMutexes require:warning +No CheckStl::erase +No CheckStl::eraseIteratorOutOfBounds +No CheckStl::if_find require:warning,performance +No CheckStl::invalidContainer +No CheckStl::iterators +No CheckStl::knownEmptyContainer require:style +No CheckStl::misMatchingContainerIterator +No CheckStl::misMatchingContainers +No CheckStl::missingComparison require:warning +No CheckStl::negativeIndex +No CheckStl::outOfBounds +No CheckStl::outOfBoundsIndexExpression +No CheckStl::redundantCondition require:style +No CheckStl::size require:performance,c++03 +No CheckStl::stlBoundaries +No CheckStl::stlOutOfBounds +No CheckStl::string_c_str +No CheckStl::useStlAlgorithm require:style +No CheckStl::uselessCalls require:performance,warning +No CheckString::checkAlwaysTrueOrFalseStringCompare require:warning +No CheckString::checkIncorrectStringCompare require:warning +No CheckString::checkSuspiciousStringCompare require:warning +No CheckString::overlappingStrcmp require:warning +Yes CheckString::sprintfOverlappingData +Yes CheckString::strPlusChar +Yes CheckString::stringLiteralWrite +Yes CheckType::checkFloatToIntegerOverflow +Yes CheckType::checkIntegerOverflow +No CheckType::checkLongCast require:style +No CheckType::checkSignConversion require:warning +Yes CheckType::checkTooBigBitwiseShift +Yes CheckUninitVar::check +Yes CheckUninitVar::valueFlowUninit +Yes CheckUnusedFunctions::check +No CheckUnusedVar::checkFunctionVariableUsage require:style +No CheckUnusedVar::checkStructMemberUsage require:style +Yes CheckVaarg::va_list_usage +Yes CheckVaarg::va_start_argument + + +Premium checkers +---------------- +Not available, Cppcheck Premium is not used + + +Autosar +------- +Not available, Cppcheck Premium is not used + + +Cert C +------ +Not available, Cppcheck Premium is not used + + +Cert C++ +-------- +Not available, Cppcheck Premium is not used + + +Misra C +------- +Misra is not enabled + + +Misra C++ 2008 +-------------- +Not available, Cppcheck Premium is not used + + +Misra C++ 2023 +-------------- +Not available, Cppcheck Premium is not used diff --git a/tests/misra/test_misra.sh b/tests/misra/test_misra.sh index 7359e354ef5..5285e39d404 100755 --- a/tests/misra/test_misra.sh +++ b/tests/misra/test_misra.sh @@ -61,6 +61,7 @@ cppcheck() { fi } + printf "\n${GREEN}** Test whole project - Misra and unused functions **${NC}\n" IGNORE_CRYPTO="-i$PANDA_DIR/crypto/rsa.c -i$PANDA_DIR/crypto/sha.c --suppress=*:*crypto/* "