Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of X_NUCLEO_COMMON by
DbgMCU/DbgMCU.h@15:923ab55e8d5d, 2016-02-16 (annotated)
- Committer:
- apalmieri
- Date:
- Tue Feb 16 10:01:10 2016 +0000
- Revision:
- 15:923ab55e8d5d
- Parent:
- 1:ca975408dd4e
Delete useless row
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Wolfgang Betz |
1:ca975408dd4e | 1 | /** |
| Wolfgang Betz |
1:ca975408dd4e | 2 | ****************************************************************************** |
| Wolfgang Betz |
1:ca975408dd4e | 3 | * @file DbgMCU.h |
| Wolfgang Betz |
1:ca975408dd4e | 4 | * @author AST / EST |
| Wolfgang Betz |
1:ca975408dd4e | 5 | * @version V0.0.1 |
| Wolfgang Betz |
1:ca975408dd4e | 6 | * @date 30-March-2015 |
| Wolfgang Betz |
1:ca975408dd4e | 7 | * @brief Header file for enabling debugging in sleep modes for STM32 MCUs |
| Wolfgang Betz |
1:ca975408dd4e | 8 | ****************************************************************************** |
| Wolfgang Betz |
1:ca975408dd4e | 9 | * @attention |
| Wolfgang Betz |
1:ca975408dd4e | 10 | * |
| Wolfgang Betz |
1:ca975408dd4e | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
| Wolfgang Betz |
1:ca975408dd4e | 12 | * |
| Wolfgang Betz |
1:ca975408dd4e | 13 | * Redistribution and use in source and binary forms, with or without modification, |
| Wolfgang Betz |
1:ca975408dd4e | 14 | * are permitted provided that the following conditions are met: |
| Wolfgang Betz |
1:ca975408dd4e | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
| Wolfgang Betz |
1:ca975408dd4e | 16 | * this list of conditions and the following disclaimer. |
| Wolfgang Betz |
1:ca975408dd4e | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| Wolfgang Betz |
1:ca975408dd4e | 18 | * this list of conditions and the following disclaimer in the documentation |
| Wolfgang Betz |
1:ca975408dd4e | 19 | * and/or other materials provided with the distribution. |
| Wolfgang Betz |
1:ca975408dd4e | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| Wolfgang Betz |
1:ca975408dd4e | 21 | * may be used to endorse or promote products derived from this software |
| Wolfgang Betz |
1:ca975408dd4e | 22 | * without specific prior written permission. |
| Wolfgang Betz |
1:ca975408dd4e | 23 | * |
| Wolfgang Betz |
1:ca975408dd4e | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| Wolfgang Betz |
1:ca975408dd4e | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| Wolfgang Betz |
1:ca975408dd4e | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| Wolfgang Betz |
1:ca975408dd4e | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| Wolfgang Betz |
1:ca975408dd4e | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| Wolfgang Betz |
1:ca975408dd4e | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| Wolfgang Betz |
1:ca975408dd4e | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| Wolfgang Betz |
1:ca975408dd4e | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| Wolfgang Betz |
1:ca975408dd4e | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| Wolfgang Betz |
1:ca975408dd4e | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| Wolfgang Betz |
1:ca975408dd4e | 34 | * |
| Wolfgang Betz |
1:ca975408dd4e | 35 | ****************************************************************************** |
| Wolfgang Betz |
1:ca975408dd4e | 36 | */ |
| Wolfgang Betz |
1:ca975408dd4e | 37 | |
| Wolfgang Betz |
1:ca975408dd4e | 38 | /* Define to prevent from recursive inclusion --------------------------------*/ |
| Wolfgang Betz |
1:ca975408dd4e | 39 | #ifndef __DBG_MCU_H |
| Wolfgang Betz |
1:ca975408dd4e | 40 | #define __DBG_MCU_H |
| Wolfgang Betz |
1:ca975408dd4e | 41 | |
| Wolfgang Betz |
1:ca975408dd4e | 42 | /* Includes ------------------------------------------------------------------*/ |
| Wolfgang Betz |
1:ca975408dd4e | 43 | |
| Wolfgang Betz |
1:ca975408dd4e | 44 | /* Classes -------------------------------------------------------------------*/ |
| Wolfgang Betz |
1:ca975408dd4e | 45 | /** Helper class DbgMCU providing a default constructor which enables debugging |
| Wolfgang Betz |
1:ca975408dd4e | 46 | * on STM32 MCUs while using sleep modes. |
| Wolfgang Betz |
1:ca975408dd4e | 47 | */ |
| Wolfgang Betz |
1:ca975408dd4e | 48 | class DbgMCU |
| Wolfgang Betz |
1:ca975408dd4e | 49 | { |
| Wolfgang Betz |
1:ca975408dd4e | 50 | public: |
| Wolfgang Betz |
1:ca975408dd4e | 51 | /** Create a DbgMCU dummy object */ |
| Wolfgang Betz |
1:ca975408dd4e | 52 | DbgMCU(void) { |
| Wolfgang Betz |
1:ca975408dd4e | 53 | /* the following code is NOT portable */ |
| Wolfgang Betz |
1:ca975408dd4e | 54 | volatile uint32_t *dbgmcu_creg = (uint32_t*)0xE0042004; |
| Wolfgang Betz |
1:ca975408dd4e | 55 | uint32_t tmp = *dbgmcu_creg; |
| Wolfgang Betz |
1:ca975408dd4e | 56 | |
| Wolfgang Betz |
1:ca975408dd4e | 57 | tmp &= ~(0xE7); |
| Wolfgang Betz |
1:ca975408dd4e | 58 | tmp |= 0x27; // Set asynchronous communication via DBGMCU_CR (for ITM/printf) |
| Wolfgang Betz |
1:ca975408dd4e | 59 | // tmp |= 0xE7; // Set 4-pin tracing via DBGMCU_CR (for ETM) |
| Wolfgang Betz |
1:ca975408dd4e | 60 | *dbgmcu_creg = tmp; |
| Wolfgang Betz |
1:ca975408dd4e | 61 | } |
| Wolfgang Betz |
1:ca975408dd4e | 62 | }; |
| Wolfgang Betz |
1:ca975408dd4e | 63 | |
| Wolfgang Betz |
1:ca975408dd4e | 64 | #endif /* __DBG_MCU_H */ |
