[lib][console] switch the console commands to __start __stop style symbols
This commit is contained in:
@@ -72,8 +72,8 @@ static cmd_block *command_list = NULL;
|
|||||||
/* a linear array of statically defined command blocks,
|
/* a linear array of statically defined command blocks,
|
||||||
defined in the linker script.
|
defined in the linker script.
|
||||||
*/
|
*/
|
||||||
extern cmd_block __commands_start;
|
extern cmd_block __start_commands __WEAK;
|
||||||
extern cmd_block __commands_end;
|
extern cmd_block __stop_commands __WEAK;
|
||||||
|
|
||||||
static int cmd_help(int argc, const cmd_args *argv);
|
static int cmd_help(int argc, const cmd_args *argv);
|
||||||
static int cmd_help_panic(int argc, const cmd_args *argv);
|
static int cmd_help_panic(int argc, const cmd_args *argv);
|
||||||
@@ -108,8 +108,7 @@ int console_init(void) {
|
|||||||
mutex_init(command_lock);
|
mutex_init(command_lock);
|
||||||
|
|
||||||
/* add all the statically defined commands to the list */
|
/* add all the statically defined commands to the list */
|
||||||
cmd_block *block;
|
for (cmd_block *block = &__start_commands; block != &__stop_commands; block++) {
|
||||||
for (block = &__commands_start; block != &__commands_end; block++) {
|
|
||||||
console_register_commands(block);
|
console_register_commands(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
SECTIONS {
|
|
||||||
.commands : {
|
|
||||||
__commands_start = .;
|
|
||||||
KEEP (*(.commands))
|
|
||||||
__commands_end = .;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
INSERT AFTER .data;
|
|
||||||
@@ -5,6 +5,4 @@ MODULE := $(LOCAL_DIR)
|
|||||||
MODULE_SRCS += \
|
MODULE_SRCS += \
|
||||||
$(LOCAL_DIR)/console.c
|
$(LOCAL_DIR)/console.c
|
||||||
|
|
||||||
EXTRA_LINKER_SCRIPTS += $(LOCAL_DIR)/console.ld
|
|
||||||
|
|
||||||
include make/module.mk
|
include make/module.mk
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ typedef struct _cmd_block {
|
|||||||
|
|
||||||
#define STATIC_COMMAND_START static const cmd _cmd_list[] = {
|
#define STATIC_COMMAND_START static const cmd _cmd_list[] = {
|
||||||
|
|
||||||
#define STATIC_COMMAND_END(name) }; cmd_block _cmd_block_##name __ALIGNED(sizeof(void *)) __SECTION(".commands") = \
|
#define STATIC_COMMAND_END(name) }; cmd_block _cmd_block_##name __ALIGNED(sizeof(void *)) __SECTION("commands") = \
|
||||||
{ NULL, sizeof(_cmd_list) / sizeof(_cmd_list[0]), _cmd_list }
|
{ NULL, sizeof(_cmd_list) / sizeof(_cmd_list[0]), _cmd_list }
|
||||||
|
|
||||||
/* same as above but with a suffixed name to make the list unique within the file */
|
/* same as above but with a suffixed name to make the list unique within the file */
|
||||||
#define STATIC_COMMAND_START_NAMED(name) static const cmd _cmd_list_##name[] = {
|
#define STATIC_COMMAND_START_NAMED(name) static const cmd _cmd_list_##name[] = {
|
||||||
|
|
||||||
#define STATIC_COMMAND_END_NAMED(name) }; cmd_block _cmd_block_##name __ALIGNED(sizeof(void *)) __SECTION(".commands") = \
|
#define STATIC_COMMAND_END_NAMED(name) }; cmd_block _cmd_block_##name __ALIGNED(sizeof(void *)) __SECTION("commands") = \
|
||||||
{ NULL, sizeof(_cmd_list_##name) / sizeof(_cmd_list_##name[0]), _cmd_list_##name }
|
{ NULL, sizeof(_cmd_list_##name) / sizeof(_cmd_list_##name[0]), _cmd_list_##name }
|
||||||
|
|
||||||
#define STATIC_COMMAND(command_str, help_str, func) { command_str, help_str, func, CMD_AVAIL_NORMAL },
|
#define STATIC_COMMAND(command_str, help_str, func) { command_str, help_str, func, CMD_AVAIL_NORMAL },
|
||||||
|
|||||||
Reference in New Issue
Block a user