Hi, all experts,
I wanted to protect the FRAM section for that I have created a file named low_level_init.c in that file I have wrote a few lines of codes
#include <msp430.h> extern unsigned char SYSNMIflag;// = 0; unsigned int *ptr = 0; unsigned int Data =0; int __low_level_init(void) { WDTCTL = WDTPW | WDTHOLD; // Stop WDT // Configure GPIO P1DIR |= BIT0; // Configure P1.0 for LED // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5; // Configure MPU MPUCTL0 = MPUPW; // Write PWD to access MPU registers MPUSEGB1 = 0x0400; // B1 = 0x4000; B2 = 0x5FFF MPUSEGB2 = 0x0440; // Borders are assigned to segments // Segment 1 - Execute, Read // Segment 2 - Execute, Read // Segment 3 - Execute, Read MPUSAM = MPUSEG1RE | MPUSEG1XE | MPUSEG2RE | MPUSEG2XE | MPUSEG3RE | MPUSEG3XE | MPUSEGIRE | MPUSEGIWE| MPUSEGIXE; MPUCTL0 = MPUPW | MPUENA | MPUSEGIE; // Enable MPU protection // MPU registers locked until BOR /*Data = 0x88; // Cause an MPU violation by writing to segment 2 ptr = (unsigned int *)0x4000; *ptr = Data;*/ while(SYSNMIflag) // Has violation occurred due to Seg2 { P1OUT ^= BIT0; // Toggle LED __delay_cycles(100000); // Delay to see toggle MPUCTL0 = MPUPW; SYSNMIflag = 0; PMMIFG |= SVSHIFG; } return 1; } // System NMI vector #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector = SYSNMI_VECTOR __interrupt void SYSNMI_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(SYSNMI_VECTOR))) SYSNMI_ISR (void) #else #error Compiler not supported! #endif { switch (__even_in_range(SYSSNIV, SYSSNIV__CBDIFG)) { case SYSSNIV__NONE: break; case SYSSNIV__UBDIFG: break; case SYSSNIV__MPUSEGPIFG: break; case SYSSNIV__MPUSEGIIFG: break; case SYSSNIV__MPUSEG1IFG: break; case SYSSNIV__MPUSEG2IFG: MPUCTL1 &= ~MPUSEG2IFG; // Clear violation interrupt flag SYSNMIflag = 1; // Set flag break; case SYSSNIV__MPUSEG3IFG: break; case SYSSNIV__VMAIFG: break; case SYSSNIV__JMBINIFG: break; case SYSSNIV__JMBOUTIFG: break; case SYSSNIV__CBDIFG: break; default: break; } }
but I can see that in memory location 0x4800 there are FF 3F FF 3F..... and so on?
1) How do I protect my FRAM section?
2) How to remove FF 3F? I think this is IPE but I have not enabled that.
Can anyone please clarify that ASAP, its urgent..