Commit Graph

835 Commits (spacecruft)

Author SHA1 Message Date
robbederks 1c6093559d
Allow DFU if OTP block is not locked yet (#405)
* Allow DFU if OTP block is not locked yet

* Fixed misra

* Fixed logic
2019-12-17 22:00:17 +01:00
Willem Melching ce13938ab3 fix typo in elm327 addr comparison 2019-12-16 18:00:40 -08:00
Riccardo e3f1dd78d2 ELM327: allow all addresses between 0.700 and 0x800 2019-12-16 17:51:20 -08:00
George Hotz 39818691dd setting long_controls_allowed is only possible on debug builds 2019-12-14 08:32:24 -08:00
Riccardo 4e9d788af7 Remove not-needed cadillac-init 2019-12-12 18:23:03 -08:00
Riccardo f0a5d154cf typo 2019-12-12 11:11:27 -08:00
robbederks c093286b1d
Add bootkick after re-enabling phone power (#401) 2019-12-11 13:42:25 +01:00
George Hotz eadb0dbb1d
security upgrades (#397)
* security upgrades

* Gated DFU entry from debug console as well
2019-12-10 08:14:30 -08:00
Willem Melching 7c13bec09f
Command to get signature (#399)
* Commands to get signature from panda

* does this make misra happy?

* Can I do this in misra?

* this works and makes misra happy

* Add jenkins test for get signature

* Remove comments

* Add comment about code size

* Fix firmware file path
2019-12-09 10:54:48 -08:00
Willem Melching dad439a46e
static assert on size of health packet (#398) 2019-12-09 10:39:04 -08:00
Riccardo df4159c846 Revert "Revert "Register readback on most modules. Still need to convert the other ones (#396)""
This reverts commit 56ec215024.
2019-12-05 14:19:29 -08:00
Riccardo 56ec215024 Revert "Register readback on most modules. Still need to convert the other ones (#396)"
This reverts commit 893e486194.
2019-12-05 13:55:20 -08:00
robbederks 893e486194
Register readback on most modules. Still need to convert the other ones (#396)
* Added an initial working implementation of the register readback and applied it to the LLCAN registers. Also fixed an init bug in CAN.

* Locally disable pylint import error

* Reverted change to CAN-obj->FA1R setting

* Fixed misra compliance

* Changed hash function name

* Fixed CAN filter setting

* Added voltage health test

* Converted ADC to register functions

* Converted clock to use register setters

* Added check to see if fault status is zero after running test

* Converted DAC to use register setters

* Converted fan to use register setters

* Converted gmlan bitbanging to use register setters

* Changed over interrupt driver to use register setters. Also moved some includes and definition places for critical sections

* Fixed build

* Converted LLGPIO to use register setters

* Converted pwm to use register setters

* Fixed cold boot

* Fixed health fault check in automated tests

* Added comment for the future (issue #367)

* Converted RTC driver to use register setters

* Converted SPI to use register setters

* Converted timer driver to use register setters

* Fixed register fault on white pandas and disabled showing of fault for release

* Bump version
2019-12-04 20:42:57 -08:00
Riccardo 6bbae7be2f VW safety: allow cancel spam on both buses to be compatible with camera and gateway integration 2019-12-03 19:48:33 -08:00
Riccardo 1bcc351f29 ignition_can: set it to False after 2s of not seeing CAN msgs 2019-12-03 16:44:55 -08:00
Riccardo 96137f1a8a VW can based ignition not needed. it has ignition line at camera as well. 2019-12-03 16:27:34 -08:00
robbederks 656f99b080
Interrupt refactor (NVIC_SM_1: #334) and Fault handling (#377) (PR #373) 2019-11-27 18:11:21 -08:00
Jason Young 7f9b4a59b6 Fix USB device enumeration on Windows 8.1 and Windows 10 (#393)
* Remove USB 2.0 Extension from BOS descriptor.

* Declutter usb.h of unused code.

Now that I'm more confident the USB 2.0 Extensions are only required
for USB 3.0 devices, and there's less mystery around why the change
worked for us, garbage-collect the commented-out descriptor.
2019-11-27 11:03:37 -08:00
Riccardo fb6bc3ba7e Fix Misra 2019-11-27 00:19:41 -08:00
Riccardo 878dd00ac8 solve race condition is relay_malfunction right after changing the relay status by adding a counter 2019-11-26 21:37:01 -08:00
Riccardo 2d4cb05cf1 add a safety mode counter 2019-11-26 21:20:04 -08:00
Robbe a6797a213e Implement USB power mode on uno 2019-11-26 19:37:38 -08:00
Robbe ca39a5d8f6 Added faults integer to health packet 2019-11-26 17:07:51 -08:00
robbederks f458d67a7c Add uptime counter to the health packet (#391)
* Added uptime counter to the health packet

* fix tests by setting power save on on EON build
2019-11-21 16:47:49 -08:00
Riccardo 16624811c4 enable CAN transcievers outside the set_safety_mode function, which is not related 2019-11-21 13:42:36 -08:00
rbiasini 1192d934a0
Power saving refactor (#389)
* Exit power saving also for CAN based ingition detection and replace interrup with simple state machine. a bit of delay it's fine

* bug fixes and also CDP set on start

* sorry misra

* move comment

* typo

* remove ignition interrupts

* Power saving state machine should be done by boardd, which also sets safety modes and usb power modes

* typo

* Added usb command for power save state setting

* Added power save enabled packet

* Added power_save_enabled to python lib too
2019-11-21 12:53:00 -08:00
Riccardo d58d08fbbf Fix Misra 17.8: can't mod function params 2019-11-20 15:13:26 -08:00
Riccardo bc685ac91b Minor indent 2019-11-20 14:04:07 -08:00
Riccardo a54b86c4ba Failure of set_safety_mode falls back to SILENT. Failure to set silent results in hanging 2019-11-20 13:36:29 -08:00
rbiasini 597436d32a
NOOUTPUT safety mode is now SILENT. NOOUTPUT still exists but keeps C… (#388)
* NOOUTPUT safety mode is now SILENT. NOOUTPUT still exists but keeps CAN live

* README mention of 'no output'

* mispelled
2019-11-20 11:56:26 -08:00
rbiasini d229f8dcd3
ESP forced off in EON build. this prevents ESP to be turned on when e… (#387)
* ESP forced off in EON build. this prevents ESP to be turned on when exiting power mode: 0.5W power save! Also, boardd does not need to set ESP to off anymore

* don't touch ESP uart

* Refactored ESP/GPS initting

* Fixed white detection
2019-11-19 18:41:59 -08:00
Riccardo fb81414305 mispelled word 2019-11-19 10:22:22 -08:00
Riccardo 57f5ef8cd8 Fix misra: addr can't be more than 29 bits anyway 2019-11-18 15:53:08 -08:00
Riccardo 68ff501277 typo 2019-11-18 13:13:31 -08:00
Riccardo d5c772b0b1 Fixe Toyota message white-list 2019-11-18 12:52:31 -08:00
Riccardo 48197a9216 Better masking for ELM mode 2019-11-18 12:05:05 -08:00
Riccardo 212d336b3d Safety Chrysler: Added cancel spam button check 2019-11-17 22:32:13 -08:00
rbiasini 6249a183d6
tx_hook shall have a white-list of messages (#381)
* Started whitelisting messages

* Also toyota and cadilalc fix

* bug fixes and better checks. Need to figure out a solution for honda

* Whitelist also for subaru

* Added Chrysler as well to whitelist

* And Hyundai too

* now all supported cars should have a whitelist of messages

* Fix linter

* This should fix process replay

* Honda too is now whitelisted

* struct typedef

* Had forgot GM

* had a wrong addr for GM whitelist

* This should fix all the tests

* bump panda
2019-11-17 00:24:19 -08:00
Riccardo 86dec4b8ba Safety modes that violate ISO26262 requirements are not compiled in RELEASE build 2019-11-15 12:20:15 -08:00
rbiasini cfcce8f06b
WIP: Relay malfunction (#384)
* relay malfunction handling. WIP

* more cars to relay_malfunctions

* fixed safety tests

* minor change

* Fix linter

* all cars now have a relay_malfunction safety check

* added relay_malfunction safety test for fwd hooks

* added proper regression tests for relay malfunction to all cars

* temp patch to not fail regression in honda bosch

* also addr 0x194 is some nidec honda is steer control

* proper relay check for honda bosch too
2019-11-15 00:32:45 -08:00
Riccardo 69d9d610a5 No tabs in mazda safety 2019-11-14 18:58:05 -08:00
Riccardo a86418c140 insignificant changes 2019-11-14 16:33:26 -08:00
Riccardo d063a18885 Hyundai safety: re-enable button spam safety check 2019-11-13 23:57:29 -08:00
rbiasini 4d1edc068b
skip tx_hook if a message is forwarded (#379) 2019-11-13 23:50:42 -08:00
Riccardo df2ff04583 bump version 2019-11-13 16:11:50 -08:00
Riccardo 168461d5e4 added fault state to health packet 2019-11-13 16:01:20 -08:00
Robbe 32725cc385 Fixed misra compliance 2019-11-09 14:22:16 -08:00
Riccardo 312ba62d43 minor comment cleanupo 2019-11-07 12:42:29 -08:00
Robbe e90897a834 Fix board detection on white 2019-11-06 15:00:07 -08:00
Riccardo 0e72c18378 always stop executing if safety mode fails to be set (suggested by jyoung8607) 2019-11-06 14:45:32 -08:00
Riccardo e8d7ed1d90 Rename function name to not confuse safety_set_mode and set_safety_mode 2019-11-06 14:30:22 -08:00
Comma Device bac4d85434 dos and python3 2019-11-06 21:42:07 +00:00
robbederks e0762c2e77
Add Python & USB API for controlling phone power (#313)
* Added interface for phone power

* Add power function in python

* Fixed struct
2019-11-04 17:26:37 -08:00
Riccardo 256d274e76 Fix Mac installation instruction per: https://github.com/commaai/panda/pull/308/files 2019-10-31 16:23:55 -07:00
Robbe b143a1cf9e Fixed Misra complaint 2019-10-31 11:58:36 -07:00
Robbe 606f1d9131 Fixed RTC on non-uno boards, second try. Cannot work when there is no xtal. 2019-10-30 18:30:00 -07:00
robbederks 933c757705
Fix RTC on non-uno boards (#311)
* Fan and IR at 0 when in power savings mode

* Initialise RTC for all boards, not only uno. Fixes hang while getting time from non-initialized RTCs
2019-10-30 18:11:30 -07:00
rbiasini 48d0d0c782
VW button spam: fix safety and add tests (#306)
* VW button spam: fix safety and add tests

* button spam is actually sent on bus 2

* Fix safety test. Still need to add gas safety test

* added gas safety test to VW and using consistent nomenclature

* style fixes
2019-10-29 15:11:42 -07:00
robbederks 6cccf969ab
Fan and IR at 0 when in power savings mode (#309) 2019-10-29 12:36:47 -07:00
Riccardo 05373282a2 board get_sdk scripts were left on python2 2019-10-29 11:51:37 -07:00
Robbe 1965817d30 Changed default values for testing 2019-10-25 16:24:53 -07:00
rbiasini a12a148d5f Uno (#274)
* Added uno

* Added usb switch support

* Added PWM and IR power functions

* Implemented bootkick

* Added uno as a new hw type

* Bumped version

* Added fan control and tach readout

* WIP: RTC support

* Working RTC

* Fixed python

* Misra compliance

* Added USB control messages for fan/IR power

* Added USB commands + tests for fan & IR control. Fixed bootstub and pedal compilation

* Added IR and fan to power saving mode

* Changed defaults

* Fix safety considering uno

* passing safety now

* Minor UNO tweaks

* Fixed version

* More minor temporary tweaks

* Removed usb load switch from uno

* Added power control for shutting down the fan completely

* Disable IR LEDs by default

* Fixed linter issue

* Linter fix #2
2019-10-25 16:22:42 -07:00
Riccardo 40075321dc VW: stricter limits to comply with comma safety policy 2019-10-24 19:52:16 -07:00
Riccardo e2e2be92c9 add safety mode to health packet 2019-10-24 15:33:27 -07:00
Riccardo 101238c7f6 turned on VW ignition based CAN logic 2019-10-22 17:27:35 -07:00
Riccardo a0d8d5dae7 fix misra 5.3: check_ignition is intended as check_started and can't be used twice 2019-10-22 16:12:18 -07:00
Riccardo ea636de615 made check_ignition function to both look at ignition_line and ignition_can 2019-10-22 15:27:55 -07:00
rbiasini 1102e69652
make ignition logic common for all cars (#303)
* make ignition logic common for all cars

* ignition_can is not a safety thing. move it to can drivers

* bump version

* gm safety passive is deprecated

* move tx 1 on logic into board specific headers.
2019-10-22 15:10:43 -07:00
dekerr 55dfa52306 Update core to CMSIS 5.6 release (#251)
* initial commit

* release version
2019-10-16 15:19:01 -07:00
rbiasini fce38a91d7
Linter python (#299)
* Added pyflakes and Pylint for python

* Actually run linter in CI

* some simple pyflakes changes

* Add flake8 to panda reqs for linter test

* flake8 errors are fixed

* run flake8 in regression tests

* meant to run flake8

* hack to ignore unused import

* bug

* fix bugs in tucan_loopback

* Another fix by using set_safety_mode

* added pylintrc file

* more fixes and enabled pylint as well

* Fix pylint in circleci

* added linter to readme
2019-10-15 14:03:31 -07:00
Jason Young 2f9e076289 Panda safety code for Volkswagen, Audi, SEAT, and Å koda (#293)
* Panda safety code for Volkswagen, Audi, SEAT, and Å koda.

* First pass at MISRA compliance.

* Second pass at MISRA compliance.

* Fix scope of violation boolean.

* MISRA doesn't care for implicit cast of unsigned int to boolean.

* Remove superfluous newline.

* Remove unused VW ignition hook code, preserve commentary.

* Add 50% padding to max delta check.

* Add 50% padding to max delta check.

* Add clarity around the origin of our safety constants.

* Update test RT delta to match safety.
2019-10-09 13:54:22 -07:00
robbederks 0812362b52 GPS UART fix until boardd is refactored (#294)
* Temporary GPS fix

* spaces
2019-10-08 19:41:10 -07:00
robbederks 0894b28f1e Fixed USB power mode on black (#291)
* Fixed USB power mode on black

* bump version
2019-10-05 20:34:19 -07:00
rbiasini 4b3358c921
patch to be able to switch from EON to PC with a Panda that has EON b… (#290)
* fix switching from EON to PC with a Panda that has EON build and not 12V supply
2019-10-04 14:51:26 -07:00
robbederks a95c44a717
Made setting of NOOUTPUT on no heartbeat more efficient (#287)
* Made setting of NOOUTPUT on no heartbeat more efficient

* Stupid mistake

* Fixed hardcoded safety mode
2019-10-04 13:30:00 -07:00
robbederks 9486836886
UART instability fix with high interrupt load (#283)
* Fixed UART overrun error

* Added stability test scripts

* Refactored UART code. ESP/GPS now uses DMA in circular mode to directly write into the ring buffer, saving a bunch of interrupts and potential race conditions.

* Changed stability test to use amount of bytes instead of amount of non-zero messages, since the ring buffer pointer is only updated on half or full DMA transfer or on line idle (e.g. no more 1 char messages from the gps)

* Increase data limit. It's too low sometimes in normal operation

* Forgot to set write pointer in ring buffer

* Increased test limit even more
2019-10-04 13:28:56 -07:00
rbiasini 9a9e9d47bc
Fix usb_power_mode missing initialization (#289)
* Fix usb_power_mode missing initialization

* typo

* re-added NONE usb power mode, so usb_power_mode is only set in set_usb_power_mode func
2019-10-04 10:48:17 -07:00
rbiasini 70219d7bb2
match safety enum in cereal (#285)
* match safety enum in cereal

* removing tons of hardcoding

* add pythonpath to safety test

* Fix safety test in Docker
2019-10-02 18:20:32 -07:00
rbiasini 78ef4a6ebc
Stop charge (#284)
* CDP by default in EON build on white panda

* Cleaned up power mode setting

* send usb power mode in health

* cleaner CDP setting on ignition

* bump panda
2019-10-02 11:48:40 -07:00
Arne Schwarck 5266a40287 Fix typo (#286) 2019-10-02 11:40:38 -07:00
Riccardo f4787ec5a2 Revert "turn on CDP when ignition switches on (#281)"
This reverts commit 8c1df559f7.
2019-10-01 17:01:14 -07:00
Riccardo d37daee978 Revert "NONE and CLIENT should be the same thing in white/grey pandas"
This reverts commit e97b283e77.
2019-10-01 15:20:59 -07:00
Riccardo e97b283e77 NONE and CLIENT should be the same thing in white/grey pandas 2019-10-01 15:16:13 -07:00
rbiasini 8c1df559f7
turn on CDP when ignition switches on (#281) 2019-09-30 21:48:30 -07:00
rbiasini fac0277169
Misra update (#280)
* Updated cppcheck ref. New rules to be fixed

* changed 2 MACRO names that had more than 31 characters in common

* Fix newly popped 10.4: same type on arithmetic ops

* Fix 18.4: operators should not be applied to an expression

* ensure a NULL pointer isn't dereferenced
2019-09-27 17:18:02 -07:00
Robbe c4ac3d63be Disable GPS load switching on black pandas 2019-09-27 13:22:06 -07:00
Riccardo 2dc34096a0 2to3 applied 2019-09-24 22:33:46 -07:00
Riccardo 1e2412a297 env python -> env python3 2019-09-24 17:50:53 -07:00
Jafar Al-Gharaibeh 9881e61184 Panda for Mazda (#165)
Implement the safety limits
Smarter forwarding:
   Detect what msgs are sent by OP and drop corresponding CAM msgs
   Detect if Stock CAM is connected
   Detect if CAM is in hardware passthrough

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
2019-09-09 15:58:41 -07:00
Bugsy a8ed7d2199 add subaru outback/legacy to subaru safety (#259)
* add subaru outback/legacy safety

* subaru safety passes misra check

* change violation to bool
2019-09-09 15:13:02 -07:00
George Hotz bdeb1c953f mazda is #12 2019-09-09 14:56:14 -07:00
Riccardo 14ea4d2e07 merge safety gm in a single file 2019-09-08 14:07:05 -07:00
Vasily Tarasov bf1ef875ee Add GM passive safety mode (#266) 2019-09-08 14:02:27 -07:00
BogGyver c131fffaeb fix canflash for pedal (#267) 2019-09-05 08:24:49 -07:00
George Hotz 3397b1527e only allow bootloader entry on debug builds 2019-09-04 16:05:50 -07:00
rbiasini d68356b924
Honda Nidec: fwd stock AEB (#257)
* Honda Nidec: fwd stock AEB

* bug

* correct aeb bit

* typo

* Revert "typo"

This reverts commit d424198b1fbc5a783c39b5bdd7d034865ed61a83.

* typo

* bug fix

* don't have tx hook blocking aeb messages from stock system

* typo

* fwd stock brake even if they are the same

* only stop forwarding aeb when aeb flag clears

* Fix safety tests

* Added fwd safety tests

* tiny bit more readable
2019-08-30 20:15:03 -07:00
robbederks 6f532c6d51 Black panda Jenkins (#256)
* Jenkins test refactor and black panda addition

* Added HW types needed by previous commit

* Fixed ignition interrupts when not on EON build

* Added functions for load switches

* More test scripts for black panda

* Added NONE power mode to the code

* Fixed race condition when setting GPIO pins was interrupted.

* Added relay test script

* Fixed flashing with critical sections and GPS load switch

* Fixing critical depth after reboot

* Made the loopback test asserting

* Made critical depth a local variable to avoid race conditions

* Added GPS to power savings mode

* Fixed DFU mode on white panda and bumped version

* Fixed PEDAL_USB compilation error

* Fixed misra compliance of new critical depth code

* Cleaned up heartbeat logic in the testing code. Re-added ALL_CAN_BUT_MAIN_SILENT. Bumped version. Improved critical section code.

* Fixed DFU flashing (once again)

* Fixed VERSION

* Added relay endurance test

* Changed to alloutput on ELM mode for fingerprinting.

* Fixed minor remarks
2019-08-28 12:57:42 -07:00
robbederks d68508c79a Gpio race condition fix (#263)
* Fixed pedal not initializing

* Interrupt changes

* More changes
2019-08-28 12:53:51 -07:00
robbederks d69d05fc0f Fixed pedal not initializing (#262) 2019-08-26 19:24:24 -07:00
Riccardo 36067e01c7 Honda safety: fixed incorrect brake decoding. Due to the specific limit of 255, this change does not affect the safety behavior 2019-08-22 20:29:44 -07:00
Robbe 519e39e494 Changed heartbeat timeout to be 2 seconds on no ignition 2019-07-24 14:36:01 -07:00
rbiasini 59f5813173
Black (#254)
* late usb

* Added type support for black panda

* Added harness presence and orientation detection

* harness relay driving code

* Added intercept support in black panda code. Switched around can0 and can2

* Disable ADCs after orientation detection. Ignition interrupts via harness

* WIP: Hardware abstraction layer + black panda bringup

* Fixed bootstub build

* Fixed bootstub for pedal

* Fixed infinite loops

* Got CAN buses working on white again

* Fixed pedal build and black can interfaces

* Got CAN buses working on black panda

* Finished loopback test for black panda

* Erase all flash sectors on the panda. Increased binary limit. Added extra python functions.

* Fixed python

* Made new code MISRA compliant

* Cleaned up ignition. Fixed build

* Fixed health packet

* Fixed CAN mode on black bug. Changed OBD to switch on ELM mode

* Fixes from Github review

* Fixed MISRA issue for pedal

* Fixed failing gmlan tests

* ELM327 safety: allow diagnostic on all buses

* Cleaned up EON relay code

* delete only 3 sectors instead of 11 to allow a new build to be flashed. Much faster to flash

* Removed CAN only can0 output mode. Does not make sense on black panda due to reversibility issues.

* Added heartbeat logic for EON code on panda. Go to NOOUTPUT if EON does not send a heartbeat for 5 seconds.

* Remove all CAN buses live on EON startup. Shouldn't be necessary to have this separate case

* Formatting

* Added file I forgot to push

* Added heartbeat to testing code to make sure EON tests don't fail. Should probably find a better way to do this though. Heartbeat thread didn't work, concurrent USB connection issues...

* Safety: support black panda for Honda Bosch

* Disable OBD2 if setting to NOOUTPUT mode

* Run safety tests for all hw_types

* Fail test if subtest fails

* fix safety tests
2019-07-23 15:07:06 -07:00
dekerr 45d0d286f4 remove whitespace (#255) 2019-07-19 19:35:50 -07:00
rbiasini e49d0dbbd6
Pedal: use avg between tracks (#253) 2019-07-15 13:15:22 -07:00
rbiasini 01072bec0b
Misra 11.x: pointer usage. (#250)
* RDLR, RDHR gone from safety

* back at not failing misra safety

* fix safety tests

* did not mean this

* Use get-bytes in pedal too

* Ignore Misra 11.5 and Fix 11.8 violaitons

* Fix 11.3 violations

* Neglect Misra 11.4, fix pointer issue in bootstub and rutn on Werror for pedal builds

* Fix Misra 11.6: can't assign number to void pointer

* Fix test after changing honda_moving name

* for loop is better

* Fix bugs from fbck
2019-07-10 20:56:03 -07:00
rbiasini fd68c26aba
Propagate can_push errors (#249)
* Misra 17.7: counting can_push errors
2019-07-10 17:27:26 -07:00
George Hotz fcb1208e15 fix weird code in USB_ReadPacket 2019-07-09 15:08:25 -07:00
Riccardo 0b19206360 Misra 17.7: The value returned by a function having non-void return type shall be used. We should hang on initial failed safety_set_mode 2019-07-08 20:08:53 -07:00
Riccardo f45dd04c67 cppcheck: ignore redundantAssignment and selfAssignment for registers in llcan.h 2019-07-08 17:16:15 -07:00
Riccardo 9ce6311558 Misra 12.1 (operator order) and 10.4 (incompatible essential types) fixes, arised after properly checking UID_BASE config 2019-07-08 15:51:20 -07:00
rbiasini 23e3684d70
Cppcheck unused functions (#247)
* Skip cppcheck on unused functions that are consumed in large headers we can't pass to cppcheck
2019-07-08 15:13:52 -07:00
Riccardo c97d60be64 Removed bad language 2019-07-08 12:05:08 -07:00
Riccardo d9d0a62f2b Misra 5.5: missed this change from previous PR 2019-07-07 22:22:05 -07:00
rbiasini 85fa3c02ae
Misra 5.5: Identifiers shall be distinct from macro names (#246)
* Misra 5.5: Identifiers shall be distinct from macro names
2019-07-07 22:19:02 -07:00
Riccardo 190d604a0b Pedal: 2 minor fixes to Misra 15.7 (else needed) and 17.7 (non-void output must be used) 2019-07-07 22:07:14 -07:00
Riccardo 8ea01ff127 Pedal: no built-in functions to avoid puts and putc re-definitions 2019-07-07 21:38:40 -07:00
rbiasini 1f40d1e6a6
Misra pedal (#245)
* Fix misra on pedal
2019-07-07 16:59:31 -07:00
Riccardo e6dc4172b1 Minor indent error 2019-07-07 15:57:14 -07:00
Riccardo 247e128b45 Fix strict compiler on bootstub build 2019-07-07 15:05:47 -07:00
Riccardo ba68569216 Removed build strict test and enabled -Werror flag 2019-07-07 14:46:03 -07:00
rbiasini f7bd2c2f38
Misra 10.4: fix last 2 violations (#242) 2019-07-04 02:27:21 -07:00
rbiasini 9be5fdead9
finished misra 17.8 (#241) 2019-07-04 01:37:26 -07:00
rbiasini 3c3aba3dbc
Misra 10.4: Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category (#240)
* Almost done with 10.4, a couple of non-obvious violations remaining
2019-07-04 01:04:58 -07:00
Riccardo f2a3a177b3 Misra 15_7: fix what seems to be a false positive of cppcheck 2019-07-03 20:53:00 -07:00
rbiasini 812ace5386
Misra 15_7: if … else if constructs should be terminated with an else clause (#230)
* Fixed all Misra 15_7 violations
2019-07-03 20:48:02 -07:00
rbiasini 1bd9284372
Misra 17.7: the value returned by a function having non-void return shall be used (#237)
* Fixed Misra 17.7 violations except for can_push
2019-07-03 16:01:01 -07:00
George Hotz 18c9e88bc0
Merge pull request #238 from commaai/misra_17_8
Misra 17.8: a function parameter should not be modified
2019-07-03 13:36:49 -07:00
George Hotz 7ac321de4e
Merge pull request #235 from commaai/memxxx
memxxx function changes to be Misra compliant
2019-07-03 13:35:49 -07:00
Riccardo 7cd80de23a typo 2019-07-03 02:07:02 -07:00
Riccardo 385e33b32c 12.1 regression 2019-07-03 02:04:25 -07:00
Riccardo 955842bae6 WIP 2019-07-03 01:59:27 -07:00
rbiasini ea908cbb75
10_1 violations: Operands shall not be of an inappropriate essential type (#233)
* 10_1 violations
2019-07-02 23:43:06 -07:00
rbiasini fa33038055
Fix Misra 5.3: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope (#236)
* Fix Misra 5.3
2019-07-02 22:39:00 -07:00
Riccardo cf6985ad15 memxxx function changes to be Misra compliant 2019-07-02 17:43:54 -07:00
Riccardo ecb9b6c01f Revert "Misra 10 1: Operands shall not be of an inappropriate essential type (#232)"
This reverts commit 8732e4faf0.
2019-06-30 13:43:21 -07:00
rbiasini 8732e4faf0
Misra 10 1: Operands shall not be of an inappropriate essential type (#232)
Fixe Misra 10.1 violations
2019-06-30 15:07:04 -05:00
rbiasini ae816c104a
Fix 15_6 violations (#231) 2019-06-28 13:46:57 -07:00
rbiasini abd841e9be
Fix all 16_4 violations (#229) 2019-06-27 15:50:00 -07:00
Riccardo ec3d0386c2 refactor set_power_save_state 2019-06-26 18:24:21 -07:00
Riccardo c27e7848f3 fix conflicts 2019-06-26 16:17:30 -07:00
rbiasini 4886b6b984
Misra 12.1: The precedence of operators within expressions should be made explicit (#227)
* Fixed all misra 12.1 violations
2019-06-26 16:16:35 -07:00
Riccardo 3fd6b337f9 ops, bug 2019-06-26 15:59:32 -07:00
Riccardo e3c5e7da8c Fix Misra 15_5 violations 2019-06-26 15:52:34 -07:00
Riccardo 52838e1c2a WIP 2019-06-26 14:47:06 -07:00
rbiasini 73ae4f6acf
Misra 14.4: The controlling expression of an if statement and the controlling expression of an iteration‑statement shall have essentially Boolean type (#225)
* Fixed 14.4 Misra violations
2019-06-26 13:13:16 -07:00
Riccardo 8a45958dfe Misra 17.7: puts function should have void output 2019-06-26 13:05:31 -07:00
Riccardo 97a11115bb hardwired input param is now a boolean 2019-06-26 12:18:06 -07:00
George Hotz fd96c02215 disable SPI on the EON variant 2019-06-26 12:01:57 -07:00
George Hotz 0e67890ac7
Merge pull request #224 from commaai/misra_13_3
Fixed Misra 13.3: A full expression containing an increment (++) or d…
2019-06-26 11:51:50 -07:00
Riccardo e41b5a4c4f Fixed Misra 13.3: A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator 2019-06-24 19:23:53 -07:00
Riccardo 541f8beee3 Fix bad bug 2019-06-24 19:16:53 -07:00
Riccardo 6a9ae3b7c3 The comma operator should not be used 2019-06-24 18:12:23 -07:00
Riccardo 5e3458df72 Fix Misra 20.7: Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses 2019-06-24 17:57:18 -07:00
Riccardo d1e6bd86b1 Fix Misra 16.6 and 16.7 by using a different COMPILE_TIME_ASSERT 2019-06-24 17:50:01 -07:00
Riccardo f03c3a9fb6 Fix Misra 8.11: When an array with external linkage is declared, its size should be explicitly specified 2019-06-24 17:10:14 -07:00
Riccardo 83eccb0b5c Fix obvious 10.1 Misra violations: Operands shall not be of an inappropriate essential type 2019-06-24 16:43:11 -07:00
rbiasini e2d781380a
Strict compiler (#222)
have no Wall warnings from the strict compiler and enforcing it in the regression test.
2019-06-24 10:25:30 -07:00
Riccardo 57217027e2 Toyota safety: block LTA message in TSS2 cars 2019-06-20 18:33:28 -07:00
Riccardo 2ef429e656 -pedantic is too much, let's fix wall first 2019-06-17 21:39:00 -07:00
Riccardo 198a4459cc MAX is now macro and cannot be used as function param 2019-06-17 18:48:38 -07:00
Riccardo 578ef22d52 Misra 12.1 violation in MIN/MAX macros 2019-06-17 18:39:17 -07:00
Riccardo 65fb5a48e7 Macro can trigger Misra violation due redef of var before their use 2019-06-17 15:29:04 -07:00
rbiasini 0a94643321
Misra 15 7 (#219)
* Fixed Misra 15_7 violations

* switch case for buttons
2019-06-17 14:13:50 -07:00
rbiasini a3f65d66e9
capitalize MIN and MAX macros (#220) 2019-06-17 13:48:14 -07:00
rbiasini bacfcd0fd0
Make macros to get msg attributes (#218)
* made GET_ADDR, GET_BUS and GET_LEN macros

* for simplicity, addr is int instead of uint32_t as it can only use up to 29 bits
2019-06-14 19:13:05 -07:00
George Hotz 00ebc16936 track can overflows 2019-06-14 13:33:30 -07:00
George Hotz d33bb4117c oops, have to call that now 2019-06-14 13:28:15 -07:00
George Hotz e0df5c81f6 pull in libc changes from harness branch 2019-06-14 13:26:27 -07:00
George Hotz 96dcfb18d4 pull in uart changes from harness branch 2019-06-14 13:26:01 -07:00
George Hotz 59eaec5dd6 add volatiles to the ring buffer pointers 2019-06-14 13:22:33 -07:00
George Hotz b35285ba7d can push failed only with debug 2019-06-14 13:19:30 -07:00
Riccardo 464f5c2b22 Tesla safety: reduced scope of vars 2019-06-14 12:30:59 -07:00
George Hotz f9d2e8876b can does not sleep 2019-06-14 12:14:21 -07:00
rbiasini 3601212ec5
Removed 10.1 violations (#217) 2019-06-14 12:08:59 -07:00
rbiasini c066c7838c
Misra 10.4 violations (#216) 2019-06-14 10:57:14 -07:00
rbiasini 78308c0bc5
All 14.4 violations are gone (#213) 2019-06-12 20:12:48 -07:00
Riccardo 0dc4f6fd30 cadillac safety: enforcing index not going outside array size 2019-06-12 20:07:42 -07:00
rbiasini 67b831ef45
Misra 15 5 (#210)
Remove 15.5 violations
2019-06-12 18:18:07 -07:00
rbiasini 57a6c493bb
Toyota gas pressed: reconcile panda code with openpilot (#212) 2019-06-12 17:51:47 -07:00
Riccardo 4c9e0af29e simplification of cadillac_get_torque_idx 2019-06-12 13:48:34 -07:00
Riccardo 2f71ba995a Tesla safety now using same line break rules as rest of the code 2019-06-12 13:10:51 -07:00
Riccardo 55679532aa Fix Misra 20.1 violations: Moved safety declarations in its own header and qdded optional input to run misra tests for safety code only. 2019-06-12 06:35:47 -07:00
Riccardo 0e251062c6 Fix Misra 10.8 violations: could not directly cast complex expressions from float to int 2019-06-11 21:46:10 -07:00
rbiasini 23461a176c
Misra 12 1 safety (#209)
* this gets rid of all 12.1 violations
2019-06-11 21:23:48 -07:00
Riccardo 242b3305fe Added fwd hook coverage test for Cadillac and created default_fwd_hook instead of nooutput and alloutput, which were teh same 2019-06-11 19:50:12 -07:00
Riccardo 264de67fe8 Minor clean up to Subaru fwd hook 2019-06-11 19:42:53 -07:00
Riccardo b4c52a1bda Cleaned up subaru FWD hook 2019-06-11 19:40:56 -07:00
Riccardo f4419b08b9 Simplify get_ts_elapsed 2019-06-11 02:07:02 -07:00
Riccardo fa1c928961 Fix Misra 13.4 on safety code 2019-06-11 01:10:45 -07:00
Riccardo 7372ade33e Fix Misra 15.6 on safety code 2019-06-11 01:07:41 -07:00
Riccardo a2d5c9b5f4 Fix Misra 17.8 on safety code 2019-06-11 00:58:22 -07:00
Riccardo b7ed7adc71 Fix Misra 20.7 on safety code 2019-06-11 00:49:26 -07:00
Willem Melching 50658b2b00 Use dfu-utils binary from panda repo on EON 2019-06-10 13:56:13 -07:00
Riccardo 1dfe11ed3a Set controls_allowed=0 in Chrysler safety init 2019-06-07 17:36:07 -07:00
Riccardo d77fa17913 deleted unnecessary subaru safety init and using nooutput_init instead 2019-06-07 15:11:28 -07:00
Riccardo 71099efaba AddedToyota safety test around long_controls_allowed logic and fixed a bug 2019-06-05 15:29:09 -07:00
rbiasini 380b7c75c5
Long allowed (#202)
* added long_controls_allowed to cars safety code. long_controls_allowed init to 1 for now, so safety tests pass
2019-06-05 14:00:07 -07:00
rbiasini 09714e3a44
Toyota gas cancellation (#200)
* cancel on pedal press for toyota.
2019-06-05 13:38:59 -07:00
Riccardo 436b203e0b Honda safety: fixed bug and properly abstracted gas_interceptor_detected variable 2019-06-04 13:36:46 -07:00
Riccardo 220cc8f4b5 Honda safety: this concludes the proper re-naming 2019-06-04 12:43:50 -07:00