Fix serial boot functionality for Mynewt
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/mynewt/src/main.c b/boot/mynewt/src/main.c
index 9971c9f..3033d07 100755
--- a/boot/mynewt/src/main.c
+++ b/boot/mynewt/src/main.c
@@ -17,6 +17,10 @@
* under the License.
*/
+#ifdef MCUBOOT_MYNEWT
+#include "mcuboot_config/mcuboot_config.h"
+#endif
+
#include <assert.h>
#include <stddef.h>
#include <inttypes.h>
@@ -74,8 +78,15 @@
* Configure a GPIO as input, and compare it against expected value.
* If it matches, await for download commands from serial.
*/
+#ifdef MCUBOOT_MYNEWT
+ hal_gpio_init_in(MYNEWT_VAL(BOOT_SERIAL_DETECT_PIN),
+ MYNEWT_VAL(BOOT_SERIAL_DETECT_PIN_CFG));
+ if (hal_gpio_read(MYNEWT_VAL(BOOT_SERIAL_DETECT_PIN)) ==
+ MYNEWT_VAL(BOOT_SERIAL_DETECT_PIN_VAL)) {
+#else
hal_gpio_init_in(BOOT_SERIAL_DETECT_PIN, BOOT_SERIAL_DETECT_PIN_CFG);
if (hal_gpio_read(BOOT_SERIAL_DETECT_PIN) == BOOT_SERIAL_DETECT_PIN_VAL) {
+#endif
boot_serial_start(BOOT_SER_CONS_INPUT);
assert(0);
}