modified itm_api.c for STK3701 and add SWO location 0 to EFM32GG11_STK3701, EFM32GG_STK3700, EFM32LG_STK3600, EFM32PG_STK3401, EFM32PG12_STK3402 and EFM32WG_STK3800

pull/12043/head
petroborys 2019-12-02 16:38:54 +02:00
parent fd22997b60
commit 2525100cc7
8 changed files with 81 additions and 18 deletions

View File

@ -33,6 +33,16 @@
#define PWM_TIMER_CLOCK cmuClock_TIMER2
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
/* Set SWO location */
#if DEVICE_ITM
/* Set location 0 */
#define SWO_LOCATION (GPIO->SWO_ROUTE & ~_GPIO_ROUTE_SWLOCATION_MASK) | GPIO_ROUTE_SWLOCATION_LOC0
/* Enable output on pin */
#define GPIO_PORT 5 // GPIO port number (A = 0, B = 1, ...)
#define SWO_MODE MODEL
#define SWO_ENABLE_OUTPUT_PIN (GPIO->P[GPIO_PORT].SWO_MODE & ~_GPIO_P_MODEL_MODE2_MASK) | GPIO_P_MODEL_MODE2_PUSHPULL
#endif
/* USB */
#define USB_TIMER USB_TIMER1

View File

@ -33,6 +33,25 @@
#define PWM_TIMER_CLOCK cmuClock_TIMER1
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
/* Set SWO location */
#if DEVICE_ITM
/* Set location 0 */
#define SWO_LOCATION (GPIO->SWO_ROUTE & ~_GPIO_ROUTELOC0_SWVLOC_MASK) | GPIO_ROUTELOC0_SWVLOC_LOC0
/* Enable output on pin */
#define GPIO_PORT 5 // GPIO port number (A = 0, B = 1, ...)
#define SWO_MODE MODEL
#define SWO_ENABLE_OUTPUT_PIN (GPIO->P[GPIO_PORT].SWO_MODE & ~_GPIO_P_MODEL_MODE2_MASK) | GPIO_P_MODEL_MODE2_PUSHPULL
/* Set location 1 */
/*
#define SWO_LOCATION (GPIO->SWO_ROUTE & ~_GPIO_ROUTELOC0_SWVLOC_MASK) | GPIO_ROUTELOC0_SWVLOC_LOC1
// Enable output on pin
#define GPIO_PORT 2 // GPIO port number (A = 0, B = 1, ...)
#define SWO_MODE MODEH
#define SWO_ENABLE_OUTPUT_PIN (GPIO->P[GPIO_PORT].SWO_MODE & ~_GPIO_P_MODEH_MODE15_MASK) | GPIO_P_MODEH_MODE15_PUSHPULL
*/
#endif
/* Crystal calibration */
#if !defined(CMU_HFXOINIT_STK_DEFAULT)
#define CMU_HFXOINIT_STK_DEFAULT \

View File

@ -33,6 +33,16 @@
#define PWM_TIMER_CLOCK cmuClock_TIMER2
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
/* Set SWO location */
#if DEVICE_ITM
/* Set location 0 */
#define SWO_LOCATION (GPIO->SWO_ROUTE & ~_GPIO_ROUTE_SWLOCATION_MASK) | GPIO_ROUTE_SWLOCATION_LOC0
/* Enable output on pin */
#define GPIO_PORT 5 // GPIO port number (A = 0, B = 1, ...)
#define SWO_MODE MODEL
#define SWO_ENABLE_OUTPUT_PIN (GPIO->P[GPIO_PORT].SWO_MODE & ~_GPIO_P_MODEL_MODE2_MASK) | GPIO_P_MODEL_MODE2_PUSHPULL
#endif
/* USB */
#define USB_TIMER USB_TIMER1

View File

@ -33,6 +33,16 @@
#define PWM_TIMER_CLOCK cmuClock_TIMER1
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
/* Set SWO location */
#if DEVICE_ITM
/* Set location 0 */
#define SWO_LOCATION (GPIO->SWO_ROUTE & ~_GPIO_ROUTELOC0_SWVLOC_MASK) | GPIO_ROUTELOC0_SWVLOC_LOC0
/* Enable output on pin */
#define GPIO_PORT 5 // GPIO port number (A = 0, B = 1, ...)
#define SWO_MODE MODEL
#define SWO_ENABLE_OUTPUT_PIN (GPIO->P[GPIO_PORT].SWO_MODE & ~_GPIO_P_MODEL_MODE2_MASK) | GPIO_P_MODEL_MODE2_PUSHPULL
#endif
/* Crystal Calibration */
#if !defined(CMU_HFXOINIT_STK_DEFAULT)
#define CMU_HFXOINIT_STK_DEFAULT \

View File

@ -33,6 +33,16 @@
#define PWM_TIMER_CLOCK cmuClock_TIMER1
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
/* Set SWO location */
#if DEVICE_ITM
/* Set location 0 */
#define SWO_LOCATION (GPIO->SWO_ROUTE & ~_GPIO_ROUTELOC0_SWVLOC_MASK) | GPIO_ROUTELOC0_SWVLOC_LOC0
/* Enable output on pin */
#define GPIO_PORT 5 // GPIO port number (A = 0, B = 1, ...)
#define SWO_MODE MODEL
#define SWO_ENABLE_OUTPUT_PIN (GPIO->P[GPIO_PORT].SWO_MODE & ~_GPIO_P_MODEL_MODE2_MASK) | GPIO_P_MODEL_MODE2_PUSHPULL
#endif
/* Crystal calibration */
#if !defined(CMU_HFXOINIT_STK_DEFAULT)
#define CMU_HFXOINIT_STK_DEFAULT \

View File

@ -33,6 +33,16 @@
#define PWM_TIMER_CLOCK cmuClock_TIMER2
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
/* Set SWO location */
#if DEVICE_ITM
/* Set location 0 */
#define SWO_LOCATION (GPIO->SWO_ROUTE & ~_GPIO_ROUTE_SWLOCATION_MASK) | GPIO_ROUTE_SWLOCATION_LOC0
/* Enable output on pin */
#define GPIO_PORT 5 // GPIO port number (A = 0, B = 1, ...)
#define SWO_MODE MODEL
#define SWO_ENABLE_OUTPUT_PIN (GPIO->P[GPIO_PORT].SWO_MODE & ~_GPIO_P_MODEL_MODE2_MASK) | GPIO_P_MODEL_MODE2_PUSHPULL
#endif
/* USB */
#define USB_TIMER USB_TIMER1

View File

@ -19,6 +19,7 @@
#include "hal/itm_api.h"
#include "cmsis.h"
#include "em_cmu.h"
#include "device_peripherals.h"
#include <stdbool.h>
@ -40,26 +41,18 @@ static void setupSWOForPrint(void)
GPIO->ROUTEPEN |= GPIO_ROUTEPEN_SWVPEN;
#endif
#endif
#if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_LEOPARD_FAMILY) || defined(_EFM32_WONDER_FAMILY) || defined(_EFM32_PEARL_FAMILY)
// Set location 0
#if defined( _GPIO_ROUTE_SWOPEN_MASK )
GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | GPIO_ROUTE_SWLOCATION_LOC0;
#elif defined( _GPIO_ROUTEPEN_SWVPEN_MASK )
GPIO->ROUTELOC0 = (GPIO->ROUTELOC0 & ~(_GPIO_ROUTELOC0_SWVLOC_MASK)) | GPIO_ROUTELOC0_SWVLOC_LOC0;
#if defined(_GPIO_ROUTE_MASK)
#define SWO_ROUTE ROUTE
#endif
#if defined(_GPIO_ROUTELOC0_MASK)
#define SWO_ROUTE ROUTELOC0
#endif
// Enable output on pin - GPIO Port F, Pin 2
GPIO->P[5].MODEL &= ~(_GPIO_P_MODEL_MODE2_MASK);
GPIO->P[5].MODEL |= GPIO_P_MODEL_MODE2_PUSHPULL;
#else
// Set location 1
GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | GPIO_ROUTE_SWLOCATION_LOC1;
// Set SWO location
GPIO->SWO_ROUTE = SWO_LOCATION;
// Enable output on pin
GPIO->P[2].MODEH &= ~(_GPIO_P_MODEH_MODE15_MASK);
GPIO->P[2].MODEH |= GPIO_P_MODEH_MODE15_PUSHPULL;
#endif
GPIO->P[GPIO_PORT].SWO_MODE = SWO_ENABLE_OUTPUT_PIN;
// Enable debug clock AUXHFRCO
CMU->OSCENCMD = CMU_OSCENCMD_AUXHFRCOEN;

View File

@ -6970,7 +6970,8 @@
"USTICKER",
"TRNG",
"FLASH",
"MPU"
"MPU",
"ITM"
],
"forced_reset_timeout": 5,
"config": {