Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpu/cortexm_common/ldscripts/cortexm_base.ld
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ SECTIONS
_estack = .;
} > ram

.relocate : AT (_etext)
.data : AT (_etext)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do? Can this renaming of the section affect something else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't remember why this was done.

{
. = ALIGN(4);
_srelocate = .;
Expand Down
9 changes: 9 additions & 0 deletions sys/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,12 @@ endif
ifneq (native,$(BOARD))
INCLUDES += -I$(RIOTBASE)/sys/libc/include
endif

ifneq (,$(filter shell_commands,$(USEMODULE)))
ifneq (,$(filter cortexm_common,$(USEMODULE)))
LINKFLAGS += $(RIOTBASE)/sys/shell/commands/shell_commands_cortexm.ld
else
LINKFLAGS += $(RIOTBASE)/sys/shell/commands/shell_commands.ld
endif
UNDEF += -Wl,--whole-archive $(BINDIR)/shell_commands.a -Wl,--no-whole-archive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, interesting. I was wondering how you avoided the linker discarding the symbols, which is the reason why #9105 is still unmerged: it needs either #8711 (ld -r) or "--whole-archive" (which I think is the preferred option in conjuction with #10195 )

I see that you avoided much of the problems that have been holding #8711 by limiting the "--whole-archive" to just the shell module.

@cladmi , @gebart Wouldn't this be a good approach "unlock" #8711, or its equivalent with "--whole-archive"? As far as I understand, most of the problems come from a minority of files which define things like interrupt handlers. The "--whole-archive" could be enabled only for select modules (or, if most things work, enabled by default and disabled for select modules.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For #8711 I was thinking about rebasing/cleaning it, changing it to whole-archive and going for trying to enable per architecture. It managed to go far enough so that it is only a few PRs away for being able to enable some boards.

Not to say it should be supported only on some boards, but simplify the review.

We now have a server to build the two versions and compare the elf files, just need to take the time to analyze and solve all the issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trying to enable per architecture.

Agree. I insist, if there is some problematic module (if I recall correcyly we were having too few symbols discarded sometimes?) we can, as a quirk, disable it just for that module.

endif
5 changes: 4 additions & 1 deletion sys/include/shell_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ extern "C" {
#define DISK_READ_SECTOR_CMD "dread_sec"
#define DISK_READ_BYTES_CMD "dread"

extern const shell_command_t _shell_command_list[];
#define __registered__ __attribute__((used,section("._shell_command_list"))) static
#define REGISTER_SHELL_COMMAND(name, desc, handler) __registered__ shell_command_t handler ## _command = {name, desc, handler}

extern const shell_command_t _shell_command_list;

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions sys/shell/commands/sc_at30tse75x.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <stdbool.h>
#include "at30tse75x.h"

#ifdef MODULE_AT30TSE75X
#include "shell_commands.h"

static bool initialized = false;
static at30tse75x_t dev;
Expand Down Expand Up @@ -157,4 +157,4 @@ int _at30tse75x_handler(int argc, char **argv)
return 0;
}

#endif /* MODULE_AT30TSE75X */
REGISTER_SHELL_COMMAND("at30tse75x", "Test AT30TSE75X temperature sensor", _at30tse75x_handler);
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_blacklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "net/gnrc/ipv6/blacklist.h"

#include "shell_commands.h"

static void _usage(char *cmd)
{
printf("usage: * %s\n", cmd);
Expand Down Expand Up @@ -60,4 +62,6 @@ int _blacklist(int argc, char **argv)
return 0;
}

REGISTER_SHELL_COMMAND("blacklist", "blacklists an address for receival ('blacklist [add|del|help]')", _blacklist);

/** @} */
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "can/conn/raw.h"
#include "can/raw.h"

#include "shell_commands.h"

#define SC_CAN_MAX_FILTERS 10
#define xstr(a) str(a)
#define str(a) #a
Expand Down Expand Up @@ -182,3 +184,5 @@ int _can_handler(int argc, char **argv)
}
return 0;
}

REGISTER_SHELL_COMMAND("can", "CAN commands", _can_handler);
7 changes: 7 additions & 0 deletions sys/shell/commands/sc_ccnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "ccn-lite-riot.h"
#include "ccnl-pkt-ndntlv.h"

#include "shell_commands.h"

#define BUF_SIZE (64)

#define MAX_ADDR_LEN (GNRC_NETIF_L2ADDR_MAXLEN)
Expand Down Expand Up @@ -266,3 +268,8 @@ int _ccnl_fib(int argc, char **argv)
}
return 0;
}

REGISTER_SHELL_COMMAND( "ccnl_open", "opens an interface or socket", _ccnl_open);
REGISTER_SHELL_COMMAND( "ccnl_int", "sends an interest", _ccnl_interest);
REGISTER_SHELL_COMMAND( "ccnl_cont", "create content and populated it", _ccnl_content);
REGISTER_SHELL_COMMAND( "ccnl_fib", "shows or modifies the CCN-Lite FIB", _ccnl_fib);
8 changes: 8 additions & 0 deletions sys/shell/commands/sc_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "shell_commands.h"
#include "diskio.h"

#include "shell_commands.h"

static inline uint8_t sector_read(unsigned char *read_buf, unsigned long sector, unsigned long length, unsigned long offset)
{
if (mci_read(read_buf, sector, 1) == DISKIO_RES_OK) {
Expand Down Expand Up @@ -173,3 +175,9 @@ int _read_bytes(int argc, char **argv)
return 1;

}

REGISTER_SHELL_COMMAND(DISK_READ_SECTOR_CMD, "Reads the specified sector of inserted memory card", _read_sector);
REGISTER_SHELL_COMMAND(DISK_READ_BYTES_CMD, "Reads the specified bytes from inserted memory card", _read_bytes);
REGISTER_SHELL_COMMAND(DISK_GET_SECTOR_SIZE, "Get the sector size of inserted memory card", _get_sectorsize);
REGISTER_SHELL_COMMAND(DISK_GET_SECTOR_COUNT, "Get the sector count of inserted memory card", _get_sectorcount);
REGISTER_SHELL_COMMAND(DISK_GET_BLOCK_SIZE, "Get the block size of inserted memory card", _get_blocksize);
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "net/fib.h"
#include "net/gnrc/ipv6.h"

#include "shell_commands.h"

#define INFO1_TXT "fibroute add <destination> via <next hop> [dev <device>]"
#define INFO2_TXT " [lifetime <lifetime>]"
#define INFO3_TXT " <destination> - the destination address with optional prefix size, e.g. /116\n" \
Expand Down Expand Up @@ -252,3 +254,5 @@ int _fib_route_handler(int argc, char **argv)
puts("\nunrecognized parameters.\nPlease enter fibroute [add|del] for more information.");
return 1;
}

REGISTER_SHELL_COMMAND("fibroute", "Manipulate the FIB (info: 'fibroute [add|del]')", _fib_route_handler);
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_gnrc_6ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "timex.h"
#include "xtimer.h"

#include "shell_commands.h"

static xtimer_t del_timer[GNRC_SIXLOWPAN_CTX_SIZE];
void _del_cb(void *ptr)
{
Expand Down Expand Up @@ -146,4 +148,6 @@ int _gnrc_6ctx(int argc, char **argv)
return 0;
}

REGISTER_SHELL_COMMAND("6ctx", "6LoWPAN context configuration tool", _gnrc_6ctx);

/** @} */
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_gnrc_ipv6_nib.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "net/gnrc/netif.h"
#include "net/ipv6/addr.h"

#include "shell_commands.h"

static void _usage(char **argv);
static int _nib_neigh(int argc, char **argv);
static int _nib_prefix(int argc, char **argv);
Expand Down Expand Up @@ -245,4 +247,6 @@ static int _nib_route(int argc, char **argv)
return 0;
}

REGISTER_SHELL_COMMAND("nib", "Configure neighbor information base", _gnrc_ipv6_nib);

/** @} */
7 changes: 7 additions & 0 deletions sys/shell/commands/sc_gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "net/l2filter.h"
#endif

#include "shell_commands.h"

/**
* @brief The default IPv6 prefix length if not specified.
*/
Expand Down Expand Up @@ -1233,6 +1235,9 @@ int _gnrc_netif_send(int argc, char **argv)

return 0;
}

REGISTER_SHELL_COMMAND("txtsnd", "Sends a custom string as is over the link layer", _gnrc_netif_send);

#endif

int _gnrc_netif_config(int argc, char **argv)
Expand Down Expand Up @@ -1347,3 +1352,5 @@ int _gnrc_netif_config(int argc, char **argv)
_usage(argv[0]);
return 1;
}

REGISTER_SHELL_COMMAND("ifconfig", "Configure network interfaces", _gnrc_netif_config);
5 changes: 5 additions & 0 deletions sys/shell/commands/sc_gnrc_rpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "net/gnrc/rpl/p2p_structs.h"
#endif

#include "shell_commands.h"

int _gnrc_rpl_init(char *arg)
{
kernel_pid_t iface_pid = atoi(arg);
Expand Down Expand Up @@ -431,6 +433,9 @@ int _gnrc_rpl(int argc, char **argv)
puts("* show\t\t\t\t\t- show instance and dodag tables");
return 0;
}

REGISTER_SHELL_COMMAND("rpl", "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl);

/**
* @}
*/
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* @}
*/

#include "shell_commands.h"

extern void heap_stats(void);

int _heap_handler(int argc, char **argv)
Expand All @@ -29,3 +31,5 @@ int _heap_handler(int argc, char **argv)

return 0;
}

REGISTER_SHELL_COMMAND("heap", "Shows the heap state for the LPC2387 on the command shell.", _heap_handler);
6 changes: 3 additions & 3 deletions sys/shell/commands/sc_icmpv6_echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include <stdlib.h>
#include <inttypes.h>

#ifdef MODULE_GNRC_ICMPV6

#include "byteorder.h"
#include "net/gnrc/icmpv6.h"
#include "net/ipv6/addr.h"
Expand All @@ -34,6 +32,8 @@
#include "utlist.h"
#include "xtimer.h"

#include "shell_commands.h"

static uint16_t id = 0x53;
static uint16_t min_seq_expected = 0;
static uint16_t max_seq_expected = 0;
Expand Down Expand Up @@ -340,7 +340,7 @@ int _icmpv6_ping(int argc, char **argv)
return success ? 0 : 1;
}

#endif
REGISTER_SHELL_COMMAND( "ping6", "Ping via ICMPv6", _icmpv6_ping);

/**
* @}
Expand Down
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include "ps.h"

#include "shell_commands.h"

int _ps_handler(int argc, char **argv)
{
(void) argc;
Expand All @@ -29,3 +31,5 @@ int _ps_handler(int argc, char **argv)

return 0;
}

REGISTER_SHELL_COMMAND("ps", "Prints information about running threads.", _ps_handler);
5 changes: 5 additions & 0 deletions sys/shell/commands/sc_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "random.h"

#include "shell_commands.h"

int _random_init(int argc, char **argv)
{
int initval;
Expand Down Expand Up @@ -64,3 +66,6 @@ int _random_get(int argc, char **argv)

return 0;
}

REGISTER_SHELL_COMMAND( "random_init", "initializes the PRNG", _random_init);
REGISTER_SHELL_COMMAND( "random_get", "returns 32 bit of pseudo randomness", _random_get);
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#include "periph/rtc.h"

#include "shell_commands.h"

static void _alarm_handler(void *arg)
{
(void) arg;
Expand Down Expand Up @@ -183,3 +185,5 @@ int _rtc_handler(int argc, char **argv)
}
return 0;
}

REGISTER_SHELL_COMMAND("rtc", "control RTC peripheral interface", _rtc_handler);
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_saul_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include "saul_reg.h"

#include "shell_commands.h"

/* this function does not check, if the given device is valid */
static void probe(int num, saul_reg_t *dev)
{
Expand Down Expand Up @@ -153,3 +155,5 @@ int _saul(int argc, char **argv)
}
return 0;
}

REGISTER_SHELL_COMMAND("saul", "interact with sensors and actuators using SAUL", _saul);
7 changes: 5 additions & 2 deletions sys/shell/commands/sc_sht11.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <string.h>
#include "sht11.h"

#ifdef MODULE_SHT11
#include "shell_commands.h"

extern float sht11_temperature_offset;

Expand Down Expand Up @@ -109,4 +109,7 @@ int _set_offset_handler(int argc, char **argv)
}
}

#endif
REGISTER_SHELL_COMMAND("temp", "Prints measured temperature.", _get_temperature_handler);
REGISTER_SHELL_COMMAND("hum", "Prints measured humidity.", _get_humidity_handler);
REGISTER_SHELL_COMMAND("weather", "Prints measured humidity and temperature.", _get_weather_handler);
REGISTER_SHELL_COMMAND("offset", "Set temperature offset.", _set_offset_handler);
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_sntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "net/ipv6/addr.h"
#include "timex.h"

#include "shell_commands.h"

#define _DEFAULT_TIMEOUT (500000LU)

static void _usage(char *cmd)
Expand Down Expand Up @@ -102,3 +104,5 @@ int _ntpdate(int argc, char **argv)
#endif
return 0;
}

REGISTER_SHELL_COMMAND( "ntpdate", "synchronizes with a remote time server", _ntpdate);
3 changes: 3 additions & 0 deletions sys/shell/commands/sc_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "periph/pm.h"
#include "shell_commands.h"

int _reboot_handler(int argc, char **argv)
{
Expand All @@ -29,3 +30,5 @@ int _reboot_handler(int argc, char **argv)

return 0;
}

REGISTER_SHELL_COMMAND("reboot", "Reboot the node", _reboot_handler);
7 changes: 5 additions & 2 deletions sys/shell/commands/sc_vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* @}
*/

#if MODULE_VFS
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
Expand All @@ -31,6 +30,8 @@

#include "vfs.h"

#include "shell_commands.h"

#define SHELL_VFS_BUFSIZE 256
static uint8_t _shell_vfs_data_buffer[SHELL_VFS_BUFSIZE];

Expand Down Expand Up @@ -582,4 +583,6 @@ int _vfs_handler(int argc, char **argv)
return 1;
}
}
#endif

REGISTER_SHELL_COMMAND("vfs", "virtual file system operations", _vfs_handler);
REGISTER_SHELL_COMMAND("ls", "list files", _ls_handler);
4 changes: 4 additions & 0 deletions sys/shell/commands/sc_whitelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "net/gnrc/ipv6/whitelist.h"

#include "shell_commands.h"

static void _usage(char *cmd)
{
printf("usage: * %s\n", cmd);
Expand Down Expand Up @@ -59,4 +61,6 @@ int _whitelist(int argc, char **argv)
return 0;
}

REGISTER_SHELL_COMMAND("whitelist", "whitelists an address for receival ('whitelist [add|del|help]')", _whitelist);

/** @} */
Loading