summaryrefslogtreecommitdiff
path: root/util/ecst.c
Commit message (Collapse)AuthorAgeFilesLines
* ec: add support for npcx9m8sDavid Cross2023-04-261-1/+4
| | | | | | | | | | | BUG=none TEST=`make BOARD=helipilot` BRANCH=none Signed-off-by: David Cross <davidmcross@google.com> Change-Id: Ib6e0ccc2eac31f47326e27459c9ee8c32585a7ec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4007183 Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: CH Lin <chlin56@nuvoton.com>
* tree: Replace "unsigned" with "unsigned int"Andrea Grandi2023-01-041-1/+1
| | | | | | | | | | | | | | | | | Fix checkpatch error: > Prefer 'unsigned int' to bare use of 'unsigned' BUG=b:262047616 TEST=./util/compare_build.sh -b all -j 120 => MATCH BRANCH=none Change-Id: Ibf82332a1e1ea0a0a03d3993336e24883e495e05 Signed-off-by: Andrea Grandi <agrandi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4126483 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util/ecst.c: Format with clang-formatJack Rosenthal2022-07-011-530/+344
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I97fe88b23c3fbc314b39c8b9e94c3e2f8047c613 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730616 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* tree: Files should end with single newlineTom Hughes2021-10-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes all files by running the following: for f in $(find . -name '*.[ch]'); do printf '%s\n' "$(cat ${f})" > ${f}; done BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia3ece5b64b549d21ca11708791368002bb6e9b0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229797 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* util: ecst: add support for chip variant npcx9Wealian Liao2020-09-091-2/+8
| | | | | | | | | | | | | | | | | | | | Allow ecst tool to compose the correct firmware header for npcx993f & npcx996f. BRANCH=none BUG=b:165777478 TEST=pass "make buildall" TEST=with the related CLs, change CHIP_VARIANT to npcx996f in board/npcx9_evb/build.mk; "BOARD=npcx9_evb make"; check the image can be built and the image header is correct. Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Signed-off-by: CHLin <CHLin56@nuvoton.com> Change-Id: Ia48b19854850a642a2f4ed97ca45230f46fbd65c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393403 Reviewed-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: caveh jalali <caveh@chromium.org>
* util: ecst: add support for chip variant npcx7m7fcCHLin2020-08-181-109/+69
| | | | | | | | | | | | | | | | | | | | Allow ecst tool to compose the correct firmware header for npcx7m7fc. BRANCH:none BUG=b:163910671 TEST=pass "make buildall" TEST=with the related CLs, change CHIP_VARIANT to npcx7m7fc in board/npcx7_evb/build.mk; "BOARD=npcx7_evb make"; check the image can be built and the image header is correct. Signed-off-by: CHLin <CHLin56@nuvoton.com> Change-Id: If1eb6bc34e53c1ddd9e8f049414dc1e307e6d2c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2355155 Tested-by: CH Lin <chlin56@nuvoton.com> Tested-by: Keith Short <keithshort@chromium.org> Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com>
* util/ecst: Make sure that copying back arguments doesn't exceed MAX_ARGSPatrick Georgi2020-06-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Newer gcc than we have in CrOS shows a non-helpful error message: util/ecst.c: In function 'main': util/ecst.c:398:7: error: 'strncpy' output may be truncated copying 100 bytes from a string of length 9999 [-Werror=stringop-truncation] 398 | strncpy(hdr_args[arg_ind++], | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | tmp_hdr_args[tmp_ind], | ~~~~~~~~~~~~~~~~~~~~~~ 400 | ARG_SIZE); | ~~~~~~~~~ In the end it's about gcc not being able to ensure that hdr_args[] doesn't overflow. BUG=none BRANCH=none TEST=gcc 9.3 as shipped with debian sid compiles ecst without error Change-Id: I2c30cdfaac0305ea4e4c19477469bcf497469caa Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2273240 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst: Fix sign issues for file sizePatrick Georgi2019-09-121-2/+2
| | | | | | | | | | | | | | | | | | Since we'll never have to deal with 2GB+ sized images, don't bother with larger data types. Found by Coverity Scan #203948 BUG=none BRANCH=none TEST=none Change-Id: I95cb75d693b94444a87d2100a3f25ddae87a5faa Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1801207 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst.c: Improve return values in calc_header_crc_binPatrick Georgi2019-09-121-3/+3
| | | | | | | | | | | | | | | | Ensure consistency in types (TRUE/FALSE) and document the outcome in the function header. BUG=none BRANCH=none TEST=none Change-Id: Ie3786f5de6f1a93813afd4a88be2994b690886c6 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1793587 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst.c: Catch errors in remaining fseek callsPatrick Georgi2019-09-121-3/+7
| | | | | | | | | | | | | | | | | | There's little reason why fseek should fail, but when it does, we're not looking where we think we look. Found by Coverity Scan #58144 BUG=none BRANCH=none TEST=none Change-Id: I7a784cb96def611ae5802d530882eb14daf58ce1 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1793585 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst: check fseek/ftell return valuesPatrick Georgi2019-09-071-26/+35
| | | | | | | | | | | | | | | | | | | | Found by Coverity Scan #5814[14-9], #58159, #58160 Also fix a bunch of typos in comments and variable names and remove extraneous fseek(..., 0, SEEK_SET) before moving to the actual offset (again with SEEK_SET). BUG=none BRANCH=none TEST=none Change-Id: I9d7cb950a7a659c5abb1ff7d6d2c48d623ee515c Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1789145 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst.c: ensure string terminationPatrick Georgi2019-09-071-5/+9
| | | | | | | | | | | | | | | | Found by Coverity Scan #58136, #58137 BUG=none BRANCH=none TEST=none Change-Id: Ie17330c4766f6537134117ecd81ecd78cd408132 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1789144 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util: ecst: Fix Coverity print format warningsEvan Green2019-07-161-13/+7
| | | | | | | | | | | | | | | | | | | | | | | I noticed Coverity is complaining about a handful of printf format warnings. These were all valid. It looks like a robot, or perhaps a very hasty human went through and split printf strings that extended over 80 columns into multiple calls. But they didn't make sure that the arguments went into the correct corresponding printf call. Recombine a few of those printfs back into a single call, and fix a few other printf-related odds and ends. Also, add the format specifier to my_printf so that these errors are detected at compile time in the future. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Change-Id: I27b352b97d50fbbaee2fb801b817ef82ad90ca98 Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1698488
* util: Source files should not be executableTom Hughes2019-06-191-0/+0
| | | | | | | | | | | | | | | | | | | | | | "repo upload" warned me about this file when making another change: These files should not be executable. Please `chmod -x` them. * util/ecst.h Other file found with: find . -name '*.[ch]' -executable BRANCH=none BUG=none TEST=make buildall -j Change-Id: I3acc3c22a302f3f5dfd2ae00d2b65da15b7813d7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1665211 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* util:ecst: add the support of CHIP_VARIANT npcx7m7wc for NPCX7CHLin2019-04-031-3/+5
| | | | | | | | | | | | | | | | | | This CL adds the support for chip variant npcx7m7wc in the ecst utility. BRANCH:none BUG=none TEST=pass "make buildall" TEST=in the follow CL, change CHIP_VARIANT to npcx7m7wc in board/npcx7_evb/build.mk; build the image by "BOARD=npcx7_evb make"; check the image can be built and the image header is correct. Change-Id: I6031a6f188f06e31ca7ce0571065b11ee68b27ab Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1543061 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* util:ecst: add the CHIP_VARIANT npcx7m6fc support for NPCX7CHLin2018-11-181-1/+3
| | | | | | | | | | | | | | | | | | | This CL adds the support for chip variant npcx7m6fc in the ecst utility. BRANCH:none BUG=none TEST=No build errors for make buildall. TEST=Change CHIP_VARIANT to npcx7m6fc in board/npcx7_evb/build.mk; "BOARD=npcx7_evb make"; Check ec image can be built and image header is correct. Change-Id: I138b19e21c361a42c2e613f6066957aabea17c0d Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1335293 Commit-Ready: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* util/ecst: Fail on partial readsPatrick Georgi2018-08-151-6/+6
| | | | | | | | | | Change-Id: Iadc031195773f7f1eac6642de6995659eab42707 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #58140, #58142, #58143 Reviewed-on: https://chromium-review.googlesource.com/1151187 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
* util/ecst: Also report copy failure on writesPatrick Georgi2018-08-151-2/+8
| | | | | | | | | | Change-Id: Ie01daa75b22fd1efca1c72d34c42c18abea53c2e Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #58172 Reviewed-on: https://chromium-review.googlesource.com/1163610 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
* util/ecst.c: Fix resource leakPatrick Georgi2018-07-301-1/+3
| | | | | | | | | | Change-Id: I3397dcaf90c8141efee170183a6e54e8430924f9 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #58168 Reviewed-on: https://chromium-review.googlesource.com/1151124 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/ecst: refactor path manglingPatrick Georgi2018-05-181-47/+53
| | | | | | | | | | | | | | | | | ecst has two open-coded implementations of a function to inject a string into another string (that happens to be a path). Factor out and make sure that gcc 8.1's static analysis of string lengths is happy. BUG=b:65441143 BRANCH=none TEST=builds with gcc 8.1 Change-Id: I80581d26b6f75cac2c9530c18f94d12614aa1586 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1061878 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
* npcx: change chip variants of npcx7 series for better clarification.Mulin Chao2018-04-271-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this CL, we changed chip variants npcx7m6xb to npcx7m6fb and npcx7m7w to npcx7m7wb for better clafiication since it introduced new parameter "b" for chip generation in the same family series. In new npcx7 series naming rule, it follows: Format: NPCX7(M)(N)(G/K/F)(B/C) param M: 8: 128-pins package, 9: 144-pins package param N: 5: 128KB RAM Size, 6: 256KB RAM Size, 7: 384KB RAM Size param G/K/F/W: Google EC depends on specific features. param B/C: Chip generation in npcx7. (Generation A is ignored. It follows nameing rule in npcx5.) The all chip variants of npcx7 used in boards are also listed below: npcx7m6g - for npcx7 ec without internal flash on npcx_evb. npcx7m6f - for npcx7 ec with internal flash. npcx7m6fb - for npcx7 ec with internal flash, enhanced features. npcx7m7wb - for npcx7 ec with internal flash, enhanced features + WOV. BRANCH=none BUG=none TEST=No build errors for npcx7 series. Change-Id: I896ee33209efa5d7157c90515005db5f36318c76 Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1025471 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* util: ecst: Add 2 CHIP_VARIANTs to support npcx7m6xb/npcx7m7wCHLin2018-01-091-117/+115
| | | | | | | | | | | | | | | | | | | | This CL adds support for chip variant npcx7m6xb and npcx7m7w in the ecst utility. It also fixed the coding style by replacing some inapproiate tab characters with white space characters. BRANCH=none BUG=none TEST=No build errors for make buildall. TEST=Change CHIP_VARIANT to npcx7m7w/npcx7m6xb in board/npcx7_evb/build.mk; "BOARD=npcx7_evb make"; Check ec image can be built and image header is correct. Change-Id: I44bae48dcb4fa3bc8984184d8f43744e54bcf8e7 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/851935 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* util: ecst: Add support for chip variant npcx7m6gCHLin2017-07-151-6/+9
| | | | | | | | | | | | | | | | | This CL adds support for chip variant npcx7m6g in ecst utility. BRANCH=none BUG=none TEST=No build errors for make buildall. Build npcx7_evb board and upload firmware on EVB. No symptom found. Change-Id: I156e0a8f183397ad713c7134b3a0ad5fe78b0d83 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/567942 Commit-Ready: Jun Lin <riverq@gmail.com> Tested-by: Jun Lin <riverq@gmail.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
* util: ecst: Add support for npcx7 series.Mulin Chao2017-04-181-62/+216
| | | | | | | | | | | | | | | | | | | | | ecst adds the support for npcx7 series in this CL. (The name of npcx7m6f is fixed. The others are TBD.) It also includes: 1. Fix few typos and replace tab with spaces in ecst.h for better alignment. 2. Add -spiclkratio parameter for the ratio between core and spi flash clock in npcx7. (default ratio is 1.) 3. Add -unlimburst parameter for burst mode of spi flash accesses. (default is disable) BRANCH=none BUG=none TEST=No build errors for npcx7 and npcx5 series. Build poppy board with ecst 1.0.3 and upload FW to platfomr. No sympton found. Change-Id: I004edc068c6496390e03d8ee5e39e4f23e4b835f Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/476413 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* util/ecst: Fix misspelling in #definesMartin Roth2016-11-151-3/+3
| | | | | | | | | | | | | | This should be 'default' BUG=None BRANCH=None TEST=make buildall passes Change-Id: I58a960ed48f8ea42529682cef4d99c98ac1aa2dc Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403419 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
* ecst: Print errors to stderr.Aseda Aboagye2015-09-181-2/+5
| | | | | | | | | | | | | | | | | | This commit makes all prints with the TERR error level print to standard error so that it's more obvious what's wrong when an error occurs. BUG=None BRANCH=None TEST=Checkout tree @ 5dfe8d2. Build npcx_evb and see that the error is displayed during the build process. TEST=make buildall tests Change-Id: I4117dd83a9a85ae81baf533302b0b70f4da174bc Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/300613 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* nuc:Ian Chao2015-07-251-0/+2335
Add ECST tool to modify the header used by npcx booter. Modified drivers: 1. i2c.c: Modify for i2c_port design. 2. i2c.c: Fixed bugs when mutil-tasks use the same i2c port and pull-up issue. 3. hwtimer.c: Fixed bug whcih event expired time is behide current timer. 4. lpc.c: Add intializing host settings after pltrst is deasserted. 5. uart.c/clock.c/register.h: Fixed bug which cannot enter deep-idle when gpio is any-edge trigger mode. 6. task.c: Add workaround method for hard fault issue. 7. keyboard_raw.c: Modified for support CONFIG_KEYBOARD_KSO_BASE 8. lpc.c: Modified for support CONFIG_KEYBOARD_IRQ_GPIO 9. lpc.c: fixed obe interrupt bug during 8042 initialization 10.Adjust path of flat files for new Makefile rules 11.Fixed build error on lpc.c without CONFIG_KEYBOARD_IRQ_GPIO BUG=chrome-os-partner:34346 TEST=make buildall -j; test nuvoton IC specific drivers BRANCH=none Change-Id: Icf9494174b245b4026e396be877d578f36b6f6a5 Signed-off-by: Ian Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/284036 Reviewed-by: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org>