Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CCS/TMS320F28027: How to disable the watchpoit Register once it is configured

$
0
0

Part Number:TMS320F28027

Tool/software: Code Composer Studio

Currently we are configuring watch point register for few address location in the stack to monitor the stack and it is working. Now, we need to disable this configured watch point and configure for new address range. The above mentioned steps shall go on in for loop as with application. For us, we are able to get the RTOS interrupt when someone is writing in monitored address location and we are not sure how to disable the configured watch point and get configure for new address range.

/*! Analysis Watch point Register definitions */
#define LX_LBD_SPC_DETECT_WPR1_MASK_LOW     (volatile uint16_t *)(uint16_t)0x0828U
#define LX_LBD_SPC_DETECT_WPR1_MASK_HIGH    (volatile uint16_t *)(uint16_t)0x0829U
#define LX_LBD_SPC_DETECT_WPR1_REF_LOW      (volatile uint16_t *)(uint16_t)0x082AU
#define LX_LBD_SPC_DETECT_WPR1_REF_HIGH     (volatile uint16_t *)(uint16_t)0x082BU
#define LX_LBD_SPC_DETECT_WPR1_CTRL         (volatile uint16_t *)(uint16_t)0x082EU
#define LX_LBD_SPC_DETECT_WPR1_ID           (volatile uint16_t *)(uint16_t)0x082FU
/*! Stack corruption range size, the value has to be 2^N - 1, N = 1,2 .... */
#define LX_LBD_STACK_GUARD_MARGIN          50
#define LX_LBD_STKOV_RANGEMASK             0x0007

uint32_t GuardAddress = ((uint32_t)(&_STACK_END) - LX_LBD_STACK_GUARD_MARGIN) & (uint32_t)(~LX_LBD_STKOV_RANGEMASK);

    if ((GuardAddress < (uint32_t)(&_stack)) || (GuardAddress > (uint32_t)(&_STACK_END)))
    {
        return(LX_UL_FAIL);
    }

    ENABLE_PROTECTED_REGISTER_WRITE_MODE;

    /*! Claim ownership of watch point */
    *LX_LBD_SPC_DETECT_WPR1_CTRL = 0x0001U;

    /*! Wait for the previous instruction to settle */
    LX_LBD_UL_WATCHPOINT_ACCESS_DELAY;

    /*! Enable RTOS interrupt */
    HAL_enableRtosInt(handle);//IER |= 0x8000U;


    /*! Exit if application doesn't own watch point */
    if(((uint16_t)0x5001U) != (*LX_LBD_SPC_DETECT_WPR1_ID))
    {
        DISABLE_PROTECTED_REGISTER_WRITE_MODE;
        return(LX_UL_FAIL);
    }

    /*! Assign an ISR to respond to stack pointer corruption */
    //pie->RTOSINT = pStackCorruptIsr;

    /*! Assign the mask for unsafe stack pointer ranges */
    *LX_LBD_SPC_DETECT_WPR1_MASK_LOW = (uint32_t)LX_LBD_STKOV_RANGEMASK;

    /*! Assign reference address */
    *LX_LBD_SPC_DETECT_WPR1_REF_LOW = GuardAddress | (uint32_t)LX_LBD_STKOV_RANGEMASK;

    /*! Trigger RTOS ISR during Data write */
    *LX_LBD_SPC_DETECT_WPR1_CTRL = 0x085AU;

    DISABLE_PROTECTED_REGISTER_WRITE_MODE;


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>