You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the Feather M4 bootloader is compiled and modifications are made to use the RESET_CONTROLLER->RCAUSE.bit.WDT field, the bootloader fails to compile to due another definition of WDT.
Example code modifications:
diff --git a/Makefile b/Makefile
index 435a75c..4cb5ad9 100755
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-BOARD=zero
+BOARD=feather_m4
-include Makefile.user
include boards/$(BOARD)/board.mk
CC=arm-none-eabi-gcc
diff --git a/src/main.c b/src/main.c
index 095fa0a..51b5caf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -293,6 +293,11 @@ int main(void) {
/* Jump in application if condition is satisfied */
check_start_application();
+ if (RESET_CONTROLLER->RCAUSE.bit.WDT)
+ {
+ // noop
+ }
+
/* We have determined we should stay in the monitor. */
/* System initialization */
system_init();
Resulting compilation output:
$ make
Building feather_m4
echo "src/main.c"
src/main.c
arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -O2 -g -DSAMD51 -x c -c -pipe -nostdlib --param max-inline-insns-single=500 -fno-strict-aliasing -fdata-sections -ffunction-sections -D__SAMD51J19A__ -Werror -Wall -Wstrict-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wno-undef -Wbad-function-cast -Wwrite-strings -Waggregate-return -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align -Wno-missing-braces -Wno-overflow -Wno-shadow -Wno-attributes -Wno-packed -Wno-pointer-sign -I. -I./inc -I./inc/preprocessor -I./boards/feather_m4 -Ilib/cmsis/CMSIS/Include -Ilib/usb_msc -Ibuild/feather_m4 -Ilib/samd51/include/ src/main.c -o build/feather_m4/main.o
In file included from lib/samd51/include/sam.h:38,
from ./inc/uf2.h:7,
from src/main.c:81:
src/main.c: In function 'main':
lib/samd51/include/samd51j19a.h:1016:27: error: expected identifier before '(' token
#define WDT ((Wdt *)0x40002000UL) /**< \brief (WDT) APB Base Address */
^
src/main.c:296:38: note: in expansion of macro 'WDT'
if (RESET_CONTROLLER->RCAUSE.bit.WDT)
^~~
make: *** [Makefile:181: build/feather_m4/main.o] Error 1
The conflict of WDT is caused by the definitions in lib/samd51/include/component/rstc.h and lib/samd51/include/samd51j19a.h.
Current workaround is to use an #undef of WDT prior to use of the bit, as seen below:
diff --git a/src/main.c b/src/main.c
index 095fa0a..ddafeb6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -293,6 +293,12 @@ int main(void) {
/* Jump in application if condition is satisfied */
check_start_application();
+ #undef WDT
+ if (RESET_CONTROLLER->RCAUSE.bit.WDT)
+ {
+ // noop
+ }
+
/* We have determined we should stay in the monitor. */
/* System initialization */
system_init();
The text was updated successfully, but these errors were encountered:
When the Feather M4 bootloader is compiled and modifications are made to use the
RESET_CONTROLLER->RCAUSE.bit.WDT
field, the bootloader fails to compile to due another definition ofWDT
.Example code modifications:
Resulting compilation output:
The conflict of WDT is caused by the definitions in
lib/samd51/include/component/rstc.h
andlib/samd51/include/samd51j19a.h
.Current workaround is to use an
#undef
of WDT prior to use of the bit, as seen below:The text was updated successfully, but these errors were encountered: