...place sections at particular places in memory?

Comments

4 comments

  • Avatar
    Michael Farnet

    I have used this to make a section after the vectors.  But now, I need to place the value 0x12345678 at location 0x000002FC.  Does this mean I need to edit the palcement file AND the memory map?

    0
    Comment actions Permalink
  • Avatar
    Michael Farnet

    You helped me with the read of location 0x2FC, but how do I set a constant to be at this address at compile time?  I know how to do it with a postlink.js crossscript, But that is too hidden away.

    I tried putting a .CRP section at 0x2FC in the flash placement file:

     <ProgramSection alignment="4" load="Yes" name=".CRP" size="0x4" start="0x000002FC"/>

    and then set it like this in the code:
    const uint32_t CRP_Value __attribute__ ((section(".CRP"))) = 0x11223344;

    But, looking at the flash after it loads, I don't see it at the location, but CRP_Value is indeed 0x11223344.  It's just not where it needs to be.

    I don't know if you know why this is an issue, but this is the code read protection control for the LPC1700.  Different values at this location control how much code protection there is by disabling JTAG and debug and primary boot loader.

    Regards,

    Mike.

    0
    Comment actions Permalink
  • Avatar
    Michael Farnet

    Okay, it started working and I don't know why.  I thought I tried what I did once before.

    You have to use CRP_Value for it to be included in the compile for one thing.

    I tried removing the const from the type thinking the compiler was putting it in .rodata section.

    Is there a way to include data or a string in the compile even when it doesn't get used?  For a copyright notice or something like that.

    Regards,

    Mike.

    0
    Comment actions Permalink
  • Avatar
    Jon Elliott

    Mike,

    FWIW, you could also do this using a .org assembler directive as described for the LPC2000 here.

    You can use the "Linker Options > Keep Symbols" project property to specify symbols that you don't want the linker to discard.

    Regards,

    Jon

    0
    Comment actions Permalink

Please sign in to leave a comment.