Commit Graph

31 Commits

Author SHA1 Message Date
Wolfgang Denk 47e26b1bf9 cmd_usage(): simplify return code handling
Lots of code use this construct:

	cmd_usage(cmdtp);
	return 1;

Change cmd_usage() let it return 1 - then we can replace all these
ocurrances by

	return cmd_usage(cmdtp);

This fixes a few places with incorrect return code handling, too.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:43:57 +02:00
Wolfgang Denk 54841ab50c Make sure that argv[] argument pointers are not modified.
The hush shell dynamically allocates (and re-allocates) memory for the
argument strings in the "char *argv[]" argument vector passed to
commands.  Any code that modifies these pointers will cause serious
corruption of the malloc data structures and crash U-Boot, so make
sure the compiler can check that no such modifications are being done
by changing the code into "char * const argv[]".

This modification is the result of debugging a strange crash caused
after adding a new command, which used the following argument
processing code which has been working perfectly fine in all Unix
systems since version 6 - but not so in U-Boot:

int main (int argc, char **argv)
{
	while (--argc > 0 && **++argv == '-') {
/* ====> */	while (*++*argv) {
			switch (**argv) {
			case 'd':
				debug++;
				break;
			...
			default:
				usage ();
			}
		}
	}
	...
}

The line marked "====>" will corrupt the malloc data structures and
usually cause U-Boot to crash when the next command gets executed by
the shell.  With the modification, the compiler will prevent this with
an
	error: increment of read-only location '*argv'

N.B.: The code above can be trivially rewritten like this:

	while (--argc > 0 && **++argv == '-') {
		char *arg = *argv;
		while (*++arg) {
			switch (*arg) {
			...

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-07-04 23:55:42 +02:00
Nobuhiro Iwamatsu f1cae1969d sh: Move some defs to convince 'pcrel too far'
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Takashi Yoshii <yoshii.takashi@gmail.com>
2009-10-30 10:02:00 +09:00
Ben Warren 7194ab8095 Convert SMC91111 Ethernet driver to CONFIG_NET_MULTI API
All in-tree boards that use this controller have CONFIG_NET_MULTI
added
Also:
  - changed CONFIG_DRIVER_SMC91111 to CONFIG_SMC91111
  - cleaned up line lengths
  - modified all boards that override weak function in this driver
  - modified all eeprom standalone apps to work with new driver
  - updated blackfin standalone EEPROM app after testing

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-04 22:37:03 -07:00
Jean-Christophe PLAGNIOL-VILLARD a794f59a75 sh/rsk7203: add missing include net.h
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-08-23 22:43:33 +02:00
Ben Warren 736fead8fd Convert SMC911X Ethernet driver to CONFIG_NET_MULTI API
All in-tree boards that use this controller have CONFIG_NET_MULTI added
Also:
 - changed CONFIG_DRIVER_SMC911X* to CONFIG_SMC911X*
 - cleaned up line lengths
 - modified all boards that override weak function in this driver
 - added

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Tested-by: Mike Frysinger <vapier@gentoo.org>
2009-07-22 22:53:44 -07:00
Nobuhiro Iwamatsu baa9f9ba43 sh: Revised the build with newest compiler
The check of data became severe from newest gcc.
This patch checked in gcc-4.2 and 4.3 .

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-07-08 11:43:16 +09:00
Jean-Christophe PLAGNIOL-VILLARD 3931a375de sh: unify linker script
all sh boards use the same cpu linker script so move it to cpu/$(CPU)

that could be overwrite in following order
SOC
BOARD
via the corresponding config.mk

tested on r2dplus

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-07-08 11:43:15 +09:00
Jean-Christophe PLAGNIOL-VILLARD 236aad8758 sh: make the linker scripts more generic
currently we need to sync the linker script enty and TEXT_BASE manualy
and the reloc_dst is based on it

instead provide it now from the ldflags

tested on r2dplus

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-07-08 11:43:15 +09:00
Jean-Christophe PLAGNIOL-VILLARD ce29817212 sh7785lcr: fix out of tree build
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-07-08 11:43:14 +09:00
Wolfgang Denk a89c33db96 General help message cleanup
Many of the help messages were not really helpful; for example, many
commands that take no arguments would not print a correct synopsis
line, but "No additional help available." which is not exactly wrong,
but not helpful either.

Commit ``Make "usage" messages more helpful.'' changed this
partially. But it also became clear that lots of "Usage" and "Help"
messages (fields "usage" and "help" in struct cmd_tbl_s respective)
were actually redundant.

This patch cleans this up - for example:

Before:
	=> help dtt
	dtt - Digital Thermometer and Thermostat

	Usage:
	dtt         - Read temperature from digital thermometer and thermostat.

After:
	=> help dtt
	dtt - Read temperature from Digital Thermometer and Thermostat

	Usage:
	dtt

Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-06-12 20:47:16 +02:00
Trent Piepho f62fb99941 Fix all linker script to handle all rodata sections
A recent gcc added a new unaligned rodata section called '.rodata.str1.1',
which needs to be added the the linker script.  Instead of just adding this
one section, we use a wildcard ".rodata*" to get all rodata linker section
gcc has now and might add in the future.

However, '*(.rodata*)' by itself will result in sub-optimal section
ordering.  The sections will be sorted by object file, which causes extra
padding between the unaligned rodata.str.1.1 of one object file and the
aligned rodata of the next object file.  This is easy to fix by using the
SORT_BY_ALIGNMENT command.

This patch has not be tested one most of the boards modified.  Some boards
have a linker script that looks something like this:

*(.text)
. = ALIGN(16);
*(.rodata)
*(.rodata.str1.4)
*(.eh_frame)

I change this to:

*(.text)
. = ALIGN(16);
*(.eh_frame)
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))

This means the start of rodata will no longer be 16 bytes aligned.
However, the boundary between text and rodata/eh_frame is still aligned to
16 bytes, which is what I think the real purpose of the ALIGN call is.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
2009-03-20 22:39:12 +01:00
Wolfgang Denk b3dd629e78 Prepare 2009.03-rc2
Update CHANEGLOG, fix minor coding style issue.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-03-15 22:40:09 +01:00
Yusuke.Goda 94a353611b sh: ap325rxa: Change the wait cycle in the area 5
Signed-off-by: Yusuke Goda <goda.yusuke@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-03-13 22:32:27 +09:00
Yoshihiro Shimoda ada9318252 sh: Add support 32-Bit Extended Address Mode to sh7785lcr
We can built 'make sh7785lcr_32bit_config'. And add new command "pmb"
for this mode. This command changes PMB for using 512MB system memory.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-03-12 23:58:30 +09:00
Peter Tyser 2fb2604d5c Command usage cleanup
Remove command name from all command "usage" fields and update
common/command.c to display "name - usage" instead of
just "usage". Also remove newlines from command usage fields.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-01-28 08:49:52 +01:00
Peter Tyser 62c3ae7c6e Standardize command usage messages with cmd_usage()
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-01-28 08:43:45 +01:00
Nobuhiro Iwamatsu c9935c9925 sh: Fix compile error on lowlevel_init file
lowlevel_init of SH was corrected to use the write/readXX macro.
However, there was a problem that was not able to be compiled partially.
This patch corrected this.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-01-16 10:22:27 +09:00
Kieran Bingham a5b04d00bf sh: Fix up rsk7203 target for out of tree build
Fix up rsk7203 target to build successfully using out-of-tree build.

Signed-off-by: Kieran Bingham <kbingham@mpc-data.co.uk>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-01-16 10:22:27 +09:00
Jean-Christophe PLAGNIOL-VILLARD f7e78f3b74 sh: use write{8,16,32} in all lowlevel_init
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-01-16 10:22:27 +09:00
Jean-Christophe PLAGNIOL-VILLARD e443077962 sh: lowlevel_init coding style cleanup
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2009-01-16 10:22:26 +09:00
Jean-Christophe PLAGNIOL-VILLARD a319f14962 sh: r2dplus fix register access
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-12-10 23:11:36 +09:00
Jean-Christophe PLAGNIOL-VILLARD 4d4a96055f sh: r2dplus/lowlevel_init: coding style fix
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-12-10 23:11:35 +09:00
Nobuhiro Iwamatsu b81786cff4 sh: Migo-R: Update BSC value
A value of BSC CS4 was wrong, Fixed it.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-12-10 23:11:35 +09:00
Nobuhiro Iwamatsu 51b572a801 sh: rsk7203: Moved rsk7203 board to board/renesas
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-10-31 23:04:56 +09:00
Nobuhiro Iwamatsu 58453b00b3 sh: MigoR: Moved MigoR board to board/renesas
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-10-31 23:04:49 +09:00
Nobuhiro Iwamatsu c1da2a2281 sh: r2dplus: Moved r2dplus board to board/renesas
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-10-31 23:04:43 +09:00
Nobuhiro Iwamatsu 78385bf235 sh: sh7763rdp: Moved sh7763rdp board to board/renesas
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-10-31 23:04:38 +09:00
Nobuhiro Iwamatsu c6525d459c sh: sh7785lcr: Moved sh7785lcr board to board/renesas
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-10-31 23:04:31 +09:00
Nobuhiro Iwamatsu acd3e30d09 sh: r7780mp: Moved r7780mp board to board/renesas
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-10-31 23:04:25 +09:00
Nobuhiro Iwamatsu f84e6ea275 sh: ap325rxa: Moved ap325rxa board to board/renesas
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2008-10-31 23:04:18 +09:00