Skip to contentSkip to conversation

Adding new commands

U-Boot-Users llandre 6 participants 10 messages Oct 16, 2006 – Oct 17, 2006

lore
Share & tools
lore

llandre

author
#0 lore raw

Hi,

I have to add two new commands so I have to add something like this to cmd_confdefs.h:

#define CFG_CMD_NEW1 0x8000000000000000ULL
#define CFG_CMD_NEW2 ???

IIUC we have 64 bits available for the commands and 63 commands are already defined. So how to define more than 64 commands?

TIA,
llandre

DAVE Electronics System House - R&D Department

web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it
#1 lore raw

Dear llandre!

Quoted 5 lines · llandre

#define CFG_CMD_NEW1 0x8000000000000000ULL
#define CFG_CMD_NEW2 ???

IIUC we have 64 bits available for the commands and 63 commands are already defined. So how to define more than 64 commands?

This is indeed a big problem which will occur to nearly every developer who implements new commands. CFG_CMD_* and CONFIG_COMMANDS are only used for preprocessor evaluation; they don't seem to be used in object code. But they rely on the ULL (unsigned long long int) type; I don't think that there is something like a 128bit type which can be used directly for logical AND operations.

For new command there could be used another macro like CONFIG_COMMANDS2 and CFG_CMD2_* for the configuration values.

Here are some statistics about usage of the old definitions:
CONFIG_COMMANDS: about 1650 entries in 470 files
CFG_CMD: about 4126 entries in 470

With best regards
Andreas Schweigstill

Signature · 5 lines
Dipl.-Phys. Andreas Schweigstill
Schweigstill IT | Embedded Systems
Schauenburgerstra?e 116, D-24118 Kiel, Germany
Phone: (+49) 431 5606-435, Fax: (+49) 431 5606-436
Mobile: (+49) 171 6921973, Web: http://www.schweigstill.de/
#2 lore raw
Quoted 16 lines · Andreas Schweigstill

Dear llandre!

Quoted 5 lines · llandre

#define CFG_CMD_NEW1 0x8000000000000000ULL
#define CFG_CMD_NEW2 ???

IIUC we have 64 bits available for the commands and 63 commands are already defined. So how to define more than 64 commands?

This is indeed a big problem which will occur to nearly every developer who implements new commands. CFG_CMD_* and CONFIG_COMMANDS are only used for preprocessor evaluation; they don't seem to be used in object code. But they rely on the ULL (unsigned long long int) type; I don't think that there is something like a 128bit type which can be used directly for logical AND operations.

Quoted 3 lines

For new command there could be used another macro like CONFIG_COMMANDS2 and CFG_CMD2_* for the configuration values.

The number of options is growing all the time.
Maybe it would be a good idea to adopt the Kconfig system. Wolfgang does not like to have a lot of files like they do in the kernel but you do not have to split it up like they do it in the kernel. You could have a single Config.in file.

Best Regards,
Ulf Samuelsson
ulf at atmel.com

GSM:  +46 (706) 22 44 57
Tel:     +46  (8) 441 54 22
Fax:     +46 (8) 441 54 29
Mail: Box 2033  174 02 Sundbyberg
Visit: Kavalleriv?gen 24
          174 58 Sundbyberg'

Sweden

#3 lore raw
In reply to llandre
Quoted 9 lines · In message <[email protected]> you wrote:

I have to add two new commands so I have to add something like this to cmd_confdefs.h:

#define CFG_CMD_NEW1 0x8000000000000000ULL
#define CFG_CMD_NEW2 ???

IIUC we have 64 bits available for the commands and 63 commands are already defined. So how to define more than 64 commands?

We have to rework this whole configuration setup. At the moment I don't have a good and quick solution available.

What exactly are your two new commands?

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Out of register space (ugh)"
- vi
#4 lore raw
Quoted 5 lines · Wolfgang Denk
Quoted 4 lines · In message <[email protected]> you wrote:

I have to add two new commands so I have to add something like this to cmd_confdefs.h:

Quoted 9 lines
Quoted 5 lines

#define CFG_CMD_NEW1 0x8000000000000000ULL
#define CFG_CMD_NEW2 ???

IIUC we have 64 bits available for the commands and 63 commands are already defined. So how to define more than 64 commands?

We have to rework this whole configuration setup. At the moment I don't have a good and quick solution available.

You can always define a command outside the CFG_CMD in your board header file.

Then you can do an #ifdef in the source file.

Best Regards,
Ulf Samuelsson

#5 lore raw
Quoted 5 lines · In message <[email protected]> you wrote:

You can always define a command outside the CFG_CMD in your board header file.

Then you can do an #ifdef in the source file.

Yes, but this is not a general solution. I consider this a dirty hack which I don't want to see in the public source tree. There, I want to have one general mechanism to select commands. We have rteached the limits of the current one, and need to implement a better one.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human mind ordinarily operates at only ten percent of its capaci-
ty - the rest is overhead for the operating system.
#6 lore raw
In reply to Wolfgang Denk
Quoted 4 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:

I have to add two new commands so I have to add something like this to cmd_confdefs.h:

Quoted 9 lines
Quoted 5 lines

#define CFG_CMD_NEW1 0x8000000000000000ULL
#define CFG_CMD_NEW2 ???

IIUC we have 64 bits available for the commands and 63 commands are already defined. So how to define more than 64 commands?

We have to rework this whole configuration setup. At the moment I don't have a good and quick solution available.

One possibility is to get rid of existing bitmap scheme. A cmd_defaults.h would define all default CFG_COMMAND_XXX. And board configs would add remove commands by defining more or remove from defaults by undefining the corresponding macros after the inclusion of cmd_defaults.h.

Another quick solution would be to use Most Significant Bit as an expansion flag and use up to 63 more commands via CONFIG_COMMANDS2 macro.

The test logic will need to be modified but it could be wrapped to a macro like:

Instead of this:

#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #include <rtc.h>
#endif

Use this:

#if IS_CONFIG_COMMAND(CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #include <rtc.h>
#endif

And IS_CONFIG_COMMAND macro defined something like:

#define IS_CONFIG_COMMAND(x)	((x) & 0x8000000000000000ULL) ? \
				((x) & CONFIG_COMMANDS2) | \
				((x) & CONFIG_COMMANDS))

And if we get to 63+62=126 commands we can use next to MSB in CONFIG_COMMANDS2 as another expansion bit along with CONFIG_COMMANDS3 (if we ever get that far).

Actually we do not even need to modify the existing (CONFIG_COMMAND & ....) but any new configuration options needs to test for enabling via the new macro.

Best regards,
Tolunay

author
#7 lore raw
In reply to Wolfgang Denk

Hi,

Quoted 1 line

What exactly are your two new commands?

the first one is used to boot WinCE images (don't blame me :) ), the second is used to turn watchdog timer on and off.

Regards,
llandre

DAVE Electronics System House - R&D Department

web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it
#8 lore raw
Quoted 7 lines · llandre

Hi,

Quoted 1 line

What exactly are your two new commands?

the first one is used to boot WinCE images (don't blame me :) ), the second is used to turn watchdog timer on and off.

Are these more general-purpose commands, or like the watchdog timer, perhaps board-specific? I've added a number of new commands for some boards I'm working on, but because they were either board or CPU-specific (and only defined under the board directory), I didn't bother guarding them at all. Not sure if this is cannon.

Quoted 17 lines

Regards,
llandre

DAVE Electronics System House - R&D Department

web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

author
#9 lore raw
Quoted 2 lines

Are these more general-purpose commands, or like the watchdog timer, perhaps board-specific?

Both are basically general-purpose. They require a little board-specific portion.
The watchdog command "extends" the existing infrastructure in order to allow the user to enable/disable the watchdog without rebuilding (very useful during debugging stage).

Regards,
llandre

DAVE Electronics System House - R&D Department

web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it