Hi, I am exploring RIOT + LoRaWAN.
- I tested examples/lorawan and it worked fine
- Then I modified it to support shell commands, however when I do this I get a compilation error: sc_loramac.c:451: undefined reference to `loramac’
Below I share the diff of my changes in examples/lorawan, and the full log output.
Diff
diff --git a/examples/lorawan/Makefile b/examples/lorawan/Makefile
index 513490347f..8c47cd9476 100644
--- a/examples/lorawan/Makefile
+++ b/examples/lorawan/Makefile
@@ -29,6 +29,9 @@ USEMODULE += $(DRIVER)
USEMODULE += fmt
FEATURES_OPTIONAL += periph_rtc
+USEMODULE += shell
+USEMODULE += shell_commands
+
# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
diff --git a/examples/lorawan/main.c b/examples/lorawan/main.c
index 5a8a5e31b2..1a795fa119 100644
--- a/examples/lorawan/main.c
+++ b/examples/lorawan/main.c
@@ -49,6 +49,9 @@
#include "sx126x_params.h"
#endif
+#include "shell.h"
+#include "shell_commands.h"
+
/* Messages are sent every 20s to respect the duty cycle on each channel */
#define PERIOD_S (20U)
@@ -179,5 +182,9 @@ int main(void)
/* trigger the first send */
msg_t msg;
msg_send(&msg, sender_pid);
+
+ char line_buf[SHELL_DEFAULT_BUFSIZE];
+ shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
+
return 0;
}
Output of `make`
Building application "lorawan" for "b-l072z-lrwan1" with MCU "stm32".
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/pkg/semtech-loramac/
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/build/pkg/semtech-loramac/src/boards/mcu -f /home/geovane/dev/stuff/explore-riot/RIOT-pulga/pkg/semt
ech-loramac/Makefile.loramac_arch
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/build/pkg/semtech-loramac/src/system/crypto -f /home/geovane/dev/stuff/explore-riot/RIOT-pulga/pkg/semtech-loramac/Makefile.loramac_crypto
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/build/pkg/semtech-loramac/src/mac -f /home/geovane/dev/stuff/explore-riot/RIOT-pulga/pkg/semtech-lor
amac/Makefile.loramac_mac
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/build/pkg/semtech-loramac/src/mac/region -f /home/geovane/dev/stuff/explore-riot/RIOT-pulga/pkg/semt
ech-loramac/Makefile.loramac_region
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/boards/b-l072z-lrwan1
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/core
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/cpu/stm32
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/cpu/cortexm_common
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/cpu/cortexm_common/periph
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/cpu/stm32/periph
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/cpu/stm32/stmclk
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/cpu/stm32/vectors
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/drivers
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/drivers/periph_common
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/drivers/sx127x
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/pkg/semtech-loramac/contrib
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/auto_init
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/crypto
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/fmt
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/frac
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/hashes
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/iolist
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/isrpipe
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/luid
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/malloc_thread_safe
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/newlib_syscalls_default
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/pm_layered
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/random
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/rtc_utils
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/shell
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/shell/commands
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/stdio_uart
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/tsrb
"make" -C /home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/ztimer
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: /home/geovane/dev/stuff/explore-riot/RIOT-pulga/examples/lorawan/bin/b-l072z-lrwan1/shell_commands/sc_loramac.o: in function `_loramac_handler':
/home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/shell/commands/sc_loramac.c:209: undefined reference to `loramac'
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: /home/geovane/dev/stuff/explore-riot/RIOT-pulga/examples/lorawan/bin/b-l072z-lrwan1/shell_commands/sc_loramac.o: in function `_loramac_tx_usage':
/home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/shell/commands/sc_loramac.c:55: undefined reference to `loramac'
/usr/lib/gcc/arm-none-eabi/7.3.1/../../../arm-none-eabi/bin/ld: /home/geovane/dev/stuff/explore-riot/RIOT-pulga/examples/lorawan/bin/b-l072z-lrwan1/shell_commands/sc_loramac.o: in function `_loramac_handler':
/home/geovane/dev/stuff/explore-riot/RIOT-pulga/sys/shell/commands/sc_loramac.c:451: undefined reference to `loramac'
collect2: error: ld returned 1 exit status
make: *** [/home/geovane/dev/stuff/explore-riot/RIOT-pulga/examples/lorawan/../../Makefile.include:722: /home/geovane/dev/stuff/explore-riot/RIOT-pulga/examples/lorawan/bin/b-l072z-lrwan1/lorawan.elf] Error 1
Any ideas? Thanks.