summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/console.c
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-051-353/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* zephyr: console: Use DT bindings to get shell uart dev on 2.7+Jack Rosenthal2021-09-071-24/+15
| | | | | | | | | | | | | | | | | | | In Zephyr 2.7+, CONFIG_UART_SHELL_ON_DEV_NAME is removed in favor of using the zephyr,shell-uart device chosen by the UART driver. Since we choose zephyr,shell-uart on all of our boards, we are clear to make this change ahead of the v2.7 uprev. Also see https://github.com/zephyrproject-rtos/zephyr/pull/37902. BUG=b:198824039 BRANCH=none TEST=zmake testall TEST=compile posix-ec with v2.7_rc1 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ic066ce0617fa900ae7c1c96a2cbece0b698764bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3142750 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Disable console help stringsKeith Short2021-08-181-1/+8
| | | | | | | | | | | | | | | | | | Add support for disabling the console command help strings. With CONFIG_SHELL_HELP=n, 2000 bytes saved on Volteer BUG=none BRANCH=none TEST=zmake testall TEST=Verify console on Volteer with and without CONFIG_SHELL_HELP enabled. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2186828f28691182f673851ac27d207b4a4a6f44 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093492 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: reduce code duplication of console shimKeith Short2021-08-181-12/+9
| | | | | | | | | | | | | | | | | | Change the console command shim to pass in a struct, reducing the amount of duplicated code. This change saves 500 bytes on Volteer BUG=none BRANCH=none TEST=zmake testall TEST=verify console on Volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2da374b9a3b3b78a3e7b66d5c31f4ed2131aef01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093491 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim: cleanup comments and code in console.cDenis Brockus2021-08-121-5/+8
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=none Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iab1f8a1274e94491590697ad1efffdca46cb8e4c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088235 Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim: zephyr_print option to use printkDenis Brockus2021-08-111-1/+9
| | | | | | | | | | | | | | | | | | | | Some devices are not able to output fast enough using shell_fprintf and they timeout unrelated functionality. For this case it will be allowed to use a define CONFIG_PLATFORM_EC_CONSOLE_USES_PRINTK to force zephyr_print to use printk BUG=b:193585176 BRANCH=none TEST=zmake configure -b $PROJ_HAYATO Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I8a08fc730637e1d9e2b612b877572fac235a4be4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3082328 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: fix uart output flushDawid Niedzwiecki2021-07-151-0/+6
| | | | | | | | | | | | | | | | | | | Make sure the whole UART buffer/fifo is flushed in the uart_flush_output function by checking the interrupt state. The shell_process function only passes data from shell layer to the shell_trasport layer(UART) which has its own buffers. The bug was impacting e.g. hibernating. BUG=b:191724484, b:193482737 BRANCH=none TEST=Verify the console output and hibernate works Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Iaf245809be57fdba69c6a5a69d394f024ccf60ae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3024264 Reviewed-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: switch to using shell_*, not printkDawid Niedzwiecki2021-07-091-10/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reimplement the printf functions for Zephyr to use shell_* functions instead of printk. The main differences are: -UART output is buffered by the shell layer. The size of the buffer should be adjusted per board (SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE) -The shell uses non-blocking UART FIFO operations while printk waits actively for every sent byte. -The shell prints can not be split by the other shell prints so it should increase the quality of the output. However the shell_* functions can not be used in interrupts, so use printk instead which can divide the shell output. The output may be messy for boards that have a lot of prints in interrupts e.g. volteer. EC uses unusual print format e.g. "%pT" to print a timestamp, so use the CrosEC's vfnprintf function and then pass the generated string to the shell_* print. Use the sprintf function for that purpose. Long term, the EC codebase should switch to a usual print format, so shell_* can be used directly and not 2 versions of vfnprintf. This change should also help to pass tests that wait for a certain pattern on output e.g. ECBootTime. BUG=b:191724484, b:178033156 BRANCH=none TEST=Verify the console output works Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ifaed2093ab8c43038c7d3e0ded1449a93f7f7da5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2988194 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: change host console shim interfaceDawid Niedzwiecki2021-07-021-1/+1
| | | | | | | | | | | | | | | | | | | Allow passing a whole string to the console buffer, which is sent to host. This should speed up printing because a mutex doesn't have to be locked for every char separately. BUG=b:191724484 BRANCH=none TEST=Make sure buffering of console to host works with the 'ectool console' command Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I5b081984bfa4f930ad4729b19975b1c2eb4bbd18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2988193 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add CONFIG_PLATFORM_EC_CONSOLE_CHANNELKeith Short2021-06-091-2/+2
| | | | | | | | | | | | | | | | | Add a KConfig option to enable/disable the CONFIG_CONSOLE_CHANNEL option. Enabled by default, but can be turned off to save code space. BUG=b:180421120 BRANCH=none TEST=zmake testall TEST=Boot lazor, verify 'chan' command is present or not based on this config. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9f5f10582ef6161a38bb2f5f7f48bae631ba9cf6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2946964 Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: use interrupt based RX bufferingYuval Peress2021-04-151-27/+129
| | | | | | | | | | | | | | | | | | | | Poll-based RX was technically incorrect since Zephyr was setting up the UART to FIFO mode (instead of byte mode). This change replaces polling the RX UART with interrupt based callbacks. When calling uart_shell_stop(), the ISR will be replaced and will instead queue items to a ring buffer which can be read from uart_getc() (it can also be cleared via the uart_clear_input() function). BRANCH=none BUG=b:181352041 TEST=Build volteer, run, see expected 0xec07 from the GSC. Cq-Depend: chromium:2730870, chromium:2730869 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I5d2b61e914b56f678a259b373969522da87e8df3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2728824 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: console: add missing include for shell_uart.hFabio Baltieri2021-03-021-0/+1
| | | | | | | | | | | | | | | | Fixes few compiler warnings: /mnt/host/source/src/platform/ec/zephyr/shim/src/console.c:40:13: warning: implicit declaration of function 'shell_backend_uart_get_ptr'; did you mean 'log_backend_count_get'? [-Wimplicit-function-declaration] (and others) BUG=none BRANCH=none TEST=zmake -lDEBUG configure... no warnings Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I1bb9b9a691559f93ea8530d530f00e5348e92cec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2729047 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: console: add functions to enable/disable the shellYuval Peress2021-02-261-0/+25
| | | | | | | | | | | | | | | | | | | | | Adds functions that will allow us to temporarily take over the uart from the shell. Note that for platform/ec code without Zephyr, these functions are stubs so they are safe to call from common code, though we'll most likely need other logic (such as turning off the console task). This isn't done in these functions because the Zephyr shell behaves differently from the task and in the example of efs2 needs to be turned off earlier than the platform/ec console task. BRANCH=none BUG=b:164421798 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I75fc8fe2ca9214f216561ded97818880dda247d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2723495 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: implement uart functions getc and clear_inputYuval Peress2021-02-261-0/+26
| | | | | | | | | | | | | | | | | | | These functions are needed to build efs2.c. uart_getc() is the platform/ec equivalent of polling for a single byte. While uart_clear_input() doesn't actually have a Zephyr parallel and isn't really needed to get efs2 working. BRANCH=none BUG=b:164421798 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I43c46b7ed0b909565673d442c7f734f0c50f1dc0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721496 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: add support for disabling console channelsKeith Short2021-02-171-0/+16
| | | | | | | | | | | | | | | | Add support in the device tree for disabling console output channels by default. BUG=b:180421120 BRANCH=none TEST=make buildall TEST=zmake testall TEST=On Volteer, verify "hostcmd" channel is disabled by default Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9fa1fe78ee3927346ede8e75378260f6061075cd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2698268 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: implement console read/snapshot host commandsJack Rosenthal2021-02-111-0/+3
| | | | | | | | | | | | | | | | | | | | | Implement an optional console output buffer, and wire it up to the associated host commands. We don't use the EC's uart buffering module for this, as it implements a UART buffer which also is used for transmit buffering (we don't do that, and instead immediately send to printk). We don't use Zephyr's ring buffer structure for this as we need to track multiple heads due to the semantics of snapshots. BUG=b:178033156 BRANCH=none TEST="ectool console" on volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib1d39e32e8bad5b23b98034c33f56534a8c89fcb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685412 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: enable console channelsJack Rosenthal2021-02-111-58/+18
| | | | | | | | | | | | | | | | Delete our shim implementations of cprintf, cprints, cputs, and cflush, and bring in console_output.c and uart_printf.c instead. This requires implementing a few more uart_* functions BUG=b:178033156,b:179408111 BRANCH=none TEST=manually test the "chan" console command on volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id0ac950af8521068b942c38bc95a193cd0695b90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686258 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: minimal uart_* implementationsJack Rosenthal2021-01-261-0/+24
| | | | | | | | | | | | | | | | Added minimum required uart_* functions for panic to work, using printk as backend. Probably should switch filling-out enough to support uart_buffering.c in the future, requiring switching to Zephyr's UART drivers instead of printk(). BUG=b:178033156,b:178011288 BRANCH=none TEST=compile with panic_output.c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I2879cd05cd858d13241e6fc1a7f818b6649e4bd6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2649497 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: switch to platform/ec printf format implementationJack Rosenthal2021-01-091-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, the cprints and cprintf shim implementations used Zephyr's printk to do the output formatting. Our EC code has some custom printf specifiers not supported by Zephyr's printk. We've already attempted to send some of our custom specifiers upstream, but upstream does not want them: https://github.com/zephyrproject-rtos/zephyr/pull/28882 The logical thing to do would be to bring in the vfnprintf function from our EC to the Zephyr build, and use that to do the output formatting instead. That's what this CL does. The binary cost of brining in this second printf implementation appears to be minimal (952 bytes on volteer). BUG=b:177065615 BRANCH=none TEST=on posix-ec and volteer, run gettime and observe output no longer contains %.6lld, but instead the correct system time Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I53cd4edf129223c12a2c5e7d0519623a8d07a328 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2618575
* zephyr: Don't output a newline in cputs() unless requestedSimon Glass2020-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this function adds a newline, but it should not. Fix it. BUG=b:167405015 BRANCH=none TEST=zmake configure .../zephyr-chrome/projects/experimental/volteer \ -B /tmp/z/cos zmake build /tmp/z/cos Run on volteer and see that the keyboard output looks right. before: 20-11-06 15:17:39.329 keyboard_scan_task 20-11-06 15:17:39.329 [0x00000000T KB init state: -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 -- 20-11-06 15:17:39.342 ] after: 20-11-06 15:19:11.144 [0x00000000T KB init state: -- -- -- -- -- -- -- -- -- -- -- -- --] Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic2592d49fa1f6debf8d0a65c9dc1b9bef2eb88ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523390 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: use printk instead of shell_Jett Rink2020-10-121-12/+8
| | | | | | | | | | | | | | | The shell print function is not as complete as the printk function. I see have to add functionality for the printk version, but the shell version does not support the specifiers we use in gettime console (e.g. "0x%016llx -> %11.6lld" format specifier) BRANCH=none BUG=none TEST=flash volteer and call gettime on console and see correct results Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Iadf9fc05708c31b70735145ed43750c308b07f39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2446028
* zephyr: shim in the zephyr shell as the EC consoleJack Rosenthal2020-10-011-0/+89
This provides compatible macros for DECLARE_CONSOLE_COMMAND, DECLARE_SAFE_CONSOLE_COMMAND, and DECLARE_CONSOLE_COMMAND_FLAGS. Note: the concept of command flags and command restriction are not enabled currently for Zephyr. We simply define everything for now. These macros use the Zephyr shell subsystem as the backend for commands. In addition, cprints, cprintf, and cputs have been redirected to the shell for CC_CONSOLE channel outputs, and printk for all other outputs. We will look at using Zephyr's logging subsystem instead of printk for the other channels in the future. BUG=b:167590251 BRANCH=none TEST=run "gettime" and "timerinfo" commands with follow-up CLs Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17caedcd0b84a21dd2b135312f683885eaf694af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427097 Reviewed-by: Jett Rink <jettrink@chromium.org>