This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP432P401R: Error: Memory Map Prevented Reading 0x20010000

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hi,

There is an error which always comes for the variables declared in the code of CCS. I have attached a picture of the error message which I get. I use a MAC laptop and I get this but I have also seen a couple of windows laptops do the same. Basically this happens sometimes for some variables which are declared inside the main function. If I disconnect the target then the error is gone and the msp runs with the uploaded code but this is causing problems for debugging.


Thank You

#include "driverlib.h"
#include <stdint.h>
#include <stdbool.h>
#include "printf.h"
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <stdlib.h>

int vspfunc(char *format, ...);

static volatile uint8_t rxAHigher = 0, rxALower = 0, trashA1 = 0, trashA2 = 0, rxBHigher = 0, rxBLower = 0;
static uint8_t tx = 0;
static uint8_t rxA = 0, rxB = 0;
static float voltage1 = 0, voltage2 = 0;
static char s[100];

const eUSCI_SPI_MasterConfig spiMasterConfig =
{
        EUSCI_B_SPI_CLOCKSOURCE_SMCLK,
        30000000,
        30000000,
        EUSCI_B_SPI_MSB_FIRST,
        EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT,
        EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW,
        EUSCI_B_SPI_3PIN
};

const eUSCI_UART_Config uartConfig =
{
        EUSCI_A_UART_CLOCKSOURCE_SMCLK,
        16,
        4,
        146,
        EUSCI_A_UART_NO_PARITY,
        EUSCI_A_UART_LSB_FIRST,
        EUSCI_A_UART_ONE_STOP_BIT,
        EUSCI_A_UART_MODE,
        EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION
};

int main(void)
{
    	WDT_A_holdTimer();

    	MAP_FPU_enableModule();

        uint32_t i = 0;

        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION);

        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);

        P5OUT |= BIT2;

        P5DIR |= BIT2;

        P5OUT |= BIT2;

        SPI_initMaster(EUSCI_B0_BASE, &spiMasterConfig);

        SPI_enableModule(EUSCI_B0_BASE);

        SPI_enableInterrupt(EUSCI_B0_BASE, EUSCI_B_SPI_RECEIVE_INTERRUPT);

        SPI_enableInterrupt(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT);

        MAP_CS_setDCOFrequency(30000000);

        MAP_UART_initModule(EUSCI_A0_BASE, &uartConfig);

        MAP_UART_enableModule(EUSCI_A0_BASE);

        MAP_Interrupt_enableMaster();

        for(i = 0; i < 3000; i++);

        P5OUT &= (~BIT2);

        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
        SPI_transmitData(EUSCI_B0_BASE, 0x84);
        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
        SPI_transmitData(EUSCI_B0_BASE, tx);
        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
        SPI_transmitData(EUSCI_B0_BASE, tx);
        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
        SPI_transmitData(EUSCI_B0_BASE, tx);
        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
        SPI_transmitData(EUSCI_B0_BASE, tx);
        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
        SPI_transmitData(EUSCI_B0_BASE, tx);

        P5OUT |= BIT2;

        while(1) {

            rxA = 0;

            P5OUT &= (~BIT2);

            while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
            SPI_transmitData(EUSCI_B0_BASE, 0x84);
            trashA1 = SPI_receiveData(EUSCI_B0_BASE);

            while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
            SPI_transmitData(EUSCI_B0_BASE, tx);
            trashA2 = SPI_receiveData(EUSCI_B0_BASE);

            while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
            SPI_transmitData(EUSCI_B0_BASE, tx);
            rxAHigher = SPI_receiveData(EUSCI_B0_BASE);

            while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
            SPI_transmitData(EUSCI_B0_BASE, tx);
            rxALower = SPI_receiveData(EUSCI_B0_BASE);

            while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
            SPI_transmitData(EUSCI_B0_BASE, tx);
            rxBHigher = SPI_receiveData(EUSCI_B0_BASE);

            while (!(SPI_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
            SPI_transmitData(EUSCI_B0_BASE, tx);
            rxBLower = SPI_receiveData(EUSCI_B0_BASE);

            MAP_UART_transmitData(EUSCI_A0_BASE, rxAHigher);
            MAP_UART_transmitData(EUSCI_A0_BASE, rxALower);
            MAP_UART_transmitData(EUSCI_A0_BASE, rxBHigher);
            MAP_UART_transmitData(EUSCI_A0_BASE, rxBLower);

        }

}

int vspfunc(char *format, ...)
{
   va_list aptr;
   int ret;

   va_start(aptr, format);
   ret = vsprintf(s, format, aptr);
   va_end(aptr);

   return(ret);
}

  • Bhavi Bharat Kotha said:
    Basically this happens sometimes for some variables which are declared inside the main function.

    I can repeat this for a variable which is allocated on the stack at entry to main:

    This occurs before the stack pointer has been decremented to allocate the stack frame for the main function. Upon entry to main the stack pointer is 0x20010000 which is just above the top of the MSP432 SRAM which is why the "Memory map prevented reading" error occurs.

    Once have stepped over the first instruction in main which sets up the stack frame then the variable is displayed correctly:

    Bhavi Bharat Kotha said:
    If I disconnect the target then the error is gone and the msp runs with the uploaded code but this is causing problems for debugging.

    Given that the variable is displayed corrected after have stepped into the main function debugging should still be possible.

  • I think I understand what you are saying. I am putting breakpoints inside main now and using the step in key in the debug mode and it works. Thanks for the clarification.