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/MSP430FR5872: Location of mpu_ctl0_value clashes with other things

Part Number: MSP430FR5872

Tool/software: Code Composer Studio

Hopefully the formatting on this comes out decently.

I have modified the linker command script to create a data section and a code section for doing self programming on my controller.

.update_buffer : {} > 0x4800 /* buffer data for temporarily holding new firmware */
.update_code : {} > 0xC800 /* code for updating firmware */

And in code I have the following

#define MAX_UPDATE_SIZE 0x8000

#pragma DATA_SECTION(update_storage, ".update_buffer")
uint8_t update_storage[MAX_UPDATE_SIZE] = {
 [0 ... MAX_UPDATE_SIZE-1] = 0
};

#pragma CODE_SECTION(do_firmware_update, ".update_code")
void do_firmware_update()
{

}

The map file generated during build shows things work as expected, except for the presence of mpu_ctl0_value near the middle of my update_storage area.

00004800  update_storage             
0000a501  mpu_ctl0_value             
0000c800  do_firmware_update

What is mpu_ctl0_value used for? Can I move it?

  • Hello Thomas,

    Thank you for posting the question.
    I am looking into this for you and will get back to you as soon as possible.

    Best Regards,

    Yiding
  • Hello Thomas,

    It looks like the you are trying to make a custom bootloader. I recommend you checkout MSP430FRBoot instead of trying to write the bootloader from scratch: www.ti.com/lit/an/slaa721b/slaa721b.pdf


    If this is not an option, you should redefine .update_buffer and .update_code as actual memory sections (e.g. FRAM, FRAM2, etc.) so that no code gets placed in them. Section 4.3 in this document: www.ti.com/.../slaa729a.pdf shows how to do this on a flash part. The process is pretty much the same on FRAM but without having to consider segmentation.

    Please let us know if you have any questions.

    Best Regards,

    Yiding

  • Hi Thomas,

    The mpu_ctl0_value is the initial value that will be programmed in MPU (Memory Protection Unit) register. It is the default value for the register. I would suggest to keep it.

    If you would like to know the details of it this is the best start: www.ti.com/.../slaa685.pdf
    MPU basically protects the execution code area in the memory from unintended programming. The MSP430FR59xx/58xx automatically divides the memory into three region:
    - readable and writeable memory --> allocated to have data buffer in the non-volatile memory
    - IPE (IP Encapsulation) section --> need manual setup to have the section that is secured and not readable and not programmable
    - executable section --> where the application program lies, and this area is not programmable

**Attention** This is a public forum