Commit Graph

16 Commits

Author SHA1 Message Date
Bill Richardson
0a4bb34bcd Add more CONFIG_CMD_* options for console commands
We have a large number of config.h options to enable/disable
specific console commands. This adds a few more that we will want
to control.

BUG=chrome-os-partner:57408
BRANCH=none
TEST=make buildall; try on Gru with and without CR50_DEV=1

Change-Id: Id41f0e9f44fc77feaf56853f357a6b33bb685b0c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/391614
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-10-01 00:02:01 -07:00
Bill Richardson
bb15561db5 cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args
Since pretty much always, we've declared console commands to take
a "longhelp" argument with detailed explanations of what the
command does. But since almost as long, we've never actually used
that argument for anything - we just silently throw it away in
the macro. There's only one command (usbchargemode) that even
thinks it defines that argument.

We're never going to use this, let's just get rid of it.

BUG=none
BRANCH=none
CQ-DEPEND=CL:*279060
CQ-DEPEND=CL:*279158
CQ-DEPEND=CL:*279037
TEST=make buildall; tested on Cr50 hardware

Everything builds. Since we never used this arg anyway, there had
better not be any difference in the result.

Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374163
Reviewed-by: Myles Watson <mylesgw@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-24 16:30:10 +00:00
Shawn Nematbakhsh
257dab7491 console: Put additional console commands behind CONFIGs
Allow boards to save flash space by undef'ing CONFIGs which gate
'hcdebug' and 'md' console commands.

BUG=chrome-os-partner:34489
BRANCH=None
TEST=`make buildall -j`

Change-Id: I583b98ff1e4d9d6a26958c6895fb0c0305dddceb
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/336813
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-04-03 10:27:36 -07:00
Bill Richardson
248e1a8a31 md console command can dump memory in more formats
This adds optional format designations to the "md" console
command. By default it dumps memory in 32-bit words, but with
this change it can also display 16-bit words, bytes, and strings.

BUG=none
BRANCH=none
TEST=manual

For example:

> md 0x5c400 32

0005C400: 6d6d6f63 20646e61 75626564 756f2067
0005C410: 74757074 646f6d20 6f6e0065 6c616d72
0005C420: 65766500 70007972 6d617261 41550073
0005C430: 69205452 6974696e 7a696c61 61206465
0005C440: 72657466 73797320 706d756a 2d0a0a00
0005C450: 55202d2d 20545241 74696e69 696c6169
0005C460: 2064657a 65746661 65722072 746f6f62
0005C470: 2d2d2d20 525b000a 74657365 75616320

> md .h 0x5c400 32

0005C400: 6f63 6d6d 6e61 2064 6564 7562 2067 756f
0005C410: 7074 7475 6d20 646f 0065 6f6e 6d72 6c61
0005C420: 6500 6576 7972 7000 7261 6d61 0073 4155
0005C430: 5452 6920 696e 6974 6c61 7a69 6465 6120

> md .b 0x5c400 32

0005C400: 63 6f 6d 6d 61 6e 64 20 64 65 62 75 67 20 6f 75
0005C410: 74 70 75 74 20 6d 6f 64 65 00 6e 6f 72 6d 61 6c

> md .s 0x5c400 32

0005C400: command debug output mode\x00normal
>

Change-Id: Ic0dec9a1a3942acc66c88f46c5b02a80a8110817
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300020
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 14:49:59 -07:00
Vadim Bendebury
692f462c91 cli: add ability to read/write memory of different bus width
This adds an optional extra parameter to the 'rw' command. When the
first argument is .b or .s, the access size becomes 8 pr 16 bits
respectively.

BRANCH=none
BUG=none
TEST=on the EC console:
> rw  0x10000
read 0x10000 = 0x00000000
> rw .b 0x10000 0x55
write 0x10000 = 0x55
> rw  0x10000
read 0x10000 = 0x00000055
> rw .b 0x10000
read 0x10000 = 0x55
> rw .s 0x10002
read 0x10002 = 0x0000
> rw .s 0x10002 0x1234
write 0x10002 = 0x1234
> rw 0x10000
read 0x10000 = 0x12340055
>  rw .b 0x10000
read 0x10000 = 0x55
>  rw .b 0x10001
read 0x10001 = 0x00
> rw .b 0x10002
read 0x10002 = 0x34
> rw .b 0x10003
read 0x10003 = 0x12
> rw .s 0x10000
read 0x10000 = 0x0055
> rw .s 0x10002
read 0x10002 = 0x1234
> rw . 0x10002
Parameter 1 invalid
Usage: rw addr [.{b|s}] [value]
>

Change-Id: Iad1a4b3e297253ffdbf13afeede8ade9451eb11a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/268897
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-05-02 03:39:37 +00:00
Bill Richardson
86340a75d2 cleanup: Poke the watchdog when dumping lots of memory
If you use the "md" command to display lots of memory, it can
cause the watchdog to trip. This just pokes it every now and then
to be sure it's happy.

BUG=none
BRANCH=none
TEST=manual

Print a lot, see that it doesn't timeout:

  md 0 0x4000

Change-Id: Ic4e2746c07f4fbdf922e87ea3efbe90b88ae08c9
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/251011
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-02-20 00:07:08 +00:00
Sheng-Liang Song
c1e0b0e114 cr50: Replaced ww with md EC cli
Supported memory commands are: rw and md.
 - rw: for read/write a word
 - md: for memory display

Usage: rw addr [value]
Usage: md addr [num of words (4B)]

BRANCH=none
BUG=none
TEST="make BOARD=cr50" and "md 0 100"

> md 0 100
[00000000] : 00018000 0000011d 00000101 00000101
[00000010] : 00000101 00000101 00000101 00000101
...

Signed-off-by: Sheng-Liang Song <ssl@chromium.org>
Change-Id: I1de8c690cca006ec3aae42d4e6bd0ba30f7c3238
Reviewed-on: https://chromium-review.googlesource.com/231398
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-12-04 04:02:45 +00:00
Bill Richardson
e28b6184b1 tweak: Allow "rw" command to read AND write memory.
It's really annoying to have to type two different commands. If I
want to read a location and then write it and then read it back
(which often happens when poking at hardware), then this:

  rw 0x40570008
  rw 0x40570008 14
  rw 0x40570008

is much easier to enter than this:

  rw 0x40570008
  ww 0x40570008 14
  rw 0x40570008

The "ww" command is still there, if you're really attached to it.

BUG=none
BRANCH=none
TEST=manual

Tried the example above. It worked.

Change-Id: I2302ed60df3dd3ec2224afa7c32d997bd2468ec1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229660
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-11-14 22:47:13 +00:00
Vic Yang
5007bbc009 Use uintptr_t when converting integer from/to pointer
Perviously we use uint32_t for this, but this doesn't compile for 64-bit
environment (and likely doesn't for 16-bit either.) Use uintptr_t so that
we don't get size mismatch errors.

BUG=chrome-os-partner:19257
TEST=Run host emulated tests
BRANCH=None

Change-Id: I3cd66a745fa171c41a5f142514284ec106586acb
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50358
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-07 20:59:53 -07:00
Randall Spangler
e158bd5422 Clean up a few modules in common/
Just code cleanup; no functional changes

BUG=chrome-os-partner:15579
BRANCH=none
TEST=build link and snow

Change-Id: Ib62f805777994b39cd9f47a721f52529bb9399c5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36573
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-26 09:49:38 -07:00
Randall Spangler
e704c712ad Better help for console commands
Additional help messages and usage are gated by
CONFIG_CONSOLE_CMDHELP, so we can turn it on if there's space (adds
about 3KB to image size) and turn it off when there isn't.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=manual

1) help
2) help list
3) help gpioset
4) gpioset -> wrong number of params
5) gpioset fred 0 -> param1 bad
6) gpioset cpu_prochot fred -> param2 bad

Change-Id: Ibe99f37212020f763ebe65a068e6aa83a809a370
2012-05-25 13:34:06 -07:00
Randall Spangler
eac46a9194 More debug command cleanup to save space
(saves another 1.5KB)

BUG=none
TEST=(run the commands)

Change-Id: Id3ca58528fa68a4cec606edf2b98b9af38ac228f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-05-21 10:21:10 -07:00
Randall Spangler
470916fb0f Use console output instead of uart output for console commands
This completes console output cleanup.  The remaining calls to
uart_puts() and uart_printf() actually need to be that way.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:7464
TEST=manual

Change-Id: Ib1d6d370d30429017b3d11994894fece75fab6ea
2012-04-24 18:34:46 -07:00
Vincent Palatin
1008124533 Remove useless header includes
Preparatory work to introduce a second SoC : 2nd series 2/4

Avoid introducing platform specific dependencies in common files where
they are not necessary.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=None
TEST=build for BDS and Link

Change-Id: If2ccd022e4956425222b55a5a48ca7522857e7f0
2012-01-26 01:32:30 +00:00
Vincent Palatin
c21f07e58e register console commands at compile-time
Instead of using a runtime callback to register the console commands,
put them in a special linker section. So we can do a macro to "register"
them during the build.

It saves 684 bytes and a few microseconds at startup.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=None
TEST=run a few commands from the BDS command line.

Change-Id: Id33ea210b9035bf76ed720373c74c5dd24ccd1b1
2012-01-24 00:50:08 +00:00
Louis Yung-Chieh Lo
6396911897 Initial sources import 2/3
source files mainly done by Louis.

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>

Change-Id: I93fa38126e208cf3e525828b37bb407099686c6e
2011-12-07 19:10:02 +00:00