Change in simtrace2[master]: add make DEFINE to remove assert ERASE code

Harald Welte gerrit-no-reply at
Thu May 23 16:34:29 UTC 2019

Harald Welte has submitted this change and it was merged. ( )

Change subject: add make DEFINE to remove assert ERASE code

add make DEFINE to remove assert ERASE code

remove code to assert peer ERASE line by default.
see README for more information.

Change-Id: I5f88ecf1e2dcf00c0297597f88dd361a6e088c1e
M firmware/Makefile
M firmware/README.txt
M firmware/libboard/qmod/source/board_qmod.c
3 files changed, 17 insertions(+), 1 deletion(-)

  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified

diff --git a/firmware/Makefile b/firmware/Makefile
index c0f53f3..fa72bd3 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -120,6 +120,10 @@
+# allow asserting the peer SAM3S ERASE signal to completely erase the flash
+# only applicable for qmod board
@@ -163,7 +167,7 @@
 #CFLAGS += -Wa,-a,-ad
 CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb # -mfix-cortex-m3-ldrd
diff --git a/firmware/README.txt b/firmware/README.txt
index dcbafb2..fa7f60a 100644
--- a/firmware/README.txt
+++ b/firmware/README.txt
@@ -76,6 +76,10 @@
 Accepted values: 0 (NO_TRACE) to 5 (DEBUG)
+The qmod specific option `ALLOW_PEER_ERASE` controls if the UART debug command to assert the peer SAM3S ERASE line is present in the code.
+Per default this is set to 0 to prevent accidentally erasing all firmware, including the DFU bootloader, which would then need to be flashed using SAM-BA or JTAG/SWD.
+Setting `ALLOW_PEER_ERASE` to 1 enables back the debug command and should be used only for debugging or development purposes.
 = Flashing
 To flash a firmware image follow the instructions provided in the [wiki](
diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c
index cab5271..4d75b98 100644
--- a/firmware/libboard/qmod/source/board_qmod.c
+++ b/firmware/libboard/qmod/source/board_qmod.c
@@ -184,10 +184,12 @@
 /* returns '1' in case we should break any endless loop */
 void board_exec_dbg_cmd(int ch)
 	/* this variable controls if it is allowed to assert/release the ERASE line.
 	   this is done to prevent accidental ERASE on noisy serial input since only one character can trigger the ERASE.
 	static bool allow_erase = false;
 	switch (ch) {
 	case '?':
@@ -209,9 +211,11 @@
 		printf("\tX\tRelease peer SAM3 from reset\n\r");
 		printf("\tx\tAssert peer SAM3 reset\n\r");
 		printf("\tY\tRelease peer SAM3 ERASE signal\n\r");
 		printf("\ta\tAllow asserting peer SAM3 ERASE signal\n\r");
 		printf("\ty\tAssert peer SAM3 ERASE signal\n\r");
 		printf("\tU\tProceed to USB Initialization\n\r");
 		printf("\t1\tGenerate 1ms reset pulse on WWAN1\n\r");
 		printf("\t2\tGenerate 1ms reset pulse on WWAN2\n\r");
@@ -245,6 +249,7 @@
 		printf("Setting _SIMTRACExx_RST -> SIMTRACExx_RST low (active)\n\r");
 	case 'Y':
 		printf("Clearing SIMTRACExx_ERASE (inactive)\n\r");
@@ -261,6 +266,7 @@
 			printf("Please first allow setting SIMTRACExx_ERASE\n\r");
 	case '1':
 		printf("Resetting Modem 1 (of this SAM3)\n\r");
 		wwan_perst_do_reset_pulse(0, 300);
@@ -283,10 +289,12 @@
 	// set protection back so it can only run for one command
 	if ('a' != ch) {
 		allow_erase = false;
 void board_main_top(void)

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5f88ecf1e2dcf00c0297597f88dd361a6e088c1e
Gerrit-Change-Number: 14147
Gerrit-PatchSet: 2
Gerrit-Owner: Kévin Redon <kredon at>
Gerrit-Reviewer: Harald Welte <laforge at>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list