[U-Boot-Users] Adding new commands

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@dave-tech.it

Dear llandre!
llandre schrieb:
#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

Andreas Schweigstill wrote:
Dear llandre!
llandre schrieb:
#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.
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@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

In message 453368A1.5050407@dave-tech.it 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

Wolfgang Denk wrote:
In message 453368A1.5050407@dave-tech.it 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.
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

In message 024001c6f163$46118f10$01c4af0a@atmel.com 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

Wolfgang Denk wrote:
In message 453368A1.5050407@dave-tech.it 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.
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

Hi,
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@dave-tech.it

On Tuesday 17 October 2006 02:19, llandre wrote:
Hi,
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.
Regards, llandre
DAVE Electronics System House - R&D Department web: http://www.dave-tech.it email: r&d2@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&da... _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users

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@dave-tech.it
participants (6)
-
Andreas Schweigstill
-
Brent Cook
-
llandre
-
Tolunay Orkun
-
Ulf Samuelsson
-
Wolfgang Denk