summaryrefslogtreecommitdiff
path: root/board/hatch_fp
Commit message (Collapse)AuthorAgeFilesLines
* stm32: Enable rsa and rsa3 on-device unit testsYicheng Li2020-06-231-0/+2
| | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:155235321 TEST=make BOARD=nucleo-dartmonkey tests -j TEST=make BOARD=bloonchipper tests -j TEST=make BOARD=dartmonkey tests -j TEST=make BOARD=nucleo-f412zg tests -j TEST=make BOARD=nucleo-h743zi tests -j TEST=flash rsa unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa3 unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa unit test binary to nucleo-h743zi, run test => pass TEST=flash rsa3 unit test binary to nucleo-h743zi, run test => pass Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: I2ebcf6f322f9c16aba65a3a627a0a83ca00d2a02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2240516 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* stm32: Enable utils on-device unit test for fingerprint boardsYicheng Li2020-06-171-0/+1
| | | | | | | | | | | | | | | | BRANCH=none BUG=b:155230812, b:155235321 TEST=make -j BOARD={dartmonkey, bloonchipper, nucleo-dartmonkey, nucleo-f412zg, nucleo-h743zi} test-utils TEST=flash the utils test binary, then runtest on bloonchipper and nucleo-f412zg ==> Pass! Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: Ia45b494111f2a536876a5ca60fdc12c06f870e1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242356 Tested-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Bloonchipper: USART based transport layer for host commandBhanu Prakash Maiya2020-06-052-6/+51
| | | | | | | | | | | | | | | | | | | | 1. USART host command layer in chip/stm32 2. Fix usart implementation in stm32 BUG=b:147849609 BRANCH=none TEST=1. make BOARD=bloonchipper -j 2. usart request and response works on dragonclaw Change-Id: Idd89d3e490f23aa528ecaf6510c13d16b405de13 Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190531 Tested-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Auto-Submit: Bhanu Prakash Maiya <bhanumaiya@chromium.org>
* fpsensor: cleanup multiple fp spi enableBhanu Prakash Maiya2020-06-051-0/+4
| | | | | | | | | | | | | | BUG=b:147849609 BRANCH=none TEST=1. make buildall -j Change-Id: I35146070ec20a3605588792fc19595dc1c1ea3cf Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2191733 Tested-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Auto-Submit: Bhanu Prakash Maiya <bhanumaiya@chromium.org>
* test: Add test for flash write protectionTom Hughes2020-05-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test demonstrates the inconsistency between STM32H743 (dartmonkey) and STM32F412 (bloonchipper). BRANCH=none BUG=b:155897971 TEST=On bloonchipper after flashing flash_write_protect.bin test: * Enable HW WP: dut-control fw_wp_en:on * Reboot to RO: reboot ro * Enable flash protection: runtest 1 => PASS * Reboot to RO: reboot ro * Try to disable flash protection: runtest 2 => FAIL TEST=On dartmonkey after flashing flash_write_protect.bin test: * Enable HW WP: dut-control fw_wp_en:on * Reboot to RO: reboot ro * Enable flash protection: runtest 1 => PASS * Reboot to RO: reboot ro * Try to disable flash protection: runtest 2 => PASS Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I6eb69257f84f79a6609984efbdad7dd37803c8f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2209419 Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* test: Add flash_physical testTom Hughes2020-05-301-0/+1
| | | | | | | | | | | | | | | | | | | | | This test is intended to be used for testing the physical layer flash APIs. BRANCH=none BUG=b:155897971 TEST=On dragonclaw v0.2 with Segger J-Trace and servo micro connected: ./test/run_device_tests.py -t flash_physical => PASS TEST=On dragontalon with servo micro connected: > runtest => PASS Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ifd3c30da5f42ff84e77a7292cd2a7c88e8c594dd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2220734 Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* test: Add scratchpad testTom Hughes2020-05-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The first time the test runs it should pass. After rebooting, the test should then fail because the scratchpad register is already set. BRANCH=none BUG=b:157059753 TEST=Build and flash bloonchipper On console: > runtest => PASS > reboot > runtest => PASS, which is WRONG TEST=Build and flash dartmonkey On console: > runtest => PASS > reboot > runtest => FAILS, which is CORRECT Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I348d723d8083ecd0d9f5535785c8049f284a00b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2209189 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* test: Add on-device MPU unit testTom Hughes2020-05-221-0/+1
| | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:151105339, b:155229277 TEST=make BOARD=bloonchipper test-mpu -j && \ ./util/flash_jlink.py --board bloonchipper \ --image ./build/bloonchipper/mpu/mpu.bin => On console: "runtest" => All tests pass, except last which correctly panics: Data access violation, mfar = 20000000 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I1c759f50da5075b1e9027cdba253d8c06843be5a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2202852 Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* test: Add rollback entropy on-device unit testTom Hughes2020-05-141-0/+1
| | | | | | | | | | | | | | | | | | This unit test validates the behavior of adding entropy to rollback. BRANCH=none BUG=b:151105339 TEST=make BOARD=bloonchipper test-rollback_entropy -j && ./util/flash_jlink.py --board bloonchipper --image ./build/bloonchipper/rollback_entropy/rollback_entropy.bin Dragonclaw console: > reboot ro > runtest Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I0532104d483e3a8c16c2c3b9fd7fef8554eaadad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2197620
* test: Add rollback unit testTom Hughes2020-05-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test only runs on device and requires manual verification that a memory access violation occurred. Note that bloonchipper region 1 on dragonclaw fails as indicated in tests below. BRANCH=none BUG=b:155229277, b:151105339 TEST=Compile and flash bloonchipper on dragonclaw with region 0 "runtest" on console => Reboots with "Data access violation, mfar = 8020000" => PASS TEST=Compile and flash bloonchipper on dragonclaw with region 1 "runtest" on console => Memory is successfully read => FAIL TEST=Compile and flash dartmonkey on dragontalon with region 0 "runtest" on console => Reboots with "Data access violation, mfar = 80c0000" => PASS TEST=Compile and flash dartmonkey on dragontalon with region 1 "runtest" on console => Reboots with "Data access violation, mfar = 80e0000" => PASS Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I3e9cc568a0b16c6091d96c4373798fe4de4ab65b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190829 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
* Bloonchipper: Change console from uart1 to uart2Bhanu Prakash Maiya2020-05-062-8/+8
| | | | | | | | | | | | | | | | | | Bloonchipper uses both uart ports on STM32. Debug console should now work on uart2 which is connected to servo connector. BRANCH=none BUG=b:147849609 TEST=Access console on uart2. Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Change-Id: I26b7989051404224f9bf608ce02d35af2bb566f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2133589 Reviewed-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Tested-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Auto-Submit: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* bloonchipper: Enable pulldown on SPI masterCraig Hesling2020-05-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This enables the internal pulldown for the SPI master's CLK, MISO, and MOSI lines to the fingerprint sensor. The specific issue this is assumed to fix is the SPI CLK's idle state before signaling and idle state after signaling. This issue is hinted to in the STM32F412's reference manual by the following note: """ The idle state of SCK must correspond to the polarity selected in the SPIx_CR1 register (by pulling up SCK if CPOL=1 or pulling down SCK if CPOL=0). """ BRANCH=none BUG=b:151190204 TEST=Test sensor version, fpenroll, and fpmatch on dragonclaw dev board TEST=# On Dratini w/fingerprint # Test enroll and match time for i in {1..10000}; do out=$(ectool --name=cros_fp fpinfo | awk '/Fingerprint sensor/{print $7 " " $8}'); echo "Iter $i: '$out'"; if [[ "$out" != "model 21f" ]]; then echo "# FAIL !"; break; fi; done | tee ~/log.txt Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: If5c9ce9e4e0c565959c4768b19ac002175c71c8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2148012 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* test: Add on-device unit test for STM32 RTCTom Hughes2020-04-301-0/+1
| | | | | | | | | | | | BRANCH=none BUG=b:151105339 TEST=make BOARD=bloonchipper test-stm32f_rtc -j Flash stm32f_rtc.bin and "runtest" in the console Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I3debfd93b62cb269ad61af0e4ca7e195554b5548 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2171569 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* stm32: Enable more on-device unit testsTom Hughes2020-04-291-1/+9
| | | | | | | | | | | | | | | | | | | | | As part of the effort to run unit tests on device, we start by enabling a subset of the existing tests that compile and pass when run on device. BRANCH=none BUG=b:151105339 TEST=make BOARD=nucleo-dartmonkey tests -j TEST=make BOARD=bloonchipper tests -j TEST=make BOARD=dartmonkey tests -j TEST=make BOARD=nucleo-f412zg tests -j TEST=For each "test_name.bin" file created by above command -> flash to dragonclaw dev board -> "runtest" in the console Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ifbb3c1627c4da6b8aa27d2512530a879d54c86e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2172061 Commit-Queue: Yicheng Li <yichengli@chromium.org> Reviewed-by: Yicheng Li <yichengli@chromium.org>
* bloonchipper: Reorganize board.h into sectionsCraig Hesling2020-03-241-70/+117
| | | | | | | | | | | | | | This brings no functional change, as verified with compare_build.sh @ https://crrev.com/c/2093897/11. BRANCH=none BUG=none TEST=./util/compare_builds.sh -b hatch_fp Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I98cb9a8f3419b376051d23c64db11b2059d71aa3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2109246 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* bloonchipper: More clearly disable UART DMACraig Hesling2020-03-241-5/+5
| | | | | | | | | | | | | | | | | | Through some mental gymnastics, you can see that we don't use DMA for UART. Let's make the board.h more clearly show that we are disabling UART DMA. This brings no functional change, as verified with compare_build.sh @ https://crrev.com/c/2093897/11. BRANCH=none BUG=none TEST=./util/compare_builds.sh -b hatch_fp Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ia95cf7a7a8f2721041cce1283d2498d049412113 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2109245 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* stm32f412: Fix chip config Flash and RAM sizesCraig Hesling2020-03-241-5/+0
| | | | | | | | | | | | | | | | | | We are already using the stm32f446 config for many F4 based chips. Let's actually make this more clear and un-hack our hatch_fp board.h. This present no functional change. BRANCH=none BUG=none TEST=./util/compare_builds.sh -b "hatch_fp sweetberry" Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I6b46e696686ad740833dc889c1db5d7bac84a768 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2109244 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* nocturne_fp/hatch_fp: Make explicit fields in spi arrayCraig Hesling2020-02-261-1/+1
| | | | | | | | | | | | | | | This has no functional change, as verified with compare_build.sh. BRANCH=nocturne,hatch BUG=none TEST=./util/compare_build.sh --board nocturne_fp TEST=./util/compare_build.sh --board hatch_fp Change-Id: I4e58a65cd47fe136a471d2c16444d106e8431e5c Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2071149 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* stm32: Enlarge console task stack for testingYicheng Li2020-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | For on-device unit tests, we use the console to "runtest" and view results. A small console size would result in console stack overflow after the test finishes. Use a larger console stack if it's a test build. BRANCH=None BUG=b:146059307 TEST=make BOARD=nucleo-h743zi tests -j (Flash the build/nucleo-h743zi/test-aes.bin) (Connect to UART console) runtest (Repeat for test-sha256.bin and test-sha256_unrolled.bin) Change-Id: I5c48ae10f5808ed2d3854fdc72275a3a416cf76d Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2006709 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* hatch_fp/nocturne_fp: Specify RSA_KEY_SIZE in RW and ROTom Hughes2020-01-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The rsa.h header can be included by any file, regardless of whether CONFIG_RSA is enabled. In that case we still want RSA_KEY_SIZE and CONFIG_RSA_EXPONENT_3 to be correct for the board. The following boards already set CONFIG_RSA_KEY_SIZE outside of RO/RW * kalista * endeavour * fizz * puff BRANCH=none BUG=b:144958737 TEST=make buildall -j TEST=diff build/<hatch_fp,nocturne_fp,hammeri,nucleo-h743zi>/ec.bin with and without the change => same Change-Id: I7e565e25b06b0d36e28ae32934b1f65b382e5b66 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1999606 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* hatch_fp: Better comments for pin configCraig Hesling2020-01-101-3/+3
| | | | | | | | | | | BRANCH=nocturne,hatch BUG=none TEST=none Change-Id: I1b1e994d7e8e74c298f2452b7eaf1a567d387dc0 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991997 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* bloonchipper: Add transport and sensor detectionTom Hughes2020-01-082-1/+51
| | | | | | | | | | | | | | | | | | | | | | | bloonchipper (aka hatch_fp aka dragonclaw) has a voltage divider that can be used to select the sensor and the transport type. Supported designs: * Dragonclaw rev 0.2 (green with Google logo): go/dragonclaw-schematic-rev-0.2 * Hatch reference v3.0: go/hatch-schematic-rev-3.0 The selection lines are connected to ADC inputs, so a future change will use the ADC to allow more than two transports or sensors. BRANCH=none BUG=b:147113851 TEST=flash dragonclaw rev 0.2 and view console output Change-Id: If2e4b150d34cfe41477be528c70e1645043d4d82 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1986322 Reviewed-by: Craig Hesling <hesling@chromium.org>
* bloonchipper: Update GPIOs for Hatch 3.0 designTom Hughes2020-01-031-7/+9
| | | | | | | | | | | | | | | Based on the following schematics: https://ee-schematics.teams.x20web.corp.google.com/hatch/hatch_p0/hatch_p0_499d1e339869c92d67ea9077ba35b66a6c103e1c.html BRANCH=none BUG=b:145847137 TEST=none Change-Id: I29c5ec5abb9bdf7650c5a1eb190309c6ea85bfce Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1972376 Commit-Queue: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* hatch_fp: Move SLP_S0_L for Hatch Rev 2.8Craig Hesling2019-11-081-2/+2
| | | | | | | | | | | | | | | | | | | | | Previous schematic was Hatch Rev 2.6 (commit e36c8b3683475b853c21564ddabc3ec90ee64f75 in hatch ee-git): http://go/hatch-schematic-rev-2.6 New schematic is Hatch Rev 2.8 (commit defe790e8d1c863de2ec04ee50f285e270038848 in hatch ee-git): http://go/hatch-schematic-rev-2.8 BRANCH=none BUG=b:144004439 TEST=make buildall -j Change-Id: Ia40c4149f9c9d68c39e8235fec9a949347ed9c27 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904652 Tested-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Craig Hesling <hesling@chromium.org>
* hatch_fp: Switch to UNUSED pins mechanismCraig Hesling2019-11-081-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL enables UNUSED pins for hatch_fp. This places the unused/unconnected pins in the lowest power state. Using the UNUSED pins mechanism should be functionally equivalent to the previous method of declaring these pins as analog inputs. See crrev.com/c/1894242 for implementation details. BRANCH=nocturne,hatch BUG=b:130561737 TEST=make buildall -j TEST=make BOARD=bloonchipper # Connect dragonclaw dev board over servo micro sudo servod --board=bloonchipper --config bloonchipper_rev0.1.xml & ./util/flash_ec --board=bloonchipper minicom -D $(dut-control raw_fpmcu_uart_pty | cut -d: -f2) > sysinfo # Check that we are in RW Change-Id: I412118287893ec63cef42c6c190d0a4755de06cb Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1900122 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* nocturne_fp/hatch_fp: Document alternate namesTom Hughes2019-11-061-1/+8
| | | | | | | | | | | | | | | There are many variations of "board" names for the FPMCU, but they all refer to one of two hardware configurations. BRANCH=none BUG=none TEST=make buildall -j Change-Id: I5c57fab1976f2aea395d8319c4f9c52f8134129a Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1894454 Reviewed-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* hatch_fp/nocturne_fp: Disable CONFIG_SYSTEM_UNLOCKED by defaultTom Hughes2019-11-061-1/+1
| | | | | | | | | | | | | | | | The release branch disables CONFIG_SYSTEM_UNLOCKED, but to prevent confusion (and potential mistakes), we will just always disable CONFIG_SYSTEM_UNLOCKED since the write protection scheme for fingerprint is final. BRANCH=none BUG=b:130249462,b:73337313 TEST=make buildall -j Change-Id: I072a5e037d80fbde39a5b695da7b2bd6de64e04c Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1895605 Reviewed-by: Yicheng Li <yichengli@chromium.org>
* hatch_fp: Configure unused GPIO pins.Ravi Chandra Sadineni2019-10-311-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | By default, STM32F4 pins are configured as inputs, except some JTAG pins which can impact the power consumption of the device in different power modes because pins are very sensitive to external noise in input mode I/O. To avoid extra I/O current, all pins should be configured as analog input (AIN); in this mode the Schmitt trigger input is disabled, providing zero consumption for each I/O pin. For more info please look at "USING STM32F4 MCU POWER MODES WITH BEST DYNAMIC EFFICIENCY"("AN4365") section 1.2.6 and STM32F412 reference manual section 7.3.12. BUG=b:130561737 BRANCH=None TEST=Flash bloonchipper and measure power before and after. fpenroll and fpmatch works fine. Change-Id: I85d76589be22b892c81680763cfb263746004a80 Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1883127 Reviewed-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fingerprint: Restrict md and rw console commandsCraig Hesling2019-10-232-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL ultimately restricts access to the md and rw console commands when the system is locked, when system_is_locked(). It does this by enabling and configuring the restricted console command feature for nocturne_fp and hatch_fp. This sets up the framework for more console commands to use the restricted flag for fingerprint, but right now, only the md and rw commands use the restricted console command flag. The restricted flag for md and rw was introduced in crrev.com/c/1868430. BRANCH=nocturne BRANCH=hatch BUG=b:142559996, b:142505927 TEST=# Test on nocturne_fp make BOARD=nocturne_fp scp build/nocturne_fp/ec.bin dut1:~/ ssh dut1 flash_fp_mcu ./ec.bin # From FPMCU UART console version # Ensure that version is custom based on workstation help # Ensure that md and rw are not prefixed with "-" help list # Ensure that a "Flags" column exists and that # md and rw both have a 1 in the column. md 0x0 # Ensure that this successfully reads the word rw 0x24000000 # Ensure that this successfully reads the word syslock md 0x0 # Ensure that this fails with "Access Denied" rw 0x24000000 # Ensure that this fails with "Access Denied" help # Ensure that md and rw are now prefixed with "-" Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I1202a118b836ff2a2acc986f6f3b0f6e07b36894 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1867388 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* rollback: Clear temporary copies of rollback secret.Yicheng Li2019-09-051-2/+0
| | | | | | | | | | | | | | | | | After working with temporary copies of rollback secret, clear them using always_memset() in third_party/cryptoc/util.c. For boards that have CONFIG_ROLLBACK_SECRET_SIZE, configure CONFIG_LIBCRYPTOC automatically. BRANCH=nocturne BUG=chromium:968809,chromium:989594,b:130238794 TEST=make -j buildall TEST=tested fingerprint enrollment and matching on nocturne DUT, which uses rollback_get_secret(). Change-Id: I44fb5ef7d43c080e4d33c8d9a7d9298e194e1cf3 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731544 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* common: Add CONFIG_LIBCRYPTOC to enable third_party/cryptocYicheng Li2019-08-231-1/+1
| | | | | | | | | | | | | | | | | | | Boards that have CONFIG_LIBCRYPTOC will be able to use functions in third_party/cryptoc. Functions in third_party/cryptoc that are not called will not be linked because of linker optimization. This can be verified by checking the "smap" file in the build directory for a given target (e.g. build/nocturne_fp/RW/ec.RW.smap), which contains a list of all symbols in the target. Configure CONFIG_LIBCRYPTOC in nocturne_fp and hatch_fp. This config replaces CONFIG_ALWAYS_MEMSET. BRANCH=nocturne BUG=chromium:968809,chromium:989594,b:130238794 TEST=make -j buildall Change-Id: Ia40da9fb429f9d03623bc92e25f6670e5cdbd983 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1764835 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* common: Prepare always_memset()stabilize-kernelnext-broadwell-12434.BYicheng Li2019-08-171-0/+2
| | | | | | | | | | | | | | Add a config for using always_memset() from third_party/cryptoc BRANCH=nocturne BUG=chromium:968809,chromium:989594,b:130238794 TEST=make -j buildall Change-Id: I22c83512eb1b8bdc8dac1b26315d25b65831513c Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731543 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* util: Unify separate flash_fp_mcu scripts into single common oneTom Hughes2019-07-231-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | | For fingerprint firmware we are moving towards a model where the "board" (in EC terminology) is a specific MCU+FP_SENSOR combination and not tied to the main system board that it's connected to (e.g., "hatch", "nocturne", etc.). This change decouples flash_fp_mcu from the EC "board". BRANCH=none BUG=b:136678758,b:137108509 TEST=make buildall -j hatch: flash_fp_mcu /opt/google/biod/fw/hatch_fp_v2.0.1359-6f54be08d.bin nocturne: flash_fp_mcu /opt/google/biod/fw/nocturne_fp_v2.0.1765+87bb17a39.bin nami: flash_fp_mcu /opt/google/biod/fw/nami_fp_v2.2.144-7a08e07eb.bin Cq-Depend:chromium:1705055 Change-Id: Idfe298f59ab9df8657a570cc47e956b4e94ee1a1 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1704808 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* hatch_fp: Add RDP (read protection) support to STM32F4Tom Hughes2019-07-241-1/+1
| | | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:125419658 TEST=Remove "-U" flag in STM32MON_READ_FLAGS in flash_fp_mcu_common.sh flash_fp_mcu -r foo.bin => success hexdump foo.bin => valid data ectool --name=cros_fp flashprotect enable ectool --name=cros_fp reboot_ec flash_fp_mcu -r foo.bin => fails Add "-U" flag back to STM32MON_READ_FLAGS in flash_fp_mcu_common.sh flash_fp_mcu -r foo.bin => success hexdump foo.bin => all 0xFF Change-Id: Ic3ec18262e653b72baf239caa8db12186a63613c Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1692220 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* hatch_fp: enable fp_sensor taskTom Hughes2019-07-032-3/+2
| | | | | | | | | | | BRANCH=none BUG=b:124996507 TEST=fpcapture/fpsensor/fpenroll from the console work Change-Id: I6f481ed6b5185585aa01506e292b6b31e202a3b7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1558938 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* hatch_fp: Enable rollbackTom Hughes2019-07-031-4/+1
| | | | | | | | | | | BRANCH=none BUG=b:124996507 TEST=make buildall -j Change-Id: I49f87cb9f6a6551f83f91d55242f2c5c250e8b83 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1681378 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* ec.tasklist: Consolidate duplicate commentsTom Hughes2019-06-191-11/+1
| | | | | | | | | | | | | | Same as https://crrev.com/c/1551579, but clean up some files with the old comments that have been added since that change. BRANCH=none BUG=none TEST=make buildall -j Change-Id: I4bc7fdc7cb128c48545ea681ab1381610d54fb6d Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1664604 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Add OWNERS files for fingerprintTom Hughes2019-06-051-0/+1
| | | | | | | | | | | | BRANCH=none BUG=chromium:967924 TEST=none Change-Id: Ief50a64d45cc6862fab3417e3f8350d3c581209e Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633909 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* flash_fp_mcu: use modalias to detect FP spiidTom Hughes2019-04-261-3/+0
| | | | | | | | | | | | | | | | | | During bringup there was a point where the spiid for the fingerprint sensor changed between devices (apparently due to broken TPM firmware since the TPM is usually the first SPI device)). This resulted in non-obvious failures when running flash_fp_mcu since many other things were also not working. BRANCH=none BUG=chromium:955117 TEST=emerge-nocturne ec-utils-test && cros deploy nocturne ec-utils-test flash_fp_mcu /opt/google/biod/fw/nocturne_fp_v2.2.110-b936c0a3c.bin Change-Id: I9161361e2c66de200f618c00074eeb42a9ecb29b Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1566653 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* hatch_fp: fix memory mapping of FP buffersNicolas Norvez2019-04-191-3/+7
| | | | | | | | | | | | | | | On STM32F412 the buffers are located in the regular SRAM, don't define a special section. BRANCH=None BUG=b:124773209 BUG=b:124996507 TEST=fpenroll+fpmatch Change-Id: I8659e4587973c4e30c891084691b28326346e1d7 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1574658 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* hatch_fp: Fix slave select (NSS / CS) pin managementTom Hughes2019-04-111-2/+7
| | | | | | | | | | | BRANCH=none BUG=b:124996507 TEST=Read HWID from fingerprint sensor (slave) on hatch_fp Change-Id: I344d7e4a5afec1f7c23f45aca593159ba67e89ed Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1558937 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* hatch_fp: add flash_fp_mcu scriptNicolas Norvez2019-04-031-0/+35
| | | | | | | | | | | | | | | | Set the correct GPIOs, SPI dev and ID for Hatch. Keep the GPIO_PWREN variable empty since there is not such GPIO on Hatch, power is always on for the FPMCU BRANCH=None BUG=b:124405913 BUG=b:126455006 TEST=flash_fp_mcu on hatch doesn't bail Change-Id: I544868bc088d3aeb0896b8123bfc83c1ea0a156c Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1532345 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* hatch_fp: initial uploadNicolas Norvez2019-04-036-0/+376
First draft, lots of features still missing. Dev key generated with this command: openssl genrsa -3 -out board/hatch_fp/dev_key.pem 3072 BRANCH=none BUG=b:124996507 TEST=make BOARD=hatch_fp Change-Id: I7d7f0ce6807f7db9ee67e2e9b72ba6b2a0b87591 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1482059 Reviewed-by: Tom Hughes <tomhughes@chromium.org>