From 2df245d668145fc69eb50f362fab7d1c011263e3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 12 Mar 2011 17:49:47 +0000 Subject: [PATCH] More apps/ related changes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3372 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/stm32/stm32_start.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/stm32/stm32_start.c b/arch/arm/src/stm32/stm32_start.c index 1ac753f5ac..9deb19dd2c 100644 --- a/arch/arm/src/stm32/stm32_start.c +++ b/arch/arm/src/stm32/stm32_start.c @@ -2,7 +2,7 @@ * arch/arm/src/stm32/stm32_start.c * arch/arm/src/chip/stm32_start.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -51,6 +51,8 @@ #include "up_internal.h" #include "stm32_internal.h" +#include "stm32_gpio.h" + /**************************************************************************** * Private Definitions @@ -67,6 +69,31 @@ /**************************************************************************** * Private Functions ****************************************************************************/ + +void stm32_jtag_enable(void) +{ +#ifdef CONFIG_STM32_JTAG_FULL_ENABLE + +#elif CONFIG_STM32_JTAG_NOJNTRST_ENABLE + uint32_t val = getreg32(STM32_AFIO_MAPR); + val &= 0x00FFFFFF; // clear undefined readings ... + val |= AFIO_MAPR_SWJ; // enabled but without JNTRST + putreg32(val, STM32_AFIO_MAPR); + +#elif CONFIG_STM32_JTAG_SW_ENABLE + uint32_t val = getreg32(STM32_AFIO_MAPR); + val &= 0x00FFFFFF; // clear undefined readings ... + val |= AFIO_MAPR_SWDP; // set JTAG-DP disabled and SW-DP enabled + putreg32(val, STM32_AFIO_MAPR); + +#else + uint32_t val = getreg32(STM32_AFIO_MAPR); + val &= 0x00FFFFFF; // clear undefined readings ... + val |= AFIO_MAPR_DISAB; // set JTAG-DP and SW-DP Disabled + putreg32(val, STM32_AFIO_MAPR); + +#endif +} /**************************************************************************** * Name: showprogress @@ -103,6 +130,7 @@ void __start(void) stm32_clockconfig(); stm32_lowsetup(); + stm32_jtag_enable(); showprogress('A'); /* Clear .bss. We'll do this inline (vs. calling memset) just to be